freeCodeCamp/.eslintrc.json

153 lines
3.8 KiB
JSON
Raw Normal View History

{
"env": {
"es6": true,
"browser": true,
"mocha": true,
"node": true,
"jest": true
2019-02-18 22:43:11 +00:00
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"babelOptions": {
"presets": ["@babel/preset-react"]
}
},
"root": true,
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:jsx-a11y/recommended",
"prettier"
],
"plugins": ["no-only-tests", "filenames-simple"],
"globals": {
"Promise": true,
"window": true,
"$": true,
"ga": true,
"jQuery": true,
"router": true
},
"settings": {
"react": {
"version": "16.4.2"
},
"import/resolver": {
"typescript": true,
"node": true
}
},
"rules": {
"import/no-unresolved": [2, { "commonjs": true }],
"import/named": "error",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/order": "error",
"import/no-cycle": [2, { "maxDepth": 2 }],
"react/prop-types": "off",
"no-only-tests/no-only-tests": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"filenames-simple/naming-convention": ["warn"]
},
"overrides": [
{
"files": ["**/*.ts?(x)"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
feat: migrate to pnpm for better workspace DX (#49293) * feat: npm -> pnpm This resolves the issues with the gatsby client (gatsby-plugin-pnpm deals with the fact that gatsby is relying on its own dependencies being de-duped) and challenge-editor (which doesn't seem to want to automatically install codemirror and needed its own eslint config) * fix: correct mocha path for curriculum tests * fix: use select workspace with -F not -w * fix: reorganise packages and restrict hoisting pnpm works best if the workspaces keep their own dependencies, since dependencies are not flattened and then what node resolves from a require is predictable. @types seem to be a special case and more care is required to prevent them getting smushed together in the root (hence the .npmrc) * fix: add types for tools + root * fix: decouple challenge-auditor from client * fix: add ui-components types * fix(client): use the latest types for react 16 * fix: prettify * fix: prettierignore pnpm-lock * fix: relax hoisting Turns out pnpm works just fine with types. I don't know what was going wrong before, but there are no-longer any type conflicts. * fix: add @redux-saga/core to fix eslint issue It seems to only be redux-saga that import/named can't cope with, so it is probably okay to work around this one. * chore: add chai to tools/scripts/build * fix: add store to root for cypress * fix: allow cypress to download binaries If we want to keep preventing cypress from downloading binaries, we can figure out a workaround, but I'm allowing it to ease the transition to pnpm. My guess about why this is happening is that npm triggers Cypress's postinstall script, but pnpm does not (because pnpm install only installs if necessary, perferring to link) * chore: re-enable pre/post scripts * fix: update build scripts for client Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> * chore: update engines to use pnpm * fix: enable choice of (super)block for tests Only 'nix machines for now. * chore: pin pnpm to version 7 * chore: remove last npms Except web + curriculum-server. I'll update them when I start work on them again. * fix: lockfile check to catch any package-locks * fix(action): install pnpm for upcoming tests * chore: add nodemon to new api Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2023-03-02 18:17:44 +00:00
"./client/tsconfig.json",
"./tsconfig.json",
"./api/tsconfig.json",
"./shared/tsconfig.json",
"./tools/ui-components/tsconfig.json",
"./tools/client-plugins/browser-scripts/tsconfig.json",
feat: client overhaul proof of concept (#45844) * chore: initial setup of web package This is *not* a workspace, yet, because it would be nice to use the latest React, but /client can't migrate (yet). Having two React versions creates issues in workspaces since /.bin/next gets hoisted to root... and finds the root React version :( * feat: add config for next * fix: use jsx-runtime for web linting * chore: init curriculum-server with json-server * chore: integrate curriculum-server with TS/eslint * feat: add patch script json-server doesn't like keys with '/'s in so, for now I'm just patching them out. This lets us keep a strong separation between this WIP and the rest of the code. * fix: use port 8000 to avoid conflicts * feat: crude ISR demo using challenge pages * feat: extend ISR demo to use params * feat: return props for specific superblocks * chore: re-organise folders * refactor: put data fetching in a single module * refactor: challenge page slightly * feat: add link to test ISR You can see that, if you run next dev, the linked page gets regenerated whenever you navigate to it. However, if you run next build that is no longer the case and the page has to be reloaded for the user to see the latest version. The implication is that we'll need another method (Web worker, probably) to detect if the page needs to be updated. * feat: render static paths for rwd * feat: add monaco Editor * feat: send less data via props Rather than sending superblocks, this now sends blocks. Next step, just the challenge! * fix: only send individual challenge's data * feat: send /learn/stuff/<id> to the challenge page * fix: redirect to path with trailing id * fix: handle all possible path prefixes * feat: add superblocks with trailing ids * chore: rename block -> blockOrId * chore: remove logs * fix: return notFound if page id is missing * chore: add a note about increasing TS strictness * feat: serverside redirects This should be a touch more performant, but mostly it separates the concerns. Since the server already has the responsibility of choosing what pages to render, redirects fit naturally with its concerns. * refactor: clean up param validation * feat: create list of blocks in superblock * feat: add challenge links to map * feat: link to full path, not just id * refactor: ensure props match getStaticProps By specifying the props for GetStaticProps we ensure that it returns the expected data and use InferGetStaticPropsType to get the type out again for use in the component * feat: improve and document dev experience * refactor: separate routing from rendering * refactor: extract routing logic into functions * refactor: naming consistency * refactor: move data wrangling into get-curriculum * refactor: align blockOrId and id * chore: remove the server from workspaces * chore: remove the lock * docs: paths Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * chore: install before linting * fix: create env.json before installing new client * chore: ignore generated json file Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2022-05-09 16:30:15 +00:00
"./web/tsconfig.json",
"./curriculum-server/tsconfig.json",
"./cypress/tsconfig.json",
"./e2e/tsconfig.json"
]
},
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript"
],
"plugins": ["@typescript-eslint"],
"rules": {
"import/no-unresolved": "off",
"import/named": 0,
"@typescript-eslint/naming-convention": "off"
}
},
{
"files": [
"./tools/ui-components/**/*.test.[jt]s?(x)",
"./client/**/*.test.[jt]s?(x)"
],
"extends": [
"plugin:testing-library/react",
"plugin:jest-dom/recommended"
],
"rules": { "import/named": 2 }
},
{
"files": ["cypress/**/*.js"],
"globals": {
"cy": true,
"Cypress": true
}
feat: client overhaul proof of concept (#45844) * chore: initial setup of web package This is *not* a workspace, yet, because it would be nice to use the latest React, but /client can't migrate (yet). Having two React versions creates issues in workspaces since /.bin/next gets hoisted to root... and finds the root React version :( * feat: add config for next * fix: use jsx-runtime for web linting * chore: init curriculum-server with json-server * chore: integrate curriculum-server with TS/eslint * feat: add patch script json-server doesn't like keys with '/'s in so, for now I'm just patching them out. This lets us keep a strong separation between this WIP and the rest of the code. * fix: use port 8000 to avoid conflicts * feat: crude ISR demo using challenge pages * feat: extend ISR demo to use params * feat: return props for specific superblocks * chore: re-organise folders * refactor: put data fetching in a single module * refactor: challenge page slightly * feat: add link to test ISR You can see that, if you run next dev, the linked page gets regenerated whenever you navigate to it. However, if you run next build that is no longer the case and the page has to be reloaded for the user to see the latest version. The implication is that we'll need another method (Web worker, probably) to detect if the page needs to be updated. * feat: render static paths for rwd * feat: add monaco Editor * feat: send less data via props Rather than sending superblocks, this now sends blocks. Next step, just the challenge! * fix: only send individual challenge's data * feat: send /learn/stuff/<id> to the challenge page * fix: redirect to path with trailing id * fix: handle all possible path prefixes * feat: add superblocks with trailing ids * chore: rename block -> blockOrId * chore: remove logs * fix: return notFound if page id is missing * chore: add a note about increasing TS strictness * feat: serverside redirects This should be a touch more performant, but mostly it separates the concerns. Since the server already has the responsibility of choosing what pages to render, redirects fit naturally with its concerns. * refactor: clean up param validation * feat: create list of blocks in superblock * feat: add challenge links to map * feat: link to full path, not just id * refactor: ensure props match getStaticProps By specifying the props for GetStaticProps we ensure that it returns the expected data and use InferGetStaticPropsType to get the type out again for use in the component * feat: improve and document dev experience * refactor: separate routing from rendering * refactor: extract routing logic into functions * refactor: naming consistency * refactor: move data wrangling into get-curriculum * refactor: align blockOrId and id * chore: remove the server from workspaces * chore: remove the lock * docs: paths Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * chore: install before linting * fix: create env.json before installing new client * chore: ignore generated json file Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2022-05-09 16:30:15 +00:00
},
{
"files": ["e2e/*.ts"],
"rules": {
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off"
}
},
feat: client overhaul proof of concept (#45844) * chore: initial setup of web package This is *not* a workspace, yet, because it would be nice to use the latest React, but /client can't migrate (yet). Having two React versions creates issues in workspaces since /.bin/next gets hoisted to root... and finds the root React version :( * feat: add config for next * fix: use jsx-runtime for web linting * chore: init curriculum-server with json-server * chore: integrate curriculum-server with TS/eslint * feat: add patch script json-server doesn't like keys with '/'s in so, for now I'm just patching them out. This lets us keep a strong separation between this WIP and the rest of the code. * fix: use port 8000 to avoid conflicts * feat: crude ISR demo using challenge pages * feat: extend ISR demo to use params * feat: return props for specific superblocks * chore: re-organise folders * refactor: put data fetching in a single module * refactor: challenge page slightly * feat: add link to test ISR You can see that, if you run next dev, the linked page gets regenerated whenever you navigate to it. However, if you run next build that is no longer the case and the page has to be reloaded for the user to see the latest version. The implication is that we'll need another method (Web worker, probably) to detect if the page needs to be updated. * feat: render static paths for rwd * feat: add monaco Editor * feat: send less data via props Rather than sending superblocks, this now sends blocks. Next step, just the challenge! * fix: only send individual challenge's data * feat: send /learn/stuff/<id> to the challenge page * fix: redirect to path with trailing id * fix: handle all possible path prefixes * feat: add superblocks with trailing ids * chore: rename block -> blockOrId * chore: remove logs * fix: return notFound if page id is missing * chore: add a note about increasing TS strictness * feat: serverside redirects This should be a touch more performant, but mostly it separates the concerns. Since the server already has the responsibility of choosing what pages to render, redirects fit naturally with its concerns. * refactor: clean up param validation * feat: create list of blocks in superblock * feat: add challenge links to map * feat: link to full path, not just id * refactor: ensure props match getStaticProps By specifying the props for GetStaticProps we ensure that it returns the expected data and use InferGetStaticPropsType to get the type out again for use in the component * feat: improve and document dev experience * refactor: separate routing from rendering * refactor: extract routing logic into functions * refactor: naming consistency * refactor: move data wrangling into get-curriculum * refactor: align blockOrId and id * chore: remove the server from workspaces * chore: remove the lock * docs: paths Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * chore: install before linting * fix: create env.json before installing new client * chore: ignore generated json file Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2022-05-09 16:30:15 +00:00
{
"files": ["web/**/*.tsx"],
"extends": ["plugin:react/jsx-runtime"]
},
{
"files": ["**/api-server/**/*", "**/404.*"],
"rules": {
"filenames-simple/naming-convention": "off"
}
},
{
"files": ["**/api/src/**/*.ts"],
"plugins": ["jsdoc"],
"extends": ["plugin:jsdoc/recommended-typescript-error"],
"rules": {
"jsdoc/require-jsdoc": [
"error",
{
"require": {
"ArrowFunctionExpression": true,
"ClassDeclaration": true,
"ClassExpression": true,
"FunctionDeclaration": true,
"FunctionExpression": true,
"MethodDefinition": true
},
"publicOnly": true
}
],
"jsdoc/require-description-complete-sentence": "warn",
"jsdoc/tag-lines": "off"
}
}
]
}