Linted: .eslintrc file
This commit is contained in:
76
.eslintrc.js
76
.eslintrc.js
@@ -3,60 +3,60 @@ module.exports = {
|
|||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
commonjs: true,
|
commonjs: true,
|
||||||
es6: true,
|
es6: true
|
||||||
},
|
},
|
||||||
extends: ["eslint:recommended", "plugin:react/recommended"],
|
extends: ['eslint:recommended', 'plugin:react/recommended'],
|
||||||
parser: "babel-eslint",
|
parser: 'babel-eslint',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
jsx: true,
|
jsx: true,
|
||||||
modules: true,
|
modules: true,
|
||||||
experimentalObjectRestSpread: true,
|
experimentalObjectRestSpread: true
|
||||||
},
|
},
|
||||||
ecmaVersion: 2020,
|
ecmaVersion: 2020,
|
||||||
sourceType: "module",
|
sourceType: 'module'
|
||||||
},
|
},
|
||||||
plugins: ["react"],
|
plugins: ['react'],
|
||||||
rules: {
|
rules: {
|
||||||
// general
|
// general
|
||||||
indent: ["error", 2, { SwitchCase: 1, ignoredNodes: ["TemplateLiteral"] }],
|
indent: ['error', 2, { SwitchCase: 1, ignoredNodes: ['TemplateLiteral'] }],
|
||||||
"linebreak-style": ["error", "unix"],
|
'linebreak-style': ['error', 'unix'],
|
||||||
quotes: ["error", "single"],
|
quotes: ['error', 'single'],
|
||||||
semi: ["error", "always"],
|
semi: ['error', 'always'],
|
||||||
"comma-dangle": [
|
'comma-dangle': [
|
||||||
"error",
|
'error',
|
||||||
{
|
{
|
||||||
arrays: "never",
|
arrays: 'never',
|
||||||
objects: "never",
|
objects: 'never',
|
||||||
imports: "never",
|
imports: 'never',
|
||||||
exports: "never",
|
exports: 'never',
|
||||||
functions: "ignore",
|
functions: 'ignore'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"object-curly-spacing": ["error", "always"],
|
'object-curly-spacing': ['error', 'always'],
|
||||||
"eol-last": ["error", "always"],
|
'eol-last': ['error', 'always'],
|
||||||
"no-console": process.env.NODE_ENV === "production" ? "error" : "warn",
|
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
|
||||||
complexity: ["error", { max: 20 }],
|
complexity: ['error', { max: 20 }],
|
||||||
eqeqeq: ["error", "always"],
|
eqeqeq: ['error', 'always'],
|
||||||
// react
|
// react
|
||||||
"react/no-unescaped-entities": ["error", { forbid: [">", '"', "}"] }],
|
'react/no-unescaped-entities': ['error', { forbid: ['>', '"', '}'] }],
|
||||||
"react/prop-types": [2, { ignore: ["action", "dispatch", "nav", "navigation"] }],
|
'react/prop-types': [2, { ignore: ['action', 'dispatch', 'nav', 'navigation'] }],
|
||||||
"react/jsx-boolean-value": 2,
|
'react/jsx-boolean-value': 2,
|
||||||
"react/jsx-no-undef": 2,
|
'react/jsx-no-undef': 2,
|
||||||
"react/react-in-jsx-scope": "off",
|
'react/react-in-jsx-scope': 'off',
|
||||||
// allow jsx syntax in js files (for next.js project)
|
// allow jsx syntax in js files (for next.js project)
|
||||||
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }], //should add ".ts" if typescript project
|
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], //should add ".ts" if typescript project
|
||||||
"react/jsx-sort-props": [
|
'react/jsx-sort-props': [
|
||||||
2,
|
2,
|
||||||
{
|
{
|
||||||
callbacksLast: true,
|
callbacksLast: true,
|
||||||
shorthandFirst: true,
|
shorthandFirst: true,
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
noSortAlphabetically: true,
|
noSortAlphabetically: true
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"react/jsx-pascal-case": 2,
|
'react/jsx-pascal-case': 2,
|
||||||
"react/display-name": [0, { ignoreTranspilerName: false }],
|
'react/display-name': [0, { ignoreTranspilerName: false }]
|
||||||
},
|
},
|
||||||
// Map from global var to bool specifying if it can be redefined
|
// Map from global var to bool specifying if it can be redefined
|
||||||
globals: {
|
globals: {
|
||||||
@@ -91,11 +91,11 @@ module.exports = {
|
|||||||
setInterval: false,
|
setInterval: false,
|
||||||
setTimeout: false,
|
setTimeout: false,
|
||||||
window: false,
|
window: false,
|
||||||
XMLHttpRequest: false,
|
XMLHttpRequest: false
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
react: {
|
react: {
|
||||||
version: require("./package.json").dependencies.react,
|
version: require('./package.json').dependencies.react
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user