-
Notifications
You must be signed in to change notification settings - Fork 225
/
.eslintrc.js
105 lines (104 loc) · 2.59 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const { eslintDirAlias } = require('./dirAlias');
module.exports = {
extends: [
'airbnb',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
'plugin:cypress/recommended',
],
env: {
es6: true,
browser: true,
jest: true,
node: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
requireConfigFile: false,
},
ignorePatterns: ['**/tz/**', 'index.stories.jsx', 'index.amp.stories.jsx'],
plugins: [
'prettier',
'json',
'jsx-a11y',
'react-hooks',
'cypress',
'import',
'no-only-tests',
],
rules: {
'react/prop-types': 'off',
'react/forbid-foreign-prop-types': 'error',
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'react/function-component-definition': 'off',
'react/no-unknown-property': [
'error',
{
ignore: [
'amp-boilerplate',
'amp-custom',
'amp-access',
'amp-access-hide',
'amp-install-serviceworker',
'css',
'custom-element',
'custom-template',
'fallback',
'fetchpriority',
'imagesizes',
'imagesrcset',
],
},
],
'linebreak-style': process.platform === 'win32' ? 'off' : ['error', 'unix'],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/no-extraneous-dependencies': [
'off',
{
devDependencies: [
'/.storybook/**',
'**/stories.jsx',
'/src/testHelpers/**',
],
},
],
'import/extensions': [1, { json: 'ignorePackages' }],
'jsx-a11y/no-redundant-roles': 'off',
'no-only-tests/no-only-tests': 'error',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
alias: eslintDirAlias,
},
},
overrides: [
{
files: ['**/*.{ts,tsx}'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'react/jsx-filename-extension': [
2,
{
extensions: ['.jsx', '.tsx'],
},
],
// adds support for type, interface and enum declarations https://typescript-eslint.io/rules/no-use-before-define/#how-to-use
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'react/require-default-props': 'off',
'react/no-unused-prop-types': 'off',
},
},
],
};