@lofty87/eslint-config
Version:
Lofty87 Project Code Convention (ESLint)
101 lines (100 loc) • 4.09 kB
JavaScript
module.exports = {
parserOptions: {
ecmaFeatures: { jsx: true },
},
settings: {
react: { version: 'detect' },
},
plugins: [
'react',
'react-hooks',
],
rules: {
'react/button-has-type': 'error',
'react/default-props-match-prop-types': 'error',
'react/destructuring-assignment': 'error',
'react/function-component-definition': [ 'error', {
namedComponents: 'function-declaration',
unnamedComponents: 'arrow-function',
} ],
'react/jsx-boolean-value': [ 'error', 'always' ],
'react/jsx-child-element-spacing': 'error',
'react/jsx-closing-bracket-location': [ 'error', 'line-aligned' ],
'react/jsx-closing-tag-location': 'error',
'react/jsx-curly-brace-presence': [ 'error', { props: 'never', children: 'never' } ],
'react/jsx-curly-newline': [ 'error', { singleline: 'consistent', multiline: 'consistent' } ],
'react/jsx-curly-spacing': [ 'error', { when: 'never', children: true } ],
'react/jsx-equals-spacing': [ 'error', 'never' ],
'react/jsx-filename-extension': [ 'error', { allow: 'always', extensions: [ '.jsx', '.tsx' ] } ],
'react/jsx-first-prop-new-line': [ 'error', 'multiline' ],
'react/jsx-fragments': 'error',
'react/jsx-handler-names': 'off',
'react/jsx-indent': [ 'error', 2, { checkAttributes: false, indentLogicalExpressions: false } ],
'react/jsx-indent-props': [ 'error', 2 ],
'react/jsx-key': 'error',
'react/jsx-max-props-per-line': [ 'error', { maximum: 1, when: 'always' } ],
'react/jsx-newline': 'off',
'react/jsx-no-duplicate-props': 'error',
'react/jsx-no-target-blank': [ 'error', { enforceDynamicLinks: 'always' } ],
'react/jsx-no-useless-fragment': 'off',
'react/jsx-one-expression-per-line': [ 'error', { allow: 'literal' } ],
'react/jsx-pascal-case': 'off',
'react/jsx-props-no-multi-spaces': 'error',
'react/jsx-props-no-spreading': 'off',
'react/jsx-sort-props': [ 'error', {
callbacksLast: true,
ignoreCase: false,
multiline: 'ignore',
noSortAlphabetically: true,
shorthandLast: true,
reservedFirst: [ 'key', 'ref' ],
} ],
'react/jsx-tag-spacing': [ 'error', {
closingSlash: 'never',
beforeSelfClosing: 'always',
afterOpening: 'never',
beforeClosing: 'never',
} ],
'react/jsx-uses-react': 'off',
'react/jsx-uses-vars': 'off',
'react/jsx-wrap-multilines': [ 'error', {
declaration: 'parens-new-line',
assignment: 'parens-new-line',
return: 'parens-new-line',
arrow: 'parens-new-line',
condition: 'parens-new-line',
logical: 'parens-new-line',
prop: 'parens-new-line',
} ],
'react/no-access-state-in-setstate': 'error',
'react/no-array-index-key': 'off',
'react/no-children-prop': 'error',
'react/no-danger-with-children': 'off',
'react/no-danger': 'off',
'react/no-deprecated': 'error',
'react/no-did-mount-set-state': 'off',
'react/no-did-update-set-state': 'off',
'react/no-direct-mutation-state': 'error',
'react/no-find-dom-node': 'error',
'react/no-multi-comp': 'off',
'react/no-redundant-should-component-update': 'error',
'react/no-string-refs': 'error',
'react/no-this-in-sfc': 'error',
'react/no-typos': 'error',
'react/no-unescaped-entities': 'off',
'react/no-unknown-property': 'error',
'react/no-will-update-set-state': 'error',
'react/prefer-es6-class': [ 'error', 'always' ],
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/require-render-return': 'error',
'react/self-closing-comp': [ 'error', { component: true, html: false } ],
'react/sort-default-props': 'off',
'react/sort-prop-types': 'off',
'react/state-in-constructor': [ 'error', 'never' ],
'react/style-prop-object': 'off',
'react/void-dom-elements-no-children': 'error',
'react-hooks/rules-of-hooks': 'off',
'react-hooks/exhaustive-deps': 'off',
},
};