-
Notifications
You must be signed in to change notification settings - Fork 80
/
eslint.config.js
144 lines (136 loc) · 3.8 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
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
138
139
140
141
142
143
144
import { configs as liteslint } from 'eslint-plugin-lit';
import chaifriendlyeslint from 'eslint-plugin-chai-friendly';
import eslint from '@eslint/js';
import globals from 'globals';
import importeslint from 'eslint-plugin-import-x';
import jsoneslint from 'eslint-plugin-json';
import mochaeslint from 'eslint-plugin-mocha';
import nodeeslint from 'eslint-plugin-n';
import prettiereslint from 'eslint-config-prettier';
import promiseeslint from 'eslint-plugin-promise';
import sortImportsEs6Autofix from 'eslint-plugin-sort-imports-es6-autofix';
import tsdoc from 'eslint-plugin-tsdoc';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
ignores: ['**/dist'],
},
eslint.configs.recommended,
liteslint['flat/recommended'],
jsoneslint.configs['recommended-with-comments'],
mochaeslint.configs.flat.recommended,
promiseeslint.configs['flat/recommended'],
importeslint.flatConfigs.recommended,
importeslint.flatConfigs.typescript,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
prettiereslint,
{
plugins: {
tsdoc,
'sort-imports-es6-autofix': sortImportsEs6Autofix,
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
globals: {
...globals.browser,
...globals.webextensions,
},
},
settings: {
'import-x/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import-x/resolver': {
typescript: {},
},
},
rules: {
'import-x/no-unresolved': [
'error',
{
ignore: ['csv-parse/sync'],
},
],
'block-scoped-var': 'error',
eqeqeq: 'error',
'no-var': 'error',
'prefer-const': 'error',
'eol-last': 'error',
'no-trailing-spaces': 'error',
quotes: [
'warn',
'single',
{
avoidEscape: true,
},
],
'linebreak-style': ['error', 'unix'],
'no-tabs': 'error',
'sort-imports-es6-autofix/sort-imports-es6': 'error',
'unicode-bom': 'error',
'promise/prefer-await-to-then': 'error',
curly: 'error',
'mocha/prefer-arrow-callback': 'error',
// TODO(#792): Remove/evaluate following rules once errors are fixed.
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'import-x/no-named-as-default-member': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
// End of rules to fix.
'@typescript-eslint/no-empty-function': [
'error',
{
allow: ['private-constructors'],
},
],
'tsdoc/syntax': 'error',
},
},
{
files: ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.json'],
extends: [tseslint.configs.disableTypeChecked],
rules: {
'tsdoc/syntax': 'off',
},
},
{
files: ['**/*_test.ts'],
plugins: { 'chai-friendly': chaifriendlyeslint },
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
'chai-friendly/no-unused-expressions': 'error',
},
},
{
files: [
// Enumeration of node scripts and configs.
'**/web-test-runner.config.js',
'utils/*',
'**/snowpack.config.cjs',
'**/commitlint.config.cjs',
'**/.prettierrc.cjs',
'**/eslint.config.js',
],
extends: [nodeeslint.configs['flat/recommended']],
languageOptions: {
globals: {
...globals.node,
},
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.cjs', '.ts'],
},
},
},
}
);