Last active
November 15, 2023 18:55
-
-
Save iszn11/9c3e49b1bf809f4a6ebaf565001f9a5b to your computer and use it in GitHub Desktop.
This file contains 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
/* eslint-env node */ | |
module.exports = { | |
extends: [ | |
"eslint:recommended", | |
"plugin:@typescript-eslint/strict-type-checked", | |
"plugin:@typescript-eslint/stylistic-type-checked", | |
"plugin:react-hooks/recommended", | |
], | |
rules: { | |
"@typescript-eslint/member-delimiter-style": ["error", { | |
multiline: { delimiter: "comma", requireLast: true }, | |
singleline: { delimiter: "comma", requireLast: false }, | |
overrides: { | |
interface: { | |
multiline: { delimiter: "semi" }, | |
singleline: { delimiter: "semi" }, | |
}, | |
}, | |
}], | |
"@typescript-eslint/method-signature-style": "error", | |
"@typescript-eslint/no-useless-empty-export": "error", | |
"@typescript-eslint/no-misused-promises": ["error", { | |
checksConditionals: true, | |
checksSpreads: true, | |
checksVoidReturn: false, | |
}], | |
"@typescript-eslint/switch-exhaustiveness-check": "error", | |
// react | |
"react/button-has-type": "error", | |
"react/display-name": "error", | |
"react/hook-use-state": "error", | |
"react/iframe-missing-sandbox": "error", | |
"react/jsx-boolean-value": ["error", "never"], | |
"react/jsx-curly-brace-presence": ["error", "never"], | |
"react/jsx-fragments": ["error", "syntax"], | |
"react/jsx-key": ["error", { checkFragmentShorthand: true }], | |
"react/jsx-no-bind": ["error", { ignoreDOMComponents: true }], | |
"react/jsx-no-constructed-context-values": "error", | |
"react/jsx-no-duplicate-props": "error", | |
"react/jsx-no-script-url": "error", | |
"react/jsx-no-target-blank": "error", | |
"react/jsx-no-useless-fragment": "error", | |
"react/no-access-state-in-setstate": "error", | |
"react/no-deprecated": "error", | |
"react/no-object-type-as-default-prop": "error", | |
"react/no-unstable-nested-components": "error", | |
"react/self-closing-comp": "error", | |
// disable options that have TypeScript counterparts | |
"class-methods-use-this": "off", | |
"comma-dangle": "off", | |
"comma-spacing": "off", | |
"func-call-spacing": "off", | |
"key-spacing": "off", | |
"keyword-spacing": "off", | |
"no-extra-semi": "off", | |
"object-curly-spacing": "off", | |
"quotes": "off", | |
"semi": "off", | |
"space-before-blocks": "off", | |
"space-before-function-paren": "off", | |
"space-infix-ops": "off", | |
// overrides | |
"no-constant-condition": ["error", { checkLoops: false }], | |
"@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }], | |
"@typescript-eslint/no-empty-function": "off", | |
"@typescript-eslint/no-non-null-assertion": "warn", | |
"@typescript-eslint/no-unsafe-argument": "warn", | |
"@typescript-eslint/no-unsafe-assignment": "warn", | |
"@typescript-eslint/no-unsafe-member-access": "warn", | |
"@typescript-eslint/no-unsafe-return": "warn", | |
// additional rules | |
"@typescript-eslint/class-methods-use-this": "error", | |
"@typescript-eslint/comma-dangle": ["error", "always-multiline"], | |
"@typescript-eslint/comma-spacing": "error", | |
"@typescript-eslint/func-call-spacing": "error", | |
"@typescript-eslint/key-spacing": "error", | |
"@typescript-eslint/keyword-spacing": "error", | |
"@typescript-eslint/no-extra-semi": "error", | |
"@typescript-eslint/object-curly-spacing": ["error", "always"], | |
"@typescript-eslint/quotes": ["error", "double"], | |
"@typescript-eslint/semi": ["error", "always"], | |
"@typescript-eslint/space-before-blocks": "error", | |
"@typescript-eslint/space-before-function-paren": ["error", { | |
anonymous: "always", | |
named: "never", | |
asyncArrow: "always", | |
}], | |
"@typescript-eslint/space-infix-ops": "error", | |
"@typescript-eslint/no-useless-empty-export": "error", | |
}, | |
settings: { | |
react: { | |
version: "18", | |
}, | |
linkComponents: [ | |
{ name: "Link", linkAttribute: "to" }, | |
], | |
}, | |
plugins: ["@typescript-eslint", "react", "react-hooks"], | |
parser: "@typescript-eslint/parser", | |
parserOptions: { | |
project: ["./packages/*/tsconfig.json"], | |
tsconfigRootDir: __dirname, | |
ecmaFeatures: { | |
jsx: true, | |
}, | |
}, | |
ignorePatterns: [ | |
".eslintrc.cjs", | |
"dist", | |
"tmp", | |
"scripts", | |
"bundle.js", | |
], | |
root: true, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment