-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy path.eslintrc.js
131 lines (131 loc) · 4.09 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module.exports = {
root: true,
parser: '@babel/eslint-parser',
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
},
extends: ['airbnb', 'prettier', 'prettier/react', 'plugin:react-hooks/recommended'],
plugins: ['babel', 'compat', 'promise', 'prettier', 'react'],
env: { browser: true },
globals: { __DEV__: true },
settings: {
polyfills: ['promises'],
'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.json'],
'import/resolver': {
webpack: {},
node: { extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'] },
},
react: { version: 'detect' },
},
rules: {
camelcase: ['error', { allow: ['^UNSAFE_'], properties: 'never' }],
curly: 2,
'import/extensions': [
'error',
{
'.js': 'always',
'.jsx': 'always',
'.ts': 'always',
'.tsx': 'always',
'.json': 'always',
},
],
'prefer-object-spread': 1,
'prefer-destructuring': ['error', { object: true, array: false }],
'prettier/prettier': 'error',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
extends: [
'airbnb',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
'prettier/react',
],
plugins: ['@typescript-eslint/eslint-plugin', 'prettier', 'react'],
rules: {
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-use-before-define': 1,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-explicit-any': ['warn', { fixToUnknown: false }],
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
'import/extensions': [
'error',
{
'.ts': 'always',
'.tsx': 'always',
'.json': 'always',
},
],
'no-use-before-define': 0,
'prettier/prettier': 'error',
'react/destructuring-assignment': 0,
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx'] }],
'react/jsx-fragments': 1,
'react/jsx-no-bind': 0,
'react/jsx-no-literals': 'off',
'react/jsx-props-no-spreading': 0,
'react/require-default-props': 0,
'react/sort-comp': 0,
'react/static-property-placement': 0,
},
settings: {
'import/resolver': {
webpack: {},
typescript: {},
},
react: { version: 'detect' },
},
},
// STORYBOOK
{
files: ['*.stories.jsx', '*.stories.tsx', 'commitlint.config.js'],
rules: {
// this is to keep eslint from complaining about storybook addons,
// since they are included as dev dependencies rather than direct dependencies.
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
},
},
// TYPE DECLARATIONS
{
files: ['*.d.ts'],
rules: {
'max-classes-per-file': 0,
},
},
// UNIT TESTS
{
files: ['*.test.ts', '*.test.tsx', '*.test.js', '*.test.jsx', 'fixtures.*'],
plugins: ['jest', 'jest-dom', 'no-only-tests', 'testing-library'],
env: { 'jest/globals': true },
extends: ['plugin:jest/recommended', 'plugin:testing-library/react'],
rules: {
// This is to keep eslint from complaining about @testing-library imports,
// since they are included as dev dependencies rather than direct dependencies.
'import/no-extraneous-dependencies': 0,
// Accessing container and nodes let us verify if vega renders svg correctly.
'testing-library/no-container': 0,
'testing-library/no-node-access': 0,
},
},
// CONFIG FILES
{
files: ['webpack*.js', '.*rc.js', '*.config.js'],
env: { node: true },
settings: {
'import/resolver': {
node: {},
},
},
},
],
};