Adjust rules configuration

This commit is contained in:
ErickSkrauch
2019-05-27 01:15:07 +03:00
parent 31c531f151
commit 4c33698c28
3 changed files with 68 additions and 9 deletions

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',
},
},