Add React-specific configuration separately

master
Sven Slootweg 5 years ago
parent 47e3252606
commit 59e4c33f71

@ -8,15 +8,8 @@ module.exports = {
"node": true
},
"parserOptions": {
"ecmaVersion": 2019,
"ecmaFeatures": {
"jsx": true
}
"ecmaVersion": 2019
},
"plugins": [
"react",
"react-hooks"
],
"rules": {
/* Things that should effectively be syntax errors. */
"indent": [ "error", "tab", {
@ -66,13 +59,6 @@ module.exports = {
"no-loop-func": [ "error" ],
"no-implicit-globals": [ "error" ],
"strict": [ "error", "global" ],
/* Make JSX not cause 'unused variable' errors. */
"react/react-in-jsx-scope": [ "error" ],
"react/jsx-uses-react": [ "error" ],
"react/jsx-uses-vars": [ "error" ],
/* Hooks-specific rules, as recommended by https://reactjs.org/docs/hooks-rules.html */
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
/* Development code that should be removed before deployment. */
"no-console": [ "warn" ],
"no-constant-condition": [ "warn" ],

90
react.js vendored

@ -0,0 +1,90 @@
"use strict";
/* FIXME: Remove duplication */
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2019,
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"react",
"react-hooks"
],
"rules": {
/* Things that should effectively be syntax errors. */
"indent": [ "error", "tab", {
SwitchCase: 1
}],
"linebreak-style": [ "error", "unix" ],
"semi": [ "error", "always" ],
/* Things that are always mistakes. */
"getter-return": [ "error" ],
"no-compare-neg-zero": [ "error" ],
"no-dupe-args": [ "error" ],
"no-dupe-keys": [ "error" ],
"no-duplicate-case": [ "error" ],
"no-empty": [ "error" ],
"no-empty-character-class": [ "error" ],
"no-ex-assign": [ "error" ],
"no-extra-semi": [ "error" ],
"no-func-assign": [ "error" ],
"no-invalid-regexp": [ "error" ],
"no-irregular-whitespace": [ "error" ],
"no-obj-calls": [ "error" ],
"no-sparse-arrays": [ "error" ],
"no-undef": [ "error" ],
"no-unreachable": [ "error" ],
"no-unsafe-finally": [ "error" ],
"use-isnan": [ "error" ],
"valid-typeof": [ "error" ],
"curly": [ "error" ],
"no-caller": [ "error" ],
"no-fallthrough": [ "error" ],
"no-extra-bind": [ "error" ],
"no-extra-label": [ "error" ],
"array-callback-return": [ "error" ],
"prefer-promise-reject-errors": [ "error" ],
"no-with": [ "error" ],
"no-useless-concat": [ "error" ],
"no-unused-labels": [ "error" ],
"no-unused-expressions": [ "error" ],
"no-unused-vars": [ "error" , {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
} ],
"no-return-assign": [ "error" ],
"no-self-assign": [ "error" ],
"no-new-wrappers": [ "error" ],
"no-redeclare": [ "error" ],
"no-loop-func": [ "error" ],
"no-implicit-globals": [ "error" ],
"strict": [ "error", "global" ],
/* Make JSX not cause 'unused variable' errors. */
"react/react-in-jsx-scope": [ "error" ],
"react/jsx-uses-react": [ "error" ],
"react/jsx-uses-vars": [ "error" ],
/* Hooks-specific rules, as recommended by https://reactjs.org/docs/hooks-rules.html */
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
/* Development code that should be removed before deployment. */
"no-console": [ "warn" ],
"no-constant-condition": [ "warn" ],
"no-debugger": [ "warn" ],
"no-alert": [ "warn" ],
"no-warning-comments": [ "warn", {
terms: ["fixme"]
}],
/* Common mistakes that can *occasionally* be intentional. */
"no-template-curly-in-string": [ "warn" ],
"no-unsafe-negation": [ "warn" ],
}
};
Loading…
Cancel
Save