This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
/
.eslintrc.js
125 lines (115 loc) · 3.4 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
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'plugin:mdx/recommended',
],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
typescript: {},
},
},
env: {
browser: true,
node: true,
es6: true,
},
plugins: ['@typescript-eslint', 'react', 'import', 'react-hooks', 'jsx-a11y', 'simple-import-sort'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
overrides: [
{
files: ['./gatsby-*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
],
rules: {
'simple-import-sort/imports': [
'error',
{
groups: [
// Npm packages. `react` related packages come first.
['^react', '^@?\\w'],
// Internal packages
[
'^(actions|actionTypes|components|context|epics|hooks|middleware|reducers|routers|sources|stories|stylesheets|types|utils)(/.*|$)',
],
// Side effect imports
['^\\u0000'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
],
},
],
'no-duplicate-imports': 'error',
// Forbid unnecessary backticks
// https://github.com/prettier/eslint-config-prettier/blob/master/README.md#forbid-unnecessary-backticks
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
// no longer needed
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unknown-property': ['error', { ignore: ['sx', 'css'] }],
// Disable prop-types as we use TypeScript for type checking
'react/prop-types': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/no-unresolved': 'error',
'import/default': 'error',
'import/export': 'error',
'import/no-self-import': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', ['internal', 'parent', 'sibling'], 'index'],
},
],
'import/no-webpack-loader-syntax': 'error',
'import/no-cycle': 'error',
'import/no-useless-path-segments': 'error',
'import/no-unused-modules': 'error',
'import/no-duplicates': 'error',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: 'jsx' }],
},
ignorePatterns: ['cypress/plugins', 'cypress/support', 'cypress/fixtures'],
globals: {
describe: true,
it: true,
expect: true,
jest: true,
beforeEach: true,
afterEach: true,
beforeAll: true,
afterAll: true,
test: true,
jsdom: true,
cy: true,
chai: true,
before: true,
after: true,
Cypress: true,
context: true,
assert: true,
},
}