forked from newrelic/newrelic-browser-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
137 lines (135 loc) · 3.37 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
132
133
134
135
136
137
module.exports = {
ignorePatterns: [
'dist/**/*',
'temp/**/*',
'build/**/*',
'coverage/**/*',
'node_modules/**/*',
'tests/assets/frameworks/**/*',
'tests/assets/js/internal/**/*',
'tests/assets/js/vendor/**/*',
'tests/assets/scripts/**/*',
'tests/assets/test-builds/**/*',
'tests/assets/modular/js-errors/js/vendor/**/*',
'tests/dts/**/*',
// Ignore old JIL test code since they are being migrated to WDIO
'tests/browser/**/*',
'tests/functional/**/*'
],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false
},
env: {
es2022: true
},
globals: {
WorkerNavigator: true,
WorkerGlobalScope: true,
NREUM: true,
newrelic: true
},
plugins: ['sonarjs'],
extends: ['standard', 'plugin:sonarjs/recommended'],
overrides: [
{
files: ['**/*.mjs'],
parserOptions: {
sourceType: 'module'
}
},
{
files: ['src/**/*.js'],
excludedFiles: ['__mocks__/**/*'],
env: {
browser: true
},
parserOptions: {
sourceType: 'module'
},
rules: {
'no-console': ['error'],
'n/no-callback-literal': 'off' // This is not NodeJS code and should not be forced to adhere to NodeJS callback parameter pattern
}
},
{
files: ['src/**/__mocks__/**/*', 'tests/unit/**/*', 'tests/components/**/*'],
env: {
browser: true,
node: true,
jest: true
},
parserOptions: {
sourceType: 'module'
},
rules: {
'sonarjs/no-duplicate-string': 'off', // It is not worth deduplicating strings in test code
'sonarjs/no-identical-functions': 'off',
'n/no-callback-literal': 'off' // This is not NodeJS code and should not be forced to adhere to NodeJS callback parameter pattern
}
},
{
files: ['tests/specs/**/*', 'tests/webview-specs/**/*'],
globals: {
browser: true,
driver: true,
expect: true,
$: true,
browserMatch: true
},
env: {
browser: true,
node: true,
mocha: true
},
parserOptions: {
sourceType: 'module'
},
rules: {
'sonarjs/no-duplicate-string': 'off' // It is not worth deduplicating strings in test code
}
},
{
files: ['tools/**/*'],
globals: {
browser: true
},
env: {
browser: true,
node: true,
jest: true
},
rules: {
'sonarjs/no-duplicate-string': 'off' // It is not worth deduplicating strings in tooling code
}
},
{
files: ['webpack.*.js', 'babel.config.js', 'babel-env-vars.js', '.eslintrc.js', 'jest.preset.js', 'newrelic.js'],
env: {
browser: true,
node: true
},
rules: {
'sonarjs/no-duplicate-string': 'off' // It is not worth deduplicating strings in tooling code
}
},
{
files: ['tests/functional/**/*.test.js', 'tests/assets/**/*.js'],
env: {
browser: true,
node: true
},
rules: {
'no-throw-literal': 'off' // We need to be able to test throwing literals
}
}
],
rules: {
// Disable lint rules that need code changes to re-enabled
'no-var': 'off',
'no-new': 'off',
'prefer-const': 'off',
'sonarjs/cognitive-complexity': 'off',
camelcase: 'off'
}
}