-
Notifications
You must be signed in to change notification settings - Fork 31
/
.eslintrc.cjs
122 lines (120 loc) · 2.85 KB
/
.eslintrc.cjs
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
// https://eslint.org/docs/user-guide/configuring
const packageJson = require('./package.json');
const devDependencies = Object.keys(packageJson.devDependencies || {});
module.exports = {
extends: [
'eslint:recommended',
'plugin:node/recommended-script'
],
plugins: [
'node',
'@typescript-eslint',
'import',
],
rules: {
'semi': ['error', 'always'],
'node/no-unsupported-features/es-syntax': 0,
},
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
project: 'tsconfig.json'
},
settings: {
node: {
tryExtensions: ['.js', '.ts']
},
// https://github.com/import-js/eslint-plugin-import#typescript
'import/parsers': {
'@typescript-eslint/parser': ['.ts']
},
'import/resolver': {
'typescript': true,
'node': true
},
},
overrides: [
{
// ES6/browser processed by Babel
files: [
'lib/src/**/*',
'test/spec/**/*',
'test/e2e/harness/src/**/*',
'test/e2e/harness/e2e/**/*'
],
env: {
browser: true,
es6: true,
node: false
},
rules: {
'node/no-unsupported-features/node-builtins': 0,
'node/no-unpublished-import': ['error', {
'allowModules': devDependencies
}],
// To allow @okta/okta-auth-js/*
'node/no-missing-import': ['error', {
'allowModules': [
'@okta/okta-auth-js'
]
}],
}
},
// Angular 12-15 test apps
{
files: ['test/apps/**/*'],
extends: [
'plugin:import/recommended',
'plugin:@typescript-eslint/recommended'
],
rules: {
'node/no-extraneous-import': ['error', {
'allowModules': [
'@okta/okta-angular'
]
}],
'node/no-missing-import': ['error', {
'allowModules': [
'@okta/okta-angular'
]
}],
'import/no-unresolved': ['error', {
ignore: [
'environments/environment'
]
}]
}
},
// Selenium test
{
files: ['test/selenium-test/**/*', 'test/support/**/*'],
extends: [
'plugin:@typescript-eslint/recommended'
],
rules: {
'node/no-missing-import': ['error', {
'allowModules': [
'@okta/okta-angular',
'@okta/okta-signin-widget'
]
}],
'node/no-unpublished-import': ['error', {
'allowModules': devDependencies
}],
}
},
// NodeJS build tools
{
files: ['env.cjs', 'util/**/*'],
rules: {
'node/no-unpublished-import': ['error', {
'allowModules': devDependencies
}],
'node/no-unpublished-require': ['error', {
'allowModules': devDependencies
}],
}
}
]
};