-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy patheslint.config.mjs
More file actions
102 lines (101 loc) · 2.72 KB
/
eslint.config.mjs
File metadata and controls
102 lines (101 loc) · 2.72 KB
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
import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import perfectionist from 'eslint-plugin-perfectionist';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default defineConfig(
{
files: ['**/*.{ts,tsx,cts,mts,js,cjs,mjs}'],
},
{
plugins: {
perfectionist,
},
},
{
ignores: [
'**/node_modules/**',
'.pnpm-store/',
'eslint.config.mjs',
'run/**/*.js',
'scripts/*.js',
'avd/',
'allure*/',
'run/localizer/*',
'pnpm-lock.yaml',
],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked, // see https://typescript-eslint.io/getting-started/typed-linting/
{
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
globals: globals.node,
},
},
{
rules: {
'no-unused-vars': 'off', // we have @typescript-eslint/no-unused-vars enabled below
'no-else-return': 'error',
'preserve-caught-error': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
caughtErrors: 'none',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'perfectionist/sort-imports': 'error',
'perfectionist/sort-named-imports': 'error',
'perfectionist/sort-union-types': [
'error',
{
// This ensures null/undefined come after other types for better readability
groups: [
'named',
'keyword',
'operator',
'literal',
'function',
'import',
'conditional',
'object',
'tuple',
'intersection',
'union',
'nullish',
],
},
],
},
},
{
files: ['run/localizer/*'],
rules: {
'perfectionist/sort-imports': 'off',
'perfectionist/sort-named-imports': 'off',
'perfectionist/sort-union-types': 'off',
},
},
{
files: ['run/test/locators/*'],
rules: {
'perfectionist/sort-modules': 'error',
},
}
);