-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.config.js
More file actions
152 lines (140 loc) · 4.41 KB
/
eslint.config.js
File metadata and controls
152 lines (140 loc) · 4.41 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
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
145
146
147
148
149
150
151
152
import {readFileSync} from 'fs';
// eslint-disable-next-line import/no-unresolved -- Present
import {defineConfig} from 'eslint/config';
import ashNazg from 'eslint-config-ash-nazg';
// eslint-disable-next-line import/no-unresolved --- Not resolving
import tseslint from 'typescript-eslint';
const {dirname} = import.meta;
const mainRules = {
'@brettz9/no-use-ignored-vars': 0,
// Disable from recommended-requiring-type-checking (any)
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/no-unsafe-argument': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-unsafe-member-access': 0,
'@typescript-eslint/no-unsafe-call': 0,
// Disable from Strict
'@typescript-eslint/no-dynamic-delete': 0,
// Class Undefined has a use for us
'@typescript-eslint/no-extraneous-class': 0,
// V flag not supported in earlier browsers
'require-unicode-regexp': ['error', {
requireFlag: 'u'
}],
// Disable for now
'jsdoc/check-types': 0,
'jsdoc/reject-any-type': 0,
'jsdoc/ts-no-empty-object-type': 0,
'jsdoc/reject-function-type': 0,
'@stylistic/brace-style': 'off',
// Uses multiple sync methods
'n/no-sync': 'off',
'@stylistic/dot-location': ['error', 'property'],
'@stylistic/indent': ['error', 4, {outerIIFEBody: 0}],
'unicorn/consistent-destructuring': 0,
'promise/prefer-await-to-then': 0,
'promise/prefer-await-to-callbacks': 0,
'n/no-unsupported-features/es-builtins': 0,
'n/no-unsupported-features/es-syntax': 0,
'jsdoc/check-values': ['error', {allowedLicenses: true}],
'unicorn/no-this-assignment': 0,
'unicorn/prefer-spread': 0
};
const tsconfig = JSON.parse(readFileSync('./tsconfig.json', 'utf8'));
export default [
{
ignores: [
'test/test-polyglot.js',
'dist',
'ignore',
'coverage',
'node_modules',
// TS issues
'test/chaiESMLoader.js',
'rollup.config.js'
]
},
...ashNazg(['sauron']),
{
settings: {
polyfills: [
'Array.from',
'Array.isArray',
'console',
'document.body',
'Error',
'JSON',
'Map',
'Number.isNaN',
'Object.create',
'Object.defineProperty',
'Object.entries',
'Object.getPrototypeOf',
'Object.keys',
'Promise',
'Set',
'Symbol',
'URL'
]
}
},
{
rules: {
...mainRules
}
},
...defineConfig(
...tseslint.configs.strictTypeChecked.map((cfg) => {
return {
...cfg,
files: tsconfig.include
};
}),
{
languageOptions: {
ecmaVersion: 2024,
parserOptions: {
project: true,
tsconfigRootDir: dirname,
// Markdown problematic per https://github.com/typescript-eslint/typescript-eslint/issues/2373
extraFileExtensions: ['.html', '.md']
}
},
rules: {
...mainRules
}
}
),
{
files: ['**/*.md/*.js'],
settings: {
polyfills: ['Float64Array', 'Int8Array']
},
languageOptions: {
parserOptions: {
project: null
}
},
rules: {
'eol-last': ['off'],
'no-console': ['off'],
'no-undef': ['off'],
'padded-blocks': ['off'],
'import/unambiguous': ['off'],
'import/no-unresolved': ['off'],
'import/no-commonjs': 'off',
'import/no-extraneous-dependencies': 'off',
'global-require': 'off',
'no-restricted-syntax': ['off'],
'n/no-missing-import': ['off'],
'no-multi-spaces': 'off',
'jsdoc/require-jsdoc': 'off',
'no-unused-vars': ['error', {
varsIgnorePattern: '^(typeson|myTypeson|objs|revived|obj)$'
}],
'n/global-require': 'off',
// Disable until may fix https://github.com/gajus/eslint-plugin-jsdoc/issues/211
'@stylistic/indent': 'off'
}
}
];