@kitschpatrol/eslint-config 4.7.12 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +6259 -61
- package/dist/index.d.ts +13096 -0
- package/dist/index.js +3918 -0
- package/init/.vscode/settings.json +13 -3
- package/init/eslint.config.ts +9 -0
- package/license.txt +4 -1
- package/package.json +75 -34
- package/readme.md +126 -23
- package/eslint.config.cjs +0 -352
- package/init/.eslintignore +0 -26
- package/init/.eslintrc.cjs +0 -7
- package/init/tsconfig.eslint.json +0 -11
- package/init/tsconfig.json +0 -26
package/eslint.config.cjs
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/no-null */
|
|
2
|
-
/* eslint-disable perfectionist/sort-objects */
|
|
3
|
-
const extendsPrefix = [
|
|
4
|
-
'eslint:recommended',
|
|
5
|
-
'plugin:n/recommended',
|
|
6
|
-
'plugin:unicorn/recommended',
|
|
7
|
-
'xo',
|
|
8
|
-
'plugin:perfectionist/recommended-natural-legacy',
|
|
9
|
-
'prettier', // Needed here as well for files not caught by overrides
|
|
10
|
-
]
|
|
11
|
-
const extendsTypescript = ['plugin:@typescript-eslint/recommended-type-checked', 'xo-typescript']
|
|
12
|
-
const extendsSuffix = ['prettier']
|
|
13
|
-
|
|
14
|
-
const globalRulesPrefix = {
|
|
15
|
-
'max-params': 'off',
|
|
16
|
-
'n/no-missing-import': 'off', // Trouble resolving in ts
|
|
17
|
-
'n/no-process-exit': 'off', // Duplicated in unicorn
|
|
18
|
-
'n/no-extraneous-import': 'off', // Monorepo problems
|
|
19
|
-
'n/no-unpublished-import': 'off', // Monorepo problems
|
|
20
|
-
'no-await-in-loop': 'off',
|
|
21
|
-
'object-curly-spacing': 'off', // Shouldn't prettier get rid of this?
|
|
22
|
-
'comma-dangle': 'off', // Shouldn't prettier get rid of this?
|
|
23
|
-
'no-unused-vars': [
|
|
24
|
-
'error',
|
|
25
|
-
{
|
|
26
|
-
argsIgnorePattern: '^_',
|
|
27
|
-
destructuredArrayIgnorePattern: '^_',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
'no-warning-comments': 'off',
|
|
31
|
-
'perfectionist/sort-imports': [
|
|
32
|
-
'error',
|
|
33
|
-
{
|
|
34
|
-
// Is this already set in the preset?
|
|
35
|
-
type: 'natural',
|
|
36
|
-
newlinesBetween: 'never',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
'unicorn/no-array-reduce': 'off',
|
|
40
|
-
'unicorn/prevent-abbreviations': [
|
|
41
|
-
'error',
|
|
42
|
-
{
|
|
43
|
-
replacements: {
|
|
44
|
-
acc: false,
|
|
45
|
-
arg: false,
|
|
46
|
-
args: false,
|
|
47
|
-
db: false,
|
|
48
|
-
dev: false,
|
|
49
|
-
doc: false,
|
|
50
|
-
docs: false,
|
|
51
|
-
env: false,
|
|
52
|
-
fn: false,
|
|
53
|
-
i: false,
|
|
54
|
-
j: false,
|
|
55
|
-
lib: false,
|
|
56
|
-
param: false,
|
|
57
|
-
params: false,
|
|
58
|
-
pkg: false,
|
|
59
|
-
prop: false,
|
|
60
|
-
props: false,
|
|
61
|
-
ref: false,
|
|
62
|
-
refs: false,
|
|
63
|
-
src: false,
|
|
64
|
-
temp: false,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
// Perfectionist conflict rules,
|
|
69
|
-
'@typescript-eslint/adjacent-overload-signatures': 'off',
|
|
70
|
-
'@typescript-eslint/sort-type-constituents': 'off',
|
|
71
|
-
'import/order': 'off',
|
|
72
|
-
'react/jsx-sort-props': 'off',
|
|
73
|
-
'sort-imports': 'off',
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const globalRulesTypescript = {
|
|
77
|
-
'@typescript-eslint/no-unused-vars': [
|
|
78
|
-
'error',
|
|
79
|
-
{
|
|
80
|
-
argsIgnorePattern: '^_',
|
|
81
|
-
destructuredArrayIgnorePattern: '^_',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
'default-case': 'off', // TS checks
|
|
85
|
-
'no-throw-literal': 'off', // Conflicts with @typescript-eslint version https://typescript-eslint.io/rules/no-throw-literal/#how-to-use
|
|
86
|
-
// https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
|
87
|
-
'no-undef': 'off',
|
|
88
|
-
'no-unused-vars': 'off',
|
|
89
|
-
'@typescript-eslint/naming-convention': [
|
|
90
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md
|
|
91
|
-
'error',
|
|
92
|
-
// Group selectors
|
|
93
|
-
{
|
|
94
|
-
// Matches everything
|
|
95
|
-
selector: 'default',
|
|
96
|
-
format: ['camelCase'],
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
// Forgive quoted things
|
|
100
|
-
selector: 'default',
|
|
101
|
-
format: null,
|
|
102
|
-
modifiers: ['requiresQuotes'],
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
// Matches the same as class, enum, interface, typeAlias, typeParameter
|
|
106
|
-
selector: 'typeLike',
|
|
107
|
-
format: ['StrictPascalCase'],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
// Matches the same as function, parameter and variable
|
|
111
|
-
selector: 'variableLike',
|
|
112
|
-
leadingUnderscore: 'allow',
|
|
113
|
-
trailingUnderscore: 'allow',
|
|
114
|
-
format: ['camelCase'],
|
|
115
|
-
},
|
|
116
|
-
// {
|
|
117
|
-
// // matches the same as accessor, enumMember, method, parameterProperty, property
|
|
118
|
-
// selector: 'memberLike'
|
|
119
|
-
// // format: []
|
|
120
|
-
// },
|
|
121
|
-
// {
|
|
122
|
-
// // matches the same as classMethod, objectLiteralMethod, typeMethod
|
|
123
|
-
// selector: 'method'
|
|
124
|
-
// // format: []
|
|
125
|
-
// },
|
|
126
|
-
// {
|
|
127
|
-
// // matches the same as classProperty, objectLiteralProperty, typeProperty
|
|
128
|
-
// selector: 'property'
|
|
129
|
-
// // format: []
|
|
130
|
-
// },
|
|
131
|
-
// Individual selectors
|
|
132
|
-
{
|
|
133
|
-
selector: 'import',
|
|
134
|
-
format: ['camelCase', 'StrictPascalCase'],
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
// Allow Component import
|
|
138
|
-
selector: 'variable',
|
|
139
|
-
modifiers: ['destructured'],
|
|
140
|
-
format: ['camelCase', 'StrictPascalCase'],
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
// Allow UPPER_CASE const exports
|
|
144
|
-
selector: 'variable',
|
|
145
|
-
modifiers: ['const', 'exported'],
|
|
146
|
-
format: ['UPPER_CASE', 'camelCase'],
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/* @type {import('eslint').Linter.Config} */
|
|
152
|
-
module.exports = {
|
|
153
|
-
plugins: ['@html-eslint', 'html'],
|
|
154
|
-
extends: extendsPrefix,
|
|
155
|
-
env: {
|
|
156
|
-
browser: true,
|
|
157
|
-
es2022: true, // TODO 2024 like xo?
|
|
158
|
-
node: true,
|
|
159
|
-
},
|
|
160
|
-
parser: '@typescript-eslint/parser', // Todo right choice for jsdoc js?
|
|
161
|
-
parserOptions: {
|
|
162
|
-
ecmaFeatures: {
|
|
163
|
-
jsx: true,
|
|
164
|
-
},
|
|
165
|
-
ecmaVersion: 2022,
|
|
166
|
-
extraFileExtensions: ['.svelte', '.astro'], // Essential for these file types to make it to the override
|
|
167
|
-
project: 'tsconfig.eslint.json',
|
|
168
|
-
tsconfigRootDir: process.cwd(), // Look for tsconfig in the consuming project's root
|
|
169
|
-
sourceType: 'module',
|
|
170
|
-
},
|
|
171
|
-
rules: globalRulesPrefix,
|
|
172
|
-
overrides: [
|
|
173
|
-
// HTML (and inline scripts)
|
|
174
|
-
{
|
|
175
|
-
files: ['*.html'],
|
|
176
|
-
parser: '@html-eslint/parser',
|
|
177
|
-
rules: {
|
|
178
|
-
// Best Practice
|
|
179
|
-
'@html-eslint/no-duplicate-attrs': 'error',
|
|
180
|
-
'@html-eslint/no-duplicate-id': 'error',
|
|
181
|
-
'@html-eslint/no-inline-styles': 'error',
|
|
182
|
-
'@html-eslint/no-obsolete-tags': 'error',
|
|
183
|
-
'@html-eslint/no-restricted-attr-values': 'error',
|
|
184
|
-
'@html-eslint/no-restricted-attrs': 'error',
|
|
185
|
-
'@html-eslint/no-script-style-type': 'error',
|
|
186
|
-
'@html-eslint/no-target-blank': 'error',
|
|
187
|
-
'@html-eslint/require-attrs': 'error',
|
|
188
|
-
'@html-eslint/require-button-type': 'error',
|
|
189
|
-
// '@html-eslint/require-closing-tags': 'error',
|
|
190
|
-
'@html-eslint/require-doctype': 'error',
|
|
191
|
-
'@html-eslint/require-li-container': 'error',
|
|
192
|
-
'@html-eslint/require-meta-charset': 'error',
|
|
193
|
-
// SEO
|
|
194
|
-
'@html-eslint/no-multiple-h1': 'error',
|
|
195
|
-
'@html-eslint/require-lang': 'error',
|
|
196
|
-
// '@html-eslint/require-meta-description': 'error',
|
|
197
|
-
// '@html-eslint/require-open-graph-protocol': 'error',
|
|
198
|
-
'@html-eslint/require-title': 'error',
|
|
199
|
-
// Accessibility
|
|
200
|
-
'@html-eslint/no-abstract-roles': 'error',
|
|
201
|
-
'@html-eslint/no-accesskey-attrs': 'error',
|
|
202
|
-
'@html-eslint/no-aria-hidden-body': 'error',
|
|
203
|
-
'@html-eslint/no-non-scalable-viewport': 'error',
|
|
204
|
-
'@html-eslint/no-positive-tabindex': 'error',
|
|
205
|
-
'@html-eslint/no-skip-heading-levels': 'error',
|
|
206
|
-
'@html-eslint/require-frame-title': 'error',
|
|
207
|
-
'@html-eslint/require-img-alt': 'error',
|
|
208
|
-
'@html-eslint/require-meta-viewport': 'error',
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
// Markdown
|
|
213
|
-
{
|
|
214
|
-
extends: ['plugin:mdx/recommended'],
|
|
215
|
-
files: ['*.md'],
|
|
216
|
-
parser: 'eslint-mdx',
|
|
217
|
-
rules: globalRulesPrefix,
|
|
218
|
-
},
|
|
219
|
-
// MDX
|
|
220
|
-
{
|
|
221
|
-
extends: ['plugin:mdx/recommended', ...extendsSuffix],
|
|
222
|
-
files: ['*.mdx'],
|
|
223
|
-
parser: 'eslint-mdx',
|
|
224
|
-
rules: {
|
|
225
|
-
...globalRulesPrefix,
|
|
226
|
-
'no-unused-expressions': 'off',
|
|
227
|
-
'no-unused-vars': 'off',
|
|
228
|
-
|
|
229
|
-
// MDX files can be PascalCase OR kebab-case, depending on whether
|
|
230
|
-
// the file's core nature is that of content or component
|
|
231
|
-
'unicorn/filename-case': [
|
|
232
|
-
'error',
|
|
233
|
-
{
|
|
234
|
-
cases: {
|
|
235
|
-
kebabCase: true,
|
|
236
|
-
pascalCase: true,
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
},
|
|
241
|
-
settings: {
|
|
242
|
-
'mdx/code-blocks': false,
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
// TypeScript
|
|
246
|
-
{
|
|
247
|
-
extends: [...extendsTypescript, ...extendsSuffix],
|
|
248
|
-
files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
|
|
249
|
-
// SvelteKit
|
|
250
|
-
overrides: [
|
|
251
|
-
{
|
|
252
|
-
files: ['**/routes/**/+*.ts'],
|
|
253
|
-
rules: {
|
|
254
|
-
// Error often imported from from '@sveltejs/kit in SvelteKit files
|
|
255
|
-
'@typescript-eslint/no-throw-literal': 'off',
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
parser: '@typescript-eslint/parser',
|
|
260
|
-
parserOptions: {
|
|
261
|
-
project: 'tsconfig.eslint.json', // Not sure why this isn't inherited
|
|
262
|
-
},
|
|
263
|
-
rules: {
|
|
264
|
-
...globalRulesPrefix,
|
|
265
|
-
...globalRulesTypescript,
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
// JavaScript
|
|
269
|
-
{
|
|
270
|
-
extends: [...extendsSuffix],
|
|
271
|
-
files: ['*.jsx', '*.mjs', '*.cjs', '.js'],
|
|
272
|
-
rules: {
|
|
273
|
-
...globalRulesPrefix,
|
|
274
|
-
...globalRulesTypescript,
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
// Astro
|
|
278
|
-
{
|
|
279
|
-
extends: [
|
|
280
|
-
...extendsTypescript,
|
|
281
|
-
'plugin:astro/recommended',
|
|
282
|
-
'plugin:astro/jsx-a11y-recommended',
|
|
283
|
-
...extendsSuffix,
|
|
284
|
-
],
|
|
285
|
-
files: ['*.astro'],
|
|
286
|
-
parser: 'astro-eslint-parser',
|
|
287
|
-
parserOptions: {
|
|
288
|
-
extraFileExtensions: ['.astro'],
|
|
289
|
-
parser: '@typescript-eslint/parser',
|
|
290
|
-
project: 'tsconfig.eslint.json', // Not sure why this isn't inherited
|
|
291
|
-
sourceType: 'module',
|
|
292
|
-
},
|
|
293
|
-
rules: {
|
|
294
|
-
...globalRulesPrefix,
|
|
295
|
-
...globalRulesTypescript,
|
|
296
|
-
'@typescript-eslint/no-unsafe-assignment': 'off', // Crashing
|
|
297
|
-
'@typescript-eslint/no-unsafe-return': 'off', // Happens in templates
|
|
298
|
-
// Astro components are usually PascalCase,
|
|
299
|
-
// but when used as pages they are kebab-case
|
|
300
|
-
'unicorn/filename-case': [
|
|
301
|
-
'error',
|
|
302
|
-
{
|
|
303
|
-
cases: {
|
|
304
|
-
kebabCase: true,
|
|
305
|
-
pascalCase: true,
|
|
306
|
-
},
|
|
307
|
-
ignore: [String.raw`^\[slug\]\.astro$`],
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
// Svelte
|
|
313
|
-
{
|
|
314
|
-
extends: [
|
|
315
|
-
...extendsTypescript,
|
|
316
|
-
'plugin:svelte/recommended',
|
|
317
|
-
...extendsSuffix,
|
|
318
|
-
'plugin:svelte/prettier',
|
|
319
|
-
],
|
|
320
|
-
files: ['*.svelte'],
|
|
321
|
-
parser: 'svelte-eslint-parser',
|
|
322
|
-
parserOptions: {
|
|
323
|
-
extraFileExtensions: ['.svelte'],
|
|
324
|
-
parser: '@typescript-eslint/parser',
|
|
325
|
-
project: true,
|
|
326
|
-
sourceType: 'module',
|
|
327
|
-
},
|
|
328
|
-
rules: {
|
|
329
|
-
...globalRulesPrefix,
|
|
330
|
-
...globalRulesTypescript,
|
|
331
|
-
'@typescript-eslint/no-confusing-void-expression': 'off', // Reactive statements
|
|
332
|
-
'@typescript-eslint/no-unused-expressions': 'off', // Needed for reactive statements
|
|
333
|
-
'import/no-mutable-exports': 'off', // Allow prop export
|
|
334
|
-
'no-sequences': 'off', // Reactive statements
|
|
335
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/1cf9243/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
|
336
|
-
'no-undef-init': 'off', // Initialize props to undefined
|
|
337
|
-
'prefer-const': 'off', // Needed for let props
|
|
338
|
-
'unicorn/filename-case': [
|
|
339
|
-
// Svelte components are PascalCase
|
|
340
|
-
'error',
|
|
341
|
-
{
|
|
342
|
-
case: 'pascalCase',
|
|
343
|
-
ignore: [
|
|
344
|
-
String.raw`^\+`, // SvelteKit +page.svelte etc.
|
|
345
|
-
],
|
|
346
|
-
},
|
|
347
|
-
],
|
|
348
|
-
'unicorn/no-useless-undefined': 'off', // Needed for let props
|
|
349
|
-
},
|
|
350
|
-
},
|
|
351
|
-
],
|
|
352
|
-
}
|
package/init/.eslintignore
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# ESLint Ignore
|
|
2
|
-
# Does not inherit from .gitignore
|
|
3
|
-
|
|
4
|
-
# @kitschpatrol/repo-config boilerplate
|
|
5
|
-
.astro/
|
|
6
|
-
.DS_Store
|
|
7
|
-
.env
|
|
8
|
-
.env.*
|
|
9
|
-
!.env.example
|
|
10
|
-
.svelte-kit/
|
|
11
|
-
{tmp,temp}/
|
|
12
|
-
**/*.min.js
|
|
13
|
-
/scratch/
|
|
14
|
-
bower_components/
|
|
15
|
-
build/
|
|
16
|
-
coverage/
|
|
17
|
-
dist/
|
|
18
|
-
env.d.ts
|
|
19
|
-
node_modules/
|
|
20
|
-
vendor/
|
|
21
|
-
.parcel-cache/
|
|
22
|
-
|
|
23
|
-
# @kitschpatrol/eslint-config boilerplate
|
|
24
|
-
/patches/
|
|
25
|
-
|
|
26
|
-
# Customizations
|
package/init/.eslintrc.cjs
DELETED
package/init/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"noErrorTruncation": true,
|
|
10
|
-
|
|
11
|
-
/* Bundler mode */
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"allowImportingTsExtensions": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
|
-
|
|
17
|
-
/* Linting */
|
|
18
|
-
"strict": true,
|
|
19
|
-
"noUnusedLocals": true,
|
|
20
|
-
"noUnusedParameters": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
"include": ["**/*"],
|
|
25
|
-
"exclude": ["dist/", "bin/"]
|
|
26
|
-
}
|