-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.eslintrc.cjs
More file actions
155 lines (145 loc) · 3.94 KB
/
.eslintrc.cjs
File metadata and controls
155 lines (145 loc) · 3.94 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
module.exports = {
root: true,
env: {
node: true,
browser: true,
es6: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:css/recommended',
'plugin:prettier/recommended',
'stylelint',
],
plugins: [
'@typescript-eslint',
'react',
'import',
'css',
'unused-imports',
'prettier',
],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
babelOptions: {
caller: {
// Eslint supports top level await when a parser for it is included. We enable the parser by default for Babel.
supportsTopLevelAwait: true,
},
},
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
react: {
version: 'detect',
},
'import/resolver': {
alias: {
map: [['@', `${__dirname}/src`]],
extensions: ['.js', '.jsx', '.ts', '.d.ts', '.tsx', '.css'],
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
},
},
},
overrides: [
{
files: ['test/**/*.js', 'test/**/*.ts', '**/*.test.ts'],
extends: ['plugin:jest/recommended'],
rules: {
'jest/expect-expect': 'off',
'jest/no-disabled-tests': 'off',
'jest/no-conditional-expect': 'off',
'jest/valid-title': 'off',
'jest/no-interpolation-in-snapshots': 'off',
'jest/no-export': 'off',
},
},
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
env: { jest: true },
},
{
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
ecmaVersion: 'latest', // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
warnOnUnsupportedTypeScriptVersion: false,
},
},
],
ignorePatterns: [
'/*',
'!/src',
'!/test',
'!/node_modules',
'!/dist',
'!/coverage',
'!/public',
'!/app',
],
rules: {
'n/no-missing-import': 'off', // to disable path alias errors
'node/no-missing-import': 'off', // to disable path alias errors
'node/no-unpublished-import': 'off', // to disable no unpublished errors
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'prettier/prettier': 'error',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
'import/no-unresolved': 'error',
'import/extensions': [
'error',
'always',
{ ts: 'never', tsx: 'never', js: 'ignorePackages' },
],
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': 'warn',
'import/no-mutable-exports': 'error',
'import/no-self-import': 'error',
'import/no-useless-path-segments': 'error',
'sort-imports': 'off',
// Note: you must disable the base rule as it can report incorrect errors
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
// Note: you must disable the base rule as it can report incorrect errors
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'error',
'no-dupe-class-members': 'off',
'@typescript-eslint/no-dupe-class-members': 'error',
},
};