@lichthagel/eslint-config 1.0.30 → 1.0.32

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/dist/index.mjs ADDED
@@ -0,0 +1,468 @@
1
+ import globals from "globals";
2
+ import js from "@eslint/js";
3
+ import perfectionst from "eslint-plugin-perfectionist";
4
+ import stylistic from "@stylistic/eslint-plugin";
5
+ import ts from "typescript-eslint";
6
+ import unicornPlugin from "eslint-plugin-unicorn";
7
+ //#region src/configs/browser.ts
8
+ var browser_default = [{
9
+ name: "lichthagel/browser",
10
+ languageOptions: { globals: {
11
+ ...globals.browser,
12
+ document: "readonly",
13
+ navigator: "readonly",
14
+ window: "readonly"
15
+ } }
16
+ }];
17
+ //#endregion
18
+ //#region src/configs/javascript.ts
19
+ var javascript_default = [{
20
+ name: "js/recommended",
21
+ ...js.configs.recommended
22
+ }, {
23
+ name: "lichthagel/javascript",
24
+ languageOptions: {
25
+ ecmaVersion: 2022,
26
+ globals: { ...globals.es2022 },
27
+ parserOptions: {
28
+ ecmaVersion: 2022,
29
+ sourceType: "module"
30
+ },
31
+ sourceType: "module"
32
+ },
33
+ rules: {
34
+ "accessor-pairs": "error",
35
+ "array-callback-return": "error",
36
+ "arrow-body-style": "error",
37
+ "block-scoped-var": "error",
38
+ "curly": ["error", "all"],
39
+ "default-case-last": "error",
40
+ "dot-notation": "error",
41
+ "eqeqeq": ["error", "smart"],
42
+ "new-cap": ["error", {
43
+ capIsNew: false,
44
+ newIsCap: true,
45
+ properties: true
46
+ }],
47
+ "no-alert": "error",
48
+ "no-array-constructor": "error",
49
+ "no-await-in-loop": "error",
50
+ "no-bitwise": "error",
51
+ "no-caller": "error",
52
+ "no-cond-assign": ["error", "always"],
53
+ "no-console": ["error", { allow: ["warn", "error"] }],
54
+ "no-duplicate-imports": "error",
55
+ "no-eval": "error",
56
+ "no-extend-native": "error",
57
+ "no-extra-bind": "error",
58
+ "no-implied-eval": "error",
59
+ "no-iterator": "error",
60
+ "no-label-var": "error",
61
+ "no-labels": "error",
62
+ "no-lone-blocks": "error",
63
+ "no-multi-assign": "error",
64
+ "no-multi-str": "error",
65
+ "no-new": "error",
66
+ "no-new-func": "error",
67
+ "no-new-wrappers": "error",
68
+ "no-octal-escape": "error",
69
+ "no-promise-executor-return": ["error", { allowVoid: true }],
70
+ "no-proto": "error",
71
+ "no-restricted-globals": [
72
+ "error",
73
+ {
74
+ name: "global",
75
+ message: "Use `globalThis` instead."
76
+ },
77
+ {
78
+ name: "self",
79
+ message: "Use `globalThis` instead."
80
+ }
81
+ ],
82
+ "no-restricted-properties": [
83
+ "error",
84
+ {
85
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
86
+ property: "__proto__"
87
+ },
88
+ {
89
+ message: "Use `Object.defineProperty` instead.",
90
+ property: "__defineGetter__"
91
+ },
92
+ {
93
+ message: "Use `Object.defineProperty` instead.",
94
+ property: "__defineSetter__"
95
+ },
96
+ {
97
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
98
+ property: "__lookupGetter__"
99
+ },
100
+ {
101
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
102
+ property: "__lookupSetter__"
103
+ }
104
+ ],
105
+ "no-restricted-syntax": [
106
+ "error",
107
+ "DebuggerStatement",
108
+ "LabeledStatement",
109
+ "WithStatement",
110
+ "TSEnumDeclaration[const=true]",
111
+ "TSExportAssignment"
112
+ ],
113
+ "no-self-compare": "error",
114
+ "no-sequences": "error",
115
+ "no-template-curly-in-string": "error",
116
+ "no-throw-literal": "error",
117
+ "no-undef-init": "error",
118
+ "no-unmodified-loop-condition": "error",
119
+ "no-unneeded-ternary": "error",
120
+ "no-unreachable-loop": "error",
121
+ "no-unused-expressions": ["error", {
122
+ allowShortCircuit: true,
123
+ allowTaggedTemplates: true,
124
+ allowTernary: true
125
+ }],
126
+ "no-useless-call": "error",
127
+ "no-useless-computed-key": "error",
128
+ "no-useless-concat": "error",
129
+ "no-useless-constructor": "error",
130
+ "no-useless-rename": "error",
131
+ "no-useless-return": "error",
132
+ "no-var": "error",
133
+ "object-shorthand": [
134
+ "error",
135
+ "always",
136
+ { ignoreConstructors: false }
137
+ ],
138
+ "prefer-arrow-callback": "error",
139
+ "prefer-const": "error",
140
+ "prefer-destructuring": ["error", { AssignmentExpression: {
141
+ array: false,
142
+ object: false
143
+ } }],
144
+ "prefer-exponentiation-operator": "error",
145
+ "prefer-object-spread": "error",
146
+ "prefer-promise-reject-errors": "error",
147
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
148
+ "prefer-rest-params": "error",
149
+ "prefer-spread": "error",
150
+ "prefer-template": "error",
151
+ "require-await": "error",
152
+ "sort-imports": ["error", {
153
+ allowSeparatedGroups: true,
154
+ ignoreCase: false,
155
+ ignoreDeclarationSort: true
156
+ }],
157
+ "symbol-description": "error",
158
+ "use-isnan": ["error", {
159
+ enforceForIndexOf: true,
160
+ enforceForSwitchCase: true
161
+ }],
162
+ "valid-typeof": ["error", { requireStringLiterals: true }],
163
+ "yoda": "error"
164
+ }
165
+ }];
166
+ //#endregion
167
+ //#region src/configs/node.ts
168
+ const node = async () => {
169
+ return [(await import("eslint-plugin-n").then((mod) => mod.default)).configs["flat/recommended-module"], {
170
+ name: "lichthagel/node",
171
+ languageOptions: { globals: { ...globals.node } },
172
+ rules: {
173
+ "n/handle-callback-err": ["error", "^.*(e|E)rr(or)?$"],
174
+ "n/no-new-require": "error",
175
+ "n/no-path-concat": "error",
176
+ "n/no-process-env": "error",
177
+ "n/no-missing-import": "off",
178
+ "n/no-missing-require": "off"
179
+ }
180
+ }];
181
+ };
182
+ //#endregion
183
+ //#region src/configs/perfectionist.ts
184
+ var perfectionist_default = [{
185
+ name: "perfectionist/recommended-natural",
186
+ ...perfectionst.configs["recommended-natural"]
187
+ }, {
188
+ name: "lichthagel/perfectionist",
189
+ rules: {
190
+ "perfectionist/sort-imports": ["error", {
191
+ type: "natural",
192
+ internalPattern: [
193
+ "^@/.*",
194
+ "^~.*",
195
+ "^$.*",
196
+ "^#.*"
197
+ ]
198
+ }],
199
+ "perfectionist/sort-object-types": "off",
200
+ "perfectionist/sort-objects": ["off", {
201
+ customGroups: [{
202
+ groupName: "id",
203
+ elementNamePattern: "^(?:id|uuid|key|index|slug)$"
204
+ }, {
205
+ groupName: "name",
206
+ elementNamePattern: "^(?:name|title|label)$"
207
+ }],
208
+ groups: ["id", "unknown"],
209
+ partitionByComment: true,
210
+ partitionByNewLine: true
211
+ }],
212
+ "perfectionist/sort-union-types": ["error", { groups: [
213
+ "named",
214
+ ["intersection", "union"],
215
+ "unknown",
216
+ "nullish"
217
+ ] }],
218
+ "sort-imports": "off"
219
+ }
220
+ }];
221
+ //#endregion
222
+ //#region src/configs/solid.ts
223
+ const solid = async (options = {}) => {
224
+ const { withTypescript = false } = options;
225
+ const configSolid = await import("eslint-plugin-solid/configs/recommended").then((mod) => mod.default);
226
+ return [{
227
+ name: "solid/recommended",
228
+ files: ["**/*.jsx", ...withTypescript ? ["**/*.tsx"] : []],
229
+ ...configSolid
230
+ }];
231
+ };
232
+ //#endregion
233
+ //#region src/configs/stylistic.ts
234
+ var stylistic_default = [{
235
+ name: "stylistic/custom",
236
+ ...stylistic.configs.customize({
237
+ arrowParens: true,
238
+ braceStyle: "1tbs",
239
+ commaDangle: "always-multiline",
240
+ indent: 2,
241
+ jsx: true,
242
+ quoteProps: "consistent-as-needed",
243
+ quotes: "double",
244
+ semi: true
245
+ })
246
+ }, {
247
+ name: "lichthagel/stylistic",
248
+ rules: {
249
+ "@stylistic/array-bracket-newline": ["error", {
250
+ minItems: 4,
251
+ multiline: true
252
+ }],
253
+ "@stylistic/array-element-newline": ["error", {
254
+ minItems: 4,
255
+ multiline: true
256
+ }],
257
+ "@stylistic/curly-newline": ["error", { consistent: true }],
258
+ "@stylistic/function-call-argument-newline": ["error", "consistent"],
259
+ "@stylistic/function-call-spacing": ["error", "never"],
260
+ "@stylistic/function-paren-newline": ["error", "multiline-arguments"],
261
+ "@stylistic/generator-star-spacing": ["error", {
262
+ after: false,
263
+ before: true
264
+ }],
265
+ "@stylistic/implicit-arrow-linebreak": ["off", "beside"],
266
+ "@stylistic/lines-around-comment": ["error", {
267
+ afterHashbangComment: true,
268
+ allowArrayStart: true,
269
+ allowBlockStart: true,
270
+ allowClassStart: true,
271
+ allowEnumStart: true,
272
+ allowInterfaceStart: true,
273
+ allowModuleStart: true,
274
+ allowObjectStart: true,
275
+ allowTypeStart: true,
276
+ applyDefaultIgnorePatterns: true,
277
+ beforeBlockComment: true
278
+ }],
279
+ "@stylistic/lines-between-class-members": [
280
+ "error",
281
+ "always",
282
+ { exceptAfterSingleLine: false }
283
+ ],
284
+ "@stylistic/multiline-ternary": ["error", "always-multiline"],
285
+ "@stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 2 }],
286
+ "@stylistic/no-extra-semi": "error",
287
+ "@stylistic/no-multi-spaces": "error",
288
+ "@stylistic/nonblock-statement-body-position": ["error", "beside"],
289
+ "@stylistic/object-curly-newline": ["error", {
290
+ consistent: true,
291
+ minProperties: 4,
292
+ multiline: true
293
+ }],
294
+ "@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
295
+ "@stylistic/one-var-declaration-per-line": ["error", "always"],
296
+ "@stylistic/operator-linebreak": ["error", "before"],
297
+ "@stylistic/semi-style": ["error", "last"],
298
+ "@stylistic/switch-colon-spacing": ["error", {
299
+ after: true,
300
+ before: false
301
+ }],
302
+ "@stylistic/jsx-closing-bracket-location": ["error", "line-aligned"],
303
+ "@stylistic/jsx-curly-brace-presence": ["error", {
304
+ children: "never",
305
+ propElementValues: "always",
306
+ props: "never"
307
+ }],
308
+ "@stylistic/jsx-pascal-case": "error",
309
+ "@stylistic/jsx-self-closing-comp": "error"
310
+ }
311
+ }];
312
+ //#endregion
313
+ //#region src/configs/svelte.ts
314
+ const SVELTE_FILES = ["**/*.svelte"];
315
+ const svelte = async (options = {}) => {
316
+ const { disableStylistic = false, withTypescript = false } = options;
317
+ return [...(await import("eslint-plugin-svelte").then((mod) => mod.default)).configs["flat/recommended"].map((configItem) => ({
318
+ name: "svelte/recommended",
319
+ ...configItem
320
+ })), {
321
+ name: "lichthagel/svelte",
322
+ files: SVELTE_FILES,
323
+ languageOptions: { parserOptions: {
324
+ extraFileExtensions: [".svelte"],
325
+ parser: withTypescript ? "@typescript-eslint/parser" : null,
326
+ project: true
327
+ } },
328
+ rules: {
329
+ "svelte/block-lang": ["error", {
330
+ enforceScriptPresent: false,
331
+ enforceStylePresent: false,
332
+ script: [withTypescript ? "ts" : null]
333
+ }],
334
+ "svelte/first-attribute-linebreak": ["error", {
335
+ multiline: "below",
336
+ singleline: "beside"
337
+ }],
338
+ "svelte/html-closing-bracket-spacing": ["error", {
339
+ endTag: "never",
340
+ selfClosingTag: "always",
341
+ startTag: "never"
342
+ }],
343
+ "svelte/html-quotes": ["error", { prefer: "double" }],
344
+ "svelte/indent": ["error", {
345
+ alignAttributesVertically: true,
346
+ indent: 2
347
+ }],
348
+ "svelte/infinite-reactive-loop": "error",
349
+ "svelte/max-attributes-per-line": ["error", {
350
+ multiline: 1,
351
+ singleline: 3
352
+ }],
353
+ "svelte/mustache-spacing": "error",
354
+ "svelte/no-dupe-on-directives": "error",
355
+ "svelte/no-dupe-use-directives": "error",
356
+ "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
357
+ "svelte/no-goto-without-base": "error",
358
+ "svelte/no-ignored-unsubscribe": "error",
359
+ "svelte/no-immutable-reactive-statements": "error",
360
+ "svelte/no-reactive-functions": "error",
361
+ "svelte/no-reactive-literals": "error",
362
+ "svelte/no-spaces-around-equal-signs-in-attribute": "error",
363
+ "svelte/no-target-blank": "error",
364
+ "svelte/no-trailing-spaces": "error",
365
+ "svelte/no-useless-mustaches": "error",
366
+ "svelte/require-store-callbacks-use-set-param": "error",
367
+ "svelte/spaced-html-comment": ["error", "always"],
368
+ "svelte/valid-each-key": "error",
369
+ ...disableStylistic ? {
370
+ "@stylistic/indent": "off",
371
+ "@stylistic/indent-binary-ops": "off",
372
+ "@stylistic/no-trailing-spaces": "off"
373
+ } : {}
374
+ }
375
+ }];
376
+ };
377
+ //#endregion
378
+ //#region src/configs/tailwindcss.ts
379
+ const tailwindcss = async () => {
380
+ return [...(await import("eslint-plugin-tailwindcss").then((mod) => mod.default)).configs["flat/recommended"].map((config) => {
381
+ var _config$name;
382
+ return {
383
+ ...config,
384
+ name: (_config$name = config.name) === null || _config$name === void 0 ? void 0 : _config$name.replaceAll(":", "/")
385
+ };
386
+ }), {
387
+ name: "lichthagel/tailwindcss",
388
+ rules: {
389
+ "tailwindcss/classnames-order": "error",
390
+ "tailwindcss/enforces-negative-arbitrary-values": "error",
391
+ "tailwindcss/enforces-shorthand": "error",
392
+ "tailwindcss/no-contradicting-classname": "error",
393
+ "tailwindcss/no-unnecessary-arbitrary-value": "error"
394
+ }
395
+ }];
396
+ };
397
+ //#endregion
398
+ //#region src/configs/typescript.ts
399
+ var typescript_default = [...ts.configs.recommendedTypeChecked, {
400
+ name: "lichthagel/typescript",
401
+ rules: {
402
+ "@typescript-eslint/array-type": "error",
403
+ "@typescript-eslint/consistent-indexed-object-style": ["warn", "index-signature"],
404
+ "@typescript-eslint/consistent-type-assertions": ["warn", {
405
+ assertionStyle: "as",
406
+ objectLiteralTypeAssertions: "allow"
407
+ }],
408
+ "@typescript-eslint/consistent-type-definitions": ["warn", "type"],
409
+ "@typescript-eslint/consistent-type-exports": "error",
410
+ "@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }],
411
+ "@typescript-eslint/default-param-last": "warn",
412
+ "@typescript-eslint/explicit-member-accessibility": "error",
413
+ "@typescript-eslint/method-signature-style": "warn",
414
+ "@typescript-eslint/no-array-constructor": "error",
415
+ "@typescript-eslint/no-useless-empty-export": "error",
416
+ "default-param-last": "off"
417
+ }
418
+ }];
419
+ //#endregion
420
+ //#region src/configs/unicorn.ts
421
+ var unicorn_default = [{
422
+ name: "unicorn/flat/recommended",
423
+ ...unicornPlugin.configs["flat/recommended"]
424
+ }, {
425
+ name: "lichthagel/unicorn",
426
+ rules: {
427
+ "unicorn/consistent-destructuring": "error",
428
+ "unicorn/filename-case": ["error", { cases: {
429
+ camelCase: true,
430
+ kebabCase: true,
431
+ pascalCase: true
432
+ } }],
433
+ "unicorn/import-style": "off",
434
+ "unicorn/no-null": "off",
435
+ "unicorn/no-useless-undefined": ["error", { checkArguments: false }],
436
+ "unicorn/prevent-abbreviations": "off"
437
+ }
438
+ }];
439
+ //#endregion
440
+ //#region src/factory.ts
441
+ /**
442
+ * Constructs an array of ESLint flat config items based on the provided options.
443
+ *
444
+ * @param options The options for generating the ESLint configurations. See {@linkcode OptionsConfig}.
445
+ * @returns An array of ESLint flat config items.
446
+ */
447
+ const lichthagel = async (options = {}) => {
448
+ const { browser = false, node: node$1 = false, solid: solid$1 = false, stylistic = true, svelte: svelte$1 = false, tailwindcss: tailwindcss$1 = false, typescript = true, ...rest } = options;
449
+ if (Object.keys(rest).length > 0) throw new Error(`Unknown options: ${Object.keys(rest).join(", ")}`);
450
+ const config = [
451
+ ...javascript_default,
452
+ ...unicorn_default,
453
+ ...perfectionist_default
454
+ ];
455
+ if (stylistic) config.push(...stylistic_default);
456
+ if (browser) config.push(...browser_default);
457
+ if (node$1) config.push(...await node());
458
+ if (typescript) config.push(...typescript_default);
459
+ if (solid$1) config.push(...await solid({ withTypescript: typescript }));
460
+ if (svelte$1) config.push(...await svelte({
461
+ disableStylistic: stylistic,
462
+ withTypescript: typescript
463
+ }));
464
+ if (tailwindcss$1) config.push(...await tailwindcss());
465
+ return config;
466
+ };
467
+ //#endregion
468
+ export { browser_default as browser, lichthagel as default, javascript_default as javascript, node, perfectionist_default as perfectionist, solid, stylistic_default as stylistic, svelte, tailwindcss, typescript_default as typescript, unicorn_default as unicorn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lichthagel/eslint-config",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Licht's ESLint config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -41,20 +41,20 @@
41
41
  "main": "dist/index.js",
42
42
  "types": "dist/index.d.ts",
43
43
  "dependencies": {
44
- "@eslint/js": "^9.11.1",
44
+ "@eslint/js": "^10.0.0",
45
45
  "@stylistic/eslint-plugin": "^5.0.0",
46
- "eslint-plugin-perfectionist": "^4.0.0",
47
- "eslint-plugin-unicorn": "^60.0.0",
48
- "globals": "^16.0.0",
46
+ "eslint-plugin-perfectionist": "^5.0.0",
47
+ "eslint-plugin-unicorn": "^64.0.0",
48
+ "globals": "^17.0.0",
49
49
  "typescript-eslint": "^8.7.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@commitlint/cli": "^19.5.0",
53
- "@commitlint/config-conventional": "^19.5.0",
54
- "@commitlint/types": "^19.5.0",
52
+ "@commitlint/cli": "^20.0.0",
53
+ "@commitlint/config-conventional": "^20.0.0",
54
+ "@commitlint/types": "^20.0.0",
55
55
  "@types/eslint-plugin-tailwindcss": "^3.17.0",
56
- "@types/node": "^22.7.4",
57
- "eslint": "^9.11.1",
56
+ "@types/node": "^24.0.0",
57
+ "eslint": "^10.0.0",
58
58
  "eslint-plugin-n": "^17.10.3",
59
59
  "eslint-plugin-solid": "^0.14.3",
60
60
  "eslint-plugin-svelte": "^3.0.0",
@@ -64,10 +64,10 @@
64
64
  "jiti": "^2.4.2",
65
65
  "lint-staged": "^16.0.0",
66
66
  "svelte": "^5.12.0",
67
- "tsup": "^8.3.0",
67
+ "tsdown": "^0.21.0",
68
68
  "tsx": "^4.19.1",
69
- "typescript": "^5.6.2",
70
- "vitest": "^3.0.0"
69
+ "typescript": "^6.0.0",
70
+ "vitest": "^4.0.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "eslint": ">=8.40.0",
@@ -91,9 +91,9 @@
91
91
  }
92
92
  },
93
93
  "scripts": {
94
- "build": "pnpm run typegen && tsup --format esm,cjs --clean --dts",
94
+ "build": "pnpm run typegen && tsdown",
95
95
  "typegen": "tsx scripts/typegen.ts",
96
- "watch": "tsup --format esm,cjs --watch",
96
+ "watch": "tsdown --format esm,cjs --watch",
97
97
  "test": "vitest",
98
98
  "lint": "eslint .",
99
99
  "inspect": "pnpx @eslint/config-inspector"