|
1 | | -module.exports = { |
2 | | - env: { |
3 | | - browser: true, |
4 | | - node: true, |
5 | | - es2021: true, |
6 | | - jest: true |
7 | | - }, |
8 | | - extends: [ |
9 | | - 'eslint:recommended', |
10 | | - 'plugin:@typescript-eslint/recommended', |
11 | | - 'plugin:prettier/recommended' |
12 | | - ], |
13 | | - parser: '@typescript-eslint/parser', |
14 | | - parserOptions: { |
15 | | - ecmaFeatures: { |
16 | | - jsx: true |
17 | | - }, |
18 | | - ecmaVersion: 'latest', |
19 | | - sourceType: 'module' |
20 | | - }, |
21 | | - plugins: ['react-hooks', 'react', '@typescript-eslint', 'prettier'], |
22 | | - ignorePatterns: ['**/plays/index.js'], |
23 | | - |
24 | | - rules: { |
25 | | - // Note: you must disable the base rule as it can report incorrect errors |
26 | | - "no-unused-vars": "off", |
27 | | - "@typescript-eslint/no-unused-vars": "warn", |
28 | | - |
29 | | - 'import/extensions': 0, |
30 | | - |
31 | | - 'import/no-named-as-default-member': 0, |
32 | | - 'react/prop-types': 0, |
33 | | - 'react/display-name': 0, |
34 | | - 'react/react-in-jsx-scope': 0, |
35 | | - |
36 | | - // type - any would be very handy in few cases. |
37 | | - // The validation shouldn't be at linters end rather at code review end |
38 | | - '@typescript-eslint/no-explicit-any': 0, |
39 | | - |
40 | | - // Empty functions are handy for creating protocol not execution |
41 | | - '@typescript-eslint/no-empty-function': 0, |
42 | | - |
43 | | - // Require a whitespace at the beginning of a comment |
44 | | - 'spaced-comment': ['error', 'always'], |
45 | | - |
46 | | - // Maximum line length for comments |
47 | | - // Trailing comments allowed beyond maximum line length |
48 | | - 'max-len': ['error', { code: 400, comments: 200, ignoreTrailingComments: true }], |
49 | | - |
50 | | - // Require PascalCase for user-defined JSX components |
51 | | - 'react/jsx-pascal-case': ['error'], |
52 | | - |
53 | | - // Console logs cannot be committed. |
54 | | - 'no-console': ['error', { allow: ['warn', 'error'] }], |
55 | | - |
56 | | - // Require props to be sorted |
57 | | - 'react/jsx-sort-props': ['error', { callbacksLast: true, shorthandFirst: true }], |
58 | | - |
59 | | - // Omit boolean prop value when set to true |
60 | | - 'react/jsx-boolean-value': ['error', 'never'], |
61 | | - |
62 | | - // Require self closing tags in JSX/HTML |
63 | | - 'react/self-closing-comp': ['error', { component: true, html: true }], |
64 | | - |
65 | | - // Disallow unnecessary curly braces in JSX |
66 | | - 'react/jsx-curly-brace-presence': ['error', 'never'], |
67 | | - |
68 | | - // Require blank line before certain statements |
69 | | - 'padding-line-between-statements': [ |
70 | | - 'error', |
71 | | - { blankLine: 'always', prev: '*', next: 'function' }, |
72 | | - { blankLine: 'always', prev: '*', next: 'class' }, |
73 | | - { blankLine: 'always', prev: '*', next: 'export' }, |
74 | | - // Ignore consecutive export statements |
75 | | - { blankLine: 'any', prev: 'export', next: 'export' }, |
76 | | - { blankLine: 'always', prev: '*', next: 'return' }, |
77 | | - { blankLine: 'always', prev: '*', next: 'break' }, |
78 | | - { blankLine: 'always', prev: '*', next: 'continue' }, |
79 | | - { blankLine: 'always', prev: '*', next: 'throw' } |
80 | | - ], |
81 | | - 'prettier/prettier': ['error', { endOfLine: 'auto' }] |
82 | | - }, |
83 | | - settings: { |
84 | | - react: { |
85 | | - version: 'detect' |
86 | | - } |
87 | | - } |
88 | | -}; |
| 1 | +module.exports = { |
| 2 | + env: { |
| 3 | + browser: true, |
| 4 | + node: true, |
| 5 | + es2021: true, |
| 6 | + jest: true |
| 7 | + }, |
| 8 | + extends: [ |
| 9 | + 'eslint:recommended', |
| 10 | + 'plugin:@typescript-eslint/recommended', |
| 11 | + 'plugin:prettier/recommended' |
| 12 | + ], |
| 13 | + parser: '@typescript-eslint/parser', |
| 14 | + parserOptions: { |
| 15 | + ecmaFeatures: { |
| 16 | + jsx: true |
| 17 | + }, |
| 18 | + ecmaVersion: 'latest', |
| 19 | + sourceType: 'module' |
| 20 | + }, |
| 21 | + plugins: ['react-hooks', 'react', '@typescript-eslint', 'prettier'], |
| 22 | + ignorePatterns: ['**/plays/index.js'], |
| 23 | + |
| 24 | + rules: { |
| 25 | + // Note: you must disable the base rule as it can report incorrect errors |
| 26 | + 'no-unused-vars': 'off', |
| 27 | + '@typescript-eslint/no-unused-vars': 'warn', |
| 28 | + |
| 29 | + 'import/extensions': 0, |
| 30 | + |
| 31 | + 'import/no-named-as-default-member': 0, |
| 32 | + 'react/prop-types': 0, |
| 33 | + 'react/display-name': 0, |
| 34 | + 'react/react-in-jsx-scope': 0, |
| 35 | + |
| 36 | + // type - any would be very handy in few cases. |
| 37 | + // The validation shouldn't be at linters end rather at code review end |
| 38 | + '@typescript-eslint/no-explicit-any': 0, |
| 39 | + |
| 40 | + // Empty functions are handy for creating protocol not execution |
| 41 | + '@typescript-eslint/no-empty-function': 0, |
| 42 | + |
| 43 | + // Require a whitespace at the beginning of a comment |
| 44 | + 'spaced-comment': ['error', 'always'], |
| 45 | + |
| 46 | + // Maximum line length for comments |
| 47 | + // Trailing comments allowed beyond maximum line length |
| 48 | + 'max-len': ['error', { code: 400, comments: 200, ignoreTrailingComments: true }], |
| 49 | + |
| 50 | + // Require PascalCase for user-defined JSX components |
| 51 | + 'react/jsx-pascal-case': ['error'], |
| 52 | + |
| 53 | + // Console logs cannot be committed. |
| 54 | + 'no-console': ['error', { allow: ['warn', 'error'] }], |
| 55 | + |
| 56 | + // Require props to be sorted |
| 57 | + 'react/jsx-sort-props': ['error', { callbacksLast: true, shorthandFirst: true }], |
| 58 | + |
| 59 | + // Omit boolean prop value when set to true |
| 60 | + 'react/jsx-boolean-value': ['error', 'never'], |
| 61 | + |
| 62 | + // Require self closing tags in JSX/HTML |
| 63 | + 'react/self-closing-comp': ['error', { component: true, html: true }], |
| 64 | + |
| 65 | + // Disallow unnecessary curly braces in JSX |
| 66 | + 'react/jsx-curly-brace-presence': ['error', 'never'], |
| 67 | + |
| 68 | + // Require blank line before certain statements |
| 69 | + 'padding-line-between-statements': [ |
| 70 | + 'error', |
| 71 | + { blankLine: 'always', prev: '*', next: 'function' }, |
| 72 | + { blankLine: 'always', prev: '*', next: 'class' }, |
| 73 | + { blankLine: 'always', prev: '*', next: 'export' }, |
| 74 | + // Ignore consecutive export statements |
| 75 | + { blankLine: 'any', prev: 'export', next: 'export' }, |
| 76 | + { blankLine: 'always', prev: '*', next: 'return' }, |
| 77 | + { blankLine: 'always', prev: '*', next: 'break' }, |
| 78 | + { blankLine: 'always', prev: '*', next: 'continue' }, |
| 79 | + { blankLine: 'always', prev: '*', next: 'throw' } |
| 80 | + ], |
| 81 | + 'prettier/prettier': ['error', { endOfLine: 'auto' }] |
| 82 | + }, |
| 83 | + settings: { |
| 84 | + react: { |
| 85 | + version: 'detect' |
| 86 | + } |
| 87 | + } |
| 88 | +}; |
0 commit comments