-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
84 lines (80 loc) · 2.19 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
module.exports = {
env: {
es2021: true,
node: true,
'jest/globals': true, // - fix expect undefined no-undef
},
extends: [
'airbnb-base',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: [
'@typescript-eslint',
'jest', // fix - expect undefined no-undef
],
rules: {
// Some of us like underscores.
'no-underscore-dangle': [
'allow',
],
// In cases where we want to include dev dependencies in test code
'import/no-extraneous-dependencies': [
'off', { devDependencies: ['**/*.test.js', '**/*.spec.js'] },
],
// In cases where the number of lines becomes > max-len. We should be able
// to format the code as needed.
'arrow-body-style': 'off',
// For typescript, eslint errors when defining a function type. We need to
// disable no-unused-vars and then enable typescripts no-unused-vars.
// We can now define function types but also get warnings/errors on actual
// unused vars.
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'import/extensions': [
'error',
{
js: 'never',
jsx: 'never',
ts: 'never', // fix - Missing file extension "ts" for "../src"
tsx: 'never',
json: 'always',
},
],
'max-len': [
'warn', {
code: 80,
ignoreUrls: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
},
],
// https://stackoverflow.com/questions/69905008
'no-restricted-syntax': 'off',
// Enable files that have no default export.
'import/prefer-default-export': 'off',
// '{file}' is already declared in the upper scope...
// see https://stackoverflow.com/questions/63961803
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
// see https://github.com/mattphillips/jest-expect-message
'jest/valid-expect': [
'error',
{
maxArgs: 2,
},
],
},
settings: {
// fix - Unable to resolve path to module '../src'
'import/resolver': {
node: {
extensions: ['.ts'],
},
},
},
};