-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
104 lines (101 loc) · 2.31 KB
/
eslint.config.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
import { addExtensions, nodeConfig, setDirectoryConfigs, testingConfig } from 'eslint-config-brightspace';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import importPlugin from 'eslint-plugin-import';
import { includeIgnoreFile } from '@eslint/compat';
import jsonPlugin from 'eslint-plugin-json';
import mochaPlugin from 'eslint-plugin-mocha';
import playwrightPlugin from 'eslint-plugin-playwright';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const gitignorePath = resolve(__dirname, '.gitignore');
const fileExtensions = ['.js', '.cjs'];
const importConfigs = [
importPlugin.flatConfigs.recommended,
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
settings: {
'import/resolver': {
node: true
}
},
rules: {
'import/extensions': ['error', 'ignorePackages']
}
}
];
const commandDangleConfig = {
rules: {
'comma-dangle': 'error'
}
};
const globalConfigs = addExtensions(
[
...nodeConfig,
...importConfigs,
commandDangleConfig
],
fileExtensions
);
const playwrightConfigs = addExtensions(
[
...globalConfigs,
playwrightPlugin.configs['flat/recommended'],
{
rules: {
'playwright/expect-expect': 'off',
'playwright/no-skipped-test': 'off',
'playwright/no-conditional-in-test': 'off',
'playwright/valid-title': 'off'
}
}
],
fileExtensions
);
const mochaConfigs = addExtensions(
[
...globalConfigs,
mochaPlugin.configs.flat.recommended,
{
rules: {
'mocha/no-exclusive-tests': 'error',
'mocha/no-mocha-arrows': 'off'
}
}
],
fileExtensions
);
const webTestRunnerConfigs = addExtensions(
[
...testingConfig,
commandDangleConfig
],
fileExtensions
);
const jsonConfig = jsonPlugin.configs['recommended'];
export default [
includeIgnoreFile(gitignorePath),
...setDirectoryConfigs(
globalConfigs,
{
'test/unit': mochaConfigs,
'test/integration': mochaConfigs,
'test/integration/data': globalConfigs,
'test/integration/data/tests/mocha': [
...mochaConfigs,
{
rules: {
'mocha/no-mocha-arrows': 'off',
'mocha/no-skipped-tests': 'off'
}
}
],
'test/integration/data/tests/playwright': playwrightConfigs,
'test/integration/data/tests/web-test-runner': webTestRunnerConfigs
}
),
jsonConfig
];