Adjust rules configuration

This commit is contained in:
ErickSkrauch 2019-05-27 01:15:07 +03:00
parent 31c531f151
commit 4c33698c28
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
3 changed files with 68 additions and 9 deletions

View File

@ -26,9 +26,10 @@
"lint": "eslint \"{src,tests}/**/*.{js,ts}\""
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/eslint-plugin": "^1.9.1-alpha.12",
"@typescript-eslint/parser": "^1.9.0",
"eslint-plugin-react": "^7.13.0"
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-react-hooks": "^1.6.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",

View File

@ -18,6 +18,7 @@ const config: Linter.Config = {
// @ts-ignore
plugins: [
'react-hooks',
'@typescript-eslint',
'@elyby',
],
@ -61,6 +62,10 @@ const config: Linter.Config = {
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'warn',
'no-extra-parens': ['warn', 'all', {
nestedBinaryExpressions: false,
ignoreJSX: 'multi-line',
}],
'no-fallthrough': 'error',
'no-floating-decimal': 'warn',
'no-implied-eval': 'error',
@ -124,6 +129,7 @@ const config: Linter.Config = {
'consistent-this': ['error', 'that'],
'camelcase': 'warn',
'eol-last': 'warn',
'func-call-spacing': 'error',
'id-length': ['error', {
min: 2,
exceptions: ['x', 'y', 'i', '$'],
@ -145,7 +151,6 @@ const config: Linter.Config = {
'no-negated-condition': 'warn',
'no-nested-ternary': 'error',
'no-new-object': 'error',
'no-spaced-func': 'error',
'no-trailing-spaces': 'warn',
'no-unneeded-ternary': 'warn',
'one-var': ['error', 'never'],
@ -193,12 +198,16 @@ const config: Linter.Config = {
'react/jsx-boolean-value': 'warn',
'react/jsx-closing-bracket-location': 'off',
'react/jsx-curly-spacing': 'warn',
'react/jsx-fragments': ['error', 'syntax'],
'react/jsx-handler-names': ['warn', {
eventHandlerPrefix: 'on',
eventHandlerPropPrefix: 'on',
}],
'react/jsx-indent-props': 'warn',
'react/jsx-key': 'warn',
'react/jsx-one-expression-per-line': ['warn', {
allow: 'literal',
}],
'react/jsx-max-props-per-line': 'off',
'react/jsx-no-bind': ['error', {
allowArrowFunctions: true,
@ -207,6 +216,7 @@ const config: Linter.Config = {
'react/jsx-no-literals': 'off',
'react/jsx-no-undef': 'warn',
'react/jsx-pascal-case': 'warn',
'react/jsx-props-no-multi-spaces': 'warn',
'react/jsx-uses-react': 'warn',
'react/jsx-uses-vars': 'warn',
'react/jsx-no-comment-textnodes': 'warn',
@ -217,19 +227,25 @@ const config: Linter.Config = {
'react/no-deprecated': 'warn',
'react/no-did-mount-set-state': 'warn',
'react/no-did-update-set-state': 'warn',
'react/no-direct-mutation-state': 'warn',
'react/require-render-return': 'warn',
'react/no-direct-mutation-state': 'error',
'react/no-is-mounted': 'warn',
'react/no-multi-comp': 'warn',
'react/no-string-refs': 'warn',
'react/no-this-in-sfc': 'error',
'react/no-unknown-property': 'warn',
'react/no-will-update-set-state': 'error',
'react/prefer-es6-class': 'warn',
'react/react-in-jsx-scope': 'off',
'react/react-in-jsxscope': 'off',
'react/require-render-return': 'warn',
'react/self-closing-comp': 'warn',
'react/sort-comp': ['warn', {
order: ['lifecycle', 'render', 'everything-else'],
}],
// React hooks
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// Ely.by's custom rules
'@elyby/jsx-closing-bracket-location': 'warn',
},
@ -239,36 +255,46 @@ const config: Linter.Config = {
files: ['*.ts', '*.tsx'],
rules: {
'camelcase': 'off',
'func-call-spacing': 'off',
'indent': 'off',
'no-array-constructor': 'off',
'no-extra-parens': 'off',
'no-unused-vars': 'off',
'valid-jsdoc': 'off',
'semi': 'off',
'react/prop-types': 'off',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', 'generic'],
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/camelcase': 'error',
'@typescript-eslint/class-name-casing': 'error',
'@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/func-call-spacing': 'error',
'@typescript-eslint/indent': 'error',
'@typescript-eslint/interface-name-prefix': 'error',
'@typescript-eslint/interface-name-prefix': ['error', 'never'],
'@typescript-eslint/member-delimiter-style': 'error',
'@typescript-eslint/no-angle-bracket-type-assertion': 'error',
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-extra-parens': ['warn', 'all', {
nestedBinaryExpressions: false,
ignoreJSX: 'multi-line',
}],
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-object-literal-type-assertion': 'error',
'@typescript-eslint/no-parameter-properties': 'error',
'@typescript-eslint/no-triple-slash-reference': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/no-useless-constructor': 'warn',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-interface': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/semi': 'error',
'@typescript-eslint/type-annotation-spacing': 'error',
},
},

View File

@ -920,6 +920,17 @@
requireindex "^1.2.0"
tsutils "^3.7.0"
"@typescript-eslint/eslint-plugin@^1.9.1-alpha.12":
version "1.9.1-alpha.12"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.9.1-alpha.12.tgz#21ae7ac5f7ebf2e22e60a5430d5c008688ac1b00"
integrity sha512-TiFMF/vaQL0L75csNmpY4UwE2AeyBDIIVhB5Dzz7TUYpfy5dHCbu8zwwNB8oN/Z7IHpyKHzbLCgZ4hQ1Cxe5jQ==
dependencies:
"@typescript-eslint/experimental-utils" "1.9.1-alpha.12+cca1714"
eslint-utils "^1.3.1"
functional-red-black-tree "^1.0.1"
regexpp "^2.0.1"
tsutils "^3.7.0"
"@typescript-eslint/experimental-utils@1.9.0":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.9.0.tgz#a92777d0c92d7bc8627abd7cdb06cdbcaf2b39e8"
@ -927,6 +938,14 @@
dependencies:
"@typescript-eslint/typescript-estree" "1.9.0"
"@typescript-eslint/experimental-utils@1.9.1-alpha.12+cca1714":
version "1.9.1-alpha.12"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.9.1-alpha.12.tgz#578d8a3a0e43f2657285699f74066bd9665fac2e"
integrity sha512-zOTD+VQV8JCSm8XDHkASdulglAtanlNyqDHx76n79Q4AFU+KRgKj6e4mUSoBU4/BhnLilC5oZ9f+nmJoXJhgbQ==
dependencies:
"@typescript-eslint/typescript-estree" "1.9.1-alpha.12+cca1714"
eslint-scope "^4.0.0"
"@typescript-eslint/parser@1.9.0", "@typescript-eslint/parser@^1.9.0":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.9.0.tgz#5796cbfcb9a3a5757aeb671c1ac88d7a94a95962"
@ -945,6 +964,14 @@
lodash.unescape "4.0.1"
semver "5.5.0"
"@typescript-eslint/typescript-estree@1.9.1-alpha.12+cca1714":
version "1.9.1-alpha.12"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.9.1-alpha.12.tgz#c801bd49066ec96cf85720be7d5c22dc444e27a3"
integrity sha512-Kpdlx0nIZ/s8O2NId9zRkY2V+Vie9/3AkXru35cBEk7G5EPhuzLFqiUy0wWZXNBjCVrHeMWivd8a5pomzBR7kg==
dependencies:
lodash.unescape "4.0.1"
semver "5.5.0"
abab@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f"
@ -1686,6 +1713,11 @@ escodegen@^1.9.1:
optionalDependencies:
source-map "~0.6.1"
eslint-plugin-react-hooks@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.0.tgz#348efcda8fb426399ac7b8609607c7b4025a6f5f"
integrity sha512-lHBVRIaz5ibnIgNG07JNiAuBUeKhEf8l4etNx5vfAEwqQ5tcuK3jV9yjmopPgQDagQb7HwIuQVsE3IVcGrRnag==
eslint-plugin-react@^7.13.0:
version "7.13.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.13.0.tgz#bc13fd7101de67996ea51b33873cd9dc2b7e5758"