Created
October 11, 2022 11:40
-
-
Save justb3a/6e16ac66e33d0206110d4f8e2c6508d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
root: false, | |
parser: "@typescript-eslint/parser", // Specifies the ESLint parser | |
parserOptions: { | |
tsconfigRootDir: __dirname, | |
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features | |
sourceType: "module", // Allows for the use of imports | |
project: "./tsconfig.json", | |
ecmaFeatures: { | |
impliedStrict: true, | |
jsx: true, // Allows for the parsing of JSX | |
}, | |
}, | |
plugins: [ | |
"react-hooks", | |
"import", // https://github.com/import-js/eslint-plugin-import | |
], | |
ignorePatterns: ["*.js"], | |
extends: [ | |
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react | |
"plugin:jsx-a11y/recommended", | |
"plugin:import/recommended", | |
"plugin:import/typescript", | |
], | |
settings: { | |
react: { | |
version: "detect", // Tells eslint-plugin-react to automatically detect the version of React to use | |
}, | |
"import/resolver": { | |
typescript: { | |
project: ["./tsconfig.json"], | |
paths: ["./"], | |
extensions: [".ts", ".tsx", ".js", ".jsx"], | |
moduleDirectory: ["node_modules", "../node_modules", "./"], | |
}, | |
node: { | |
extensions: [".ts", ".tsx", ".js", ".jsx", ".d.ts", ".mjs"], | |
}, | |
}, | |
}, | |
overrides: [ | |
{ | |
files: ["*.graphql", "*.gql"], | |
parser: "@graphql-eslint/eslint-plugin", | |
plugins: ["@graphql-eslint"], | |
rules: { | |
"@graphql-eslint/known-type-names": "error", | |
}, | |
}, | |
], | |
rules: { | |
"react/prop-types": "off", | |
"react/display-name": "off", | |
"react/jsx-no-useless-fragment": "error", | |
"react/no-access-state-in-setstate": "error", | |
"react/jsx-uses-react": "off", | |
"react/react-in-jsx-scope": "off", | |
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks | |
/** Checks effect dependencies. It is a code smell, hence a warning is necessary: https://github.com/facebook/create-react-app/issues/6880#issuecomment-485912528 */ | |
"react-hooks/exhaustive-deps": "off", | |
"@typescript-eslint/no-misused-promises": [ | |
"error", | |
{ | |
checksVoidReturn: { | |
attributes: false, | |
properties: false, | |
}, | |
}, | |
], | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
root: true, | |
parser: "@typescript-eslint/parser", // Specifies the ESLint parser | |
parserOptions: { | |
tsconfigRootDir: __dirname, | |
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features | |
sourceType: "module", // Allows for the use of imports | |
project: "./tsconfig.json", | |
ecmaFeatures: { | |
impliedStrict: true, | |
}, | |
}, | |
plugins: ["@typescript-eslint"], | |
ignorePatterns: ["*.js", "**/generated/**/*.ts"], | |
extends: [ | |
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from @typescript-eslint/eslint-plugin | |
], | |
rules: { | |
"no-multiple-empty-lines": "error", | |
curly: ["error", "all"], | |
eqeqeq: ["error", "always", { null: "ignore" }], // Check type-unsafe equality operators | |
"no-console": ["error", { allow: ["warn", "error"] }], | |
"no-var": "error", | |
"object-shorthand": ["error", "always", { avoidQuotes: true }], | |
"spaced-comment": "error", | |
"sort-imports": ["error", { ignoreDeclarationSort: true }], | |
"no-return-assign": "error", | |
"no-useless-return": "error", | |
"default-case-last": "error", | |
"no-useless-call": "error", | |
"no-useless-concat": "error", | |
"no-lonely-if": "error", | |
"no-unsafe-negation": "error", | |
"no-extra-boolean-cast": "error", | |
"no-async-promise-executor": "error", | |
"no-await-in-loop": "error", | |
"no-promise-executor-return": "error", | |
"require-atomic-updates": "error", | |
"max-nested-callbacks": ["error", 3], | |
"no-return-await": "error", | |
"prefer-promise-reject-errors": "error", | |
"@typescript-eslint/await-thenable": "error", | |
"@typescript-eslint/no-misused-promises": "error", | |
"@typescript-eslint/explicit-module-boundary-types": "off", | |
"@typescript-eslint/explicit-member-accessibility": "off", | |
"@typescript-eslint/promise-function-async": "error", | |
"@typescript-eslint/dot-notation": "error", | |
"@typescript-eslint/return-await": "error", | |
"@typescript-eslint/no-shadow": "error", | |
"@typescript-eslint/no-throw-literal": "error", | |
"@typescript-eslint/prefer-optional-chain": "error", | |
"@typescript-eslint/no-namespace": "error", | |
"@typescript-eslint/no-unnecessary-condition": "error", | |
"@typescript-eslint/no-unnecessary-type-constraint": "error", | |
"@typescript-eslint/no-floating-promises": "error", | |
"@typescript-eslint/prefer-as-const": "error", | |
"@typescript-eslint/prefer-includes": "error", | |
"@typescript-eslint/ban-ts-comment": "off", | |
"@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: true }], | |
"@typescript-eslint/switch-exhaustiveness-check": "error", | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment