-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy patheslint.config.mjs
92 lines (91 loc) · 2.75 KB
/
eslint.config.mjs
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
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginCodecept from 'eslint-plugin-codeceptjs';
import customEslintPlugin from 'custom-eslint-plugin';
import eslintConfigPrettier from 'eslint-config-prettier';
export default [
{
ignores: [
'steps.d.ts',
'node_modules/*',
'govuk/*',
'public/*',
'app/assets/javascripts/*.js',
'allure-report/*',
'allure-results/*',
'playwright-allure-bootstrap-report/*',
'playwright-allure-bootstrap-results/*',
'playwright-allure-functional-report/*',
'playwright-allure-functional-results/*',
'plugins/*',
'coverage',
'**/*.min.js',
'**/*.{mjs,cjs}',
],
},
...[...tseslint.configs.recommended].map((config) => ({
...config,
files: ['playwright-e2e/**/*.ts'],
})),
pluginJs.configs.recommended,
{
files: ['e2e/**/*.{js,jsx}'],
languageOptions: {
sourceType: 'commonjs',
ecmaVersion: 11,
globals: {
...globals.browser,
...globals.node,
...globals.es2020,
...globals.mocha,
...globals.jest,
...eslintPluginCodecept.environments.codeceptjs.globals,
},
},
rules: {
'no-unused-vars': 'off',
quotes: ['error', 'single'],
semi: ['error', 'always'],
'no-constant-binary-expression': 'off',
'no-prototype-builtins': 'off',
},
},
{
files: ['playwright-e2e/**/*.{ts,tsx}'],
plugins: { customEslintPlugin },
rules: {
...pluginJs.configs.recommended.rules,
indent: ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
'comma-dangle': ['error', 'always-multiline'],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],
'no-multiple-empty-lines': ['error', { max: 1 }],
'@typescript-eslint/no-var-requires': 0,
'no-empty-pattern': 0,
'@typescript-eslint/no-unused-vars': 'warn',
'no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unused-expressions': 'warn',
...eslintConfigPrettier.rules,
},
},
{
files: [
'playwright-e2e/pages/**/*page.ts',
'playwright-e2e/pages/**/*fragment.ts',
'playwright-e2e/steps/**/*steps.ts',
'playwright-e2e/data-builders/**/*data-builder.ts',
'playwright-e2e/base/base-page.ts',
'playwright-e2e/base/base-requests.ts',
'playwright-e2e/base/base-api-steps.ts',
'playwright-e2e/base/base-exui-steps.ts',
],
rules: {
'customEslintPlugin/prefer-step-decorator': 'warn',
},
},
{ languageOptions: { globals: globals.node } },
];