@kitschpatrol/eslint-config 5.0.8 → 5.2.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 CHANGED
@@ -627,6 +627,7 @@ var source_default = chalk;
627
627
 
628
628
  // ../../src/command-builder.ts
629
629
  import { cosmiconfig } from "cosmiconfig";
630
+ import { TypeScriptLoader as typeScriptLoader } from "cosmiconfig-typescript-loader";
630
631
  import { execa } from "execa";
631
632
  import fse2 from "fs-extra";
632
633
  import fs3 from "node:fs";
@@ -5551,7 +5552,7 @@ var Yargs = YargsFactory(esm_default);
5551
5552
  var yargs_default = Yargs;
5552
5553
 
5553
5554
  // ../../package.json
5554
- var version = "5.0.8";
5555
+ var version = "5.2.0";
5555
5556
 
5556
5557
  // ../../src/execa-utilities.ts
5557
5558
  function isErrorExecaError(error) {
@@ -6180,6 +6181,14 @@ function getCosmiconfigCommand(configName) {
6180
6181
  }
6181
6182
  async function getCosmiconfigResult(configName) {
6182
6183
  const explorer = cosmiconfig(configName, {
6184
+ loaders: {
6185
+ // Using the alternate typescript loader fixes ERR_MODULE_NOT_FOUND errors
6186
+ // in configuration files that import modules via a path
6187
+ // https://github.com/cosmiconfig/cosmiconfig/issues/345
6188
+ // https://github.com/Codex-/cosmiconfig-typescript-loader
6189
+ // Same approach taken in mdat's implementation...
6190
+ ".ts": typeScriptLoader()
6191
+ },
6183
6192
  searchStrategy: "project"
6184
6193
  // Alt approach?
6185
6194
  // searchStrategy: 'global',
package/dist/index.d.ts CHANGED
@@ -3338,12 +3338,12 @@ interface RuleOptions {
3338
3338
  */
3339
3339
  'react-hooks-extra/prefer-use-state-lazy-initialization'?: Linter.RuleEntry<[]>
3340
3340
  /**
3341
- * enforce component naming convention to 'PascalCase' or 'CONSTANT_CASE'
3341
+ * enforce naming convention for components
3342
3342
  * @see https://eslint-react.xyz/docs/rules/naming-convention-component-name
3343
3343
  */
3344
3344
  'react-naming-convention/component-name'?: Linter.RuleEntry<ReactNamingConventionComponentName>
3345
3345
  /**
3346
- * enforce context name to end with `Context`.
3346
+ * enforce context name to be a valid component name with the suffix 'Context'
3347
3347
  * @see https://eslint-react.xyz/docs/rules/naming-convention-context-name
3348
3348
  */
3349
3349
  'react-naming-convention/context-name'?: Linter.RuleEntry<[]>
@@ -3413,7 +3413,7 @@ interface RuleOptions {
3413
3413
  */
3414
3414
  'react/no-access-state-in-setstate'?: Linter.RuleEntry<[]>
3415
3415
  /**
3416
- * disallow using Array index as 'key'
3416
+ * disallow using an item's index in the array as its key
3417
3417
  * @see https://eslint-react.xyz/docs/rules/no-array-index-key
3418
3418
  */
3419
3419
  'react/no-array-index-key'?: Linter.RuleEntry<[]>
@@ -18271,6 +18271,8 @@ type TsExplicitModuleBoundaryTypes =
18271
18271
 
18272
18272
  allowHigherOrderFunctions?: boolean
18273
18273
 
18274
+ allowOverloadFunctions?: boolean
18275
+
18274
18276
  allowTypedFunctionExpressions?: boolean
18275
18277
  },
18276
18278
  ]
@@ -21761,6 +21763,8 @@ type TsUnifiedSignatures =
21761
21763
  | [
21762
21764
  {
21763
21765
  ignoreDifferentlyNamedParameters?: boolean
21766
+
21767
+ ignoreOverloadsWithDifferentJSDoc?: boolean
21764
21768
  },
21765
21769
  ]
21766
21770
  // ----- unicode-bom -----
@@ -22835,12 +22839,12 @@ declare function toArray<T>(value: T | T[]): T[];
22835
22839
  * Generates a Perfectionist sort configuration object from an array of strings
22836
22840
  * @see https://perfectionist.dev/rules/sort-objects#useconfigurationif
22837
22841
  * @param strings - Array of strings to generate config from
22838
- * @param options - Configuration options
22839
- * @param options.matchTrailing - Whether to match end of object parameter name instead of start, useful to sort based on suffixes
22842
+ * @param matchType - How to match the strings:
22843
+ * - 'exact': Match exact name (default)
22844
+ * - 'leading': Match start of name (prefix)
22845
+ * - 'trailing': Match end of name (suffix)
22840
22846
  */
22841
- declare function generatePerfectionistSortConfig(strings: string[], options?: {
22842
- matchTrailing?: boolean;
22843
- }): {
22847
+ declare function generatePerfectionistSortConfig(strings: string[], matchType?: 'exact' | 'leading' | 'trailing'): {
22844
22848
  customGroups: Record<string, string>;
22845
22849
  groups: string[];
22846
22850
  useConfigurationIf: {
package/dist/index.js CHANGED
@@ -1351,6 +1351,8 @@ var reactRecommendedTypeCheckedRules = {
1351
1351
  "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1352
1352
  "react-hooks-extra/no-useless-custom-hooks": "warn",
1353
1353
  "react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
1354
+ "react-naming-convention/context-name": "warn",
1355
+ "react-naming-convention/use-state": "warn",
1354
1356
  "react-dom/no-unknown-property": "off",
1355
1357
  "react/no-leaked-conditional-rendering": "warn"
1356
1358
  // End expansion
@@ -2302,13 +2304,40 @@ function renameRules(rules, map) {
2302
2304
  function toArray(value) {
2303
2305
  return Array.isArray(value) ? value : [value];
2304
2306
  }
2305
- function generatePerfectionistSortConfig(strings, options) {
2307
+ function generatePerfectionistSortConfig(strings, matchType = "exact") {
2306
2308
  const customGroups = {};
2307
2309
  for (const string of strings) {
2308
- customGroups[string] = options?.matchTrailing ? `^.*${string}$` : `^${string}$`;
2310
+ switch (matchType) {
2311
+ case "exact": {
2312
+ customGroups[string] = `^${string}$`;
2313
+ break;
2314
+ }
2315
+ case "leading": {
2316
+ customGroups[string] = `^${string}.*$`;
2317
+ break;
2318
+ }
2319
+ case "trailing": {
2320
+ customGroups[string] = `^.*${string}$`;
2321
+ break;
2322
+ }
2323
+ }
2309
2324
  }
2310
2325
  const exactMatch = strings.join("|");
2311
- const pattern = options?.matchTrailing ? `^.+(${strings.map((s) => s).join("|")})$` : `^${exactMatch}$`;
2326
+ let pattern;
2327
+ switch (matchType) {
2328
+ case "exact": {
2329
+ pattern = `^(${exactMatch})$`;
2330
+ break;
2331
+ }
2332
+ case "leading": {
2333
+ pattern = `^(${strings.join("|")}).*$`;
2334
+ break;
2335
+ }
2336
+ case "trailing": {
2337
+ pattern = `^.*(${strings.join("|")})$`;
2338
+ break;
2339
+ }
2340
+ }
2312
2341
  return {
2313
2342
  customGroups,
2314
2343
  groups: strings,
@@ -2378,9 +2407,12 @@ var sharedScriptConfig = {
2378
2407
  "import/default": "off",
2379
2408
  // Cope with Astro virtual modules
2380
2409
  // https://github.com/hannoeru/vite-plugin-pages/issues/41#issuecomment-1371880072
2381
- "import/no-unresolved": ["error", { ignore: ["^astro:"] }],
2410
+ "import/no-unresolved": ["error", { ignore: ["^astro:", "^@astrojs"] }],
2382
2411
  "import/order": "off",
2383
2412
  // Conflicts with perfectionist/sort-imports (but never enabled)
2413
+ // Knip workaround to ignore unused exported class members:
2414
+ // https://github.com/webpro-nl/knip/issues/158#issuecomment-1632648598
2415
+ "jsdoc/check-tag-names": ["error", { definedTags: ["public"] }],
2384
2416
  "jsdoc/require-description": ["error", { descriptionStyle: "body" }],
2385
2417
  "jsdoc/require-jsdoc": [
2386
2418
  "error",
@@ -2414,19 +2446,28 @@ var sharedScriptConfig = {
2414
2446
  "perfectionist/sort-modules": "off",
2415
2447
  "perfectionist/sort-objects": [
2416
2448
  "error",
2417
- generatePerfectionistSortConfig(["X", "Y", "Z", "W"], { matchTrailing: true }),
2418
- generatePerfectionistSortConfig(["Min", "Max"], { matchTrailing: true }),
2419
- generatePerfectionistSortConfig(["Width", "Height"], { matchTrailing: true }),
2420
2449
  generatePerfectionistSortConfig(["r", "g", "b"]),
2450
+ generatePerfectionistSortConfig(["R", "G", "B"], "trailing"),
2451
+ generatePerfectionistSortConfig(["red", "green", "blue"]),
2452
+ generatePerfectionistSortConfig(["Red", "Green", "Blue"], "trailing"),
2421
2453
  generatePerfectionistSortConfig(["h", "s", "l"]),
2454
+ generatePerfectionistSortConfig(["hue", "saturation", "lightness"]),
2422
2455
  generatePerfectionistSortConfig(["h", "s", "l", "a"]),
2456
+ generatePerfectionistSortConfig(["hue", "saturation", "lightness", "alpha"]),
2423
2457
  generatePerfectionistSortConfig(["h", "s", "v"]),
2424
2458
  generatePerfectionistSortConfig(["a", "b"]),
2425
2459
  // For partial matches...
2426
2460
  generatePerfectionistSortConfig(["r", "g", "b", "a"]),
2461
+ generatePerfectionistSortConfig(["red", "green", "blue", "alpha"]),
2462
+ generatePerfectionistSortConfig(["Red", "Green", "Blue", "Alpha"], "trailing"),
2427
2463
  generatePerfectionistSortConfig(["x", "y", "z", "w"]),
2464
+ generatePerfectionistSortConfig(["X", "Y", "Z", "W"], "trailing"),
2428
2465
  generatePerfectionistSortConfig(["min", "max"]),
2466
+ generatePerfectionistSortConfig(["min", "max"], "leading"),
2467
+ generatePerfectionistSortConfig(["Min", "Max"], "trailing"),
2429
2468
  generatePerfectionistSortConfig(["width", "height"]),
2469
+ generatePerfectionistSortConfig(["width", "height"], "leading"),
2470
+ generatePerfectionistSortConfig(["Width", "Height"], "trailing"),
2430
2471
  { newlinesBetween: "never", order: "asc", type: "natural" }
2431
2472
  ],
2432
2473
  "sort-imports": "off",
@@ -2488,6 +2529,31 @@ var sharedScriptConfig = {
2488
2529
  // },
2489
2530
  ],
2490
2531
  "ts/no-non-null-assertion": "off",
2532
+ "ts/no-restricted-types": [
2533
+ "error",
2534
+ {
2535
+ types: {
2536
+ "[[[[[]]]]]": "Don't use `[[[[[]]]]]`. Use `SomeType[][][][][]` instead.",
2537
+ "[[[[]]]]": "Don't use `[[[[]]]]`. Use `SomeType[][][][]` instead.",
2538
+ "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead.",
2539
+ "[[]]": "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.",
2540
+ "[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
2541
+ // eslint-disable-next-line ts/naming-convention
2542
+ Buffer: {
2543
+ message: "Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer",
2544
+ suggest: ["Uint8Array"]
2545
+ },
2546
+ null: {
2547
+ message: "Use `undefined` instead. See: https://github.com/sindresorhus/meta/issues/7",
2548
+ suggest: ["undefined"]
2549
+ },
2550
+ object: {
2551
+ message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
2552
+ suggest: ["Record<string, unknown>"]
2553
+ }
2554
+ }
2555
+ }
2556
+ ],
2491
2557
  "ts/no-unused-vars": [
2492
2558
  "error",
2493
2559
  {
@@ -2529,7 +2595,9 @@ var sharedScriptConfig = {
2529
2595
  sep: false,
2530
2596
  // Present in node:path library
2531
2597
  src: false,
2532
- temp: false
2598
+ temp: false,
2599
+ util: false,
2600
+ utils: false
2533
2601
  }
2534
2602
  }
2535
2603
  ]
@@ -3725,6 +3793,15 @@ async function svelte(options = {}) {
3725
3793
  // Error often imported from from '@sveltejs/kit in SvelteKit files
3726
3794
  "ts/no-throw-literal": "off"
3727
3795
  }
3796
+ },
3797
+ {
3798
+ // SvelteKit and Vite project templates bootstrap with some deviant HTML
3799
+ files: ["src/app.html"],
3800
+ rules: {
3801
+ "html/no-inline-styles": "off",
3802
+ "html/no-non-scalable-viewport": "off",
3803
+ "html/require-title": "off"
3804
+ }
3728
3805
  }
3729
3806
  ];
3730
3807
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitschpatrol/eslint-config",
3
- "version": "5.0.8",
3
+ "version": "5.2.0",
4
4
  "description": "ESLint configuration for @kitschpatrol/shared-config.",
5
5
  "keywords": [
6
6
  "shared-config",
@@ -42,12 +42,12 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
45
- "@eslint-react/eslint-plugin": "^1.29.0",
45
+ "@eslint-react/eslint-plugin": "^1.30.0",
46
46
  "@html-eslint/eslint-plugin": "^0.35.0",
47
47
  "@html-eslint/parser": "^0.35.0",
48
48
  "@pinojs/json-colorizer": "^4.0.0",
49
- "@typescript-eslint/eslint-plugin": "^8.25.0",
50
- "@typescript-eslint/parser": "^8.25.0",
49
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
50
+ "@typescript-eslint/parser": "^8.26.0",
51
51
  "@vitest/eslint-plugin": "^1.1.36",
52
52
  "astro-eslint-parser": "^1.2.1",
53
53
  "eslint": "^9.21.0",
@@ -77,8 +77,8 @@
77
77
  "fs-extra": "^11.3.0",
78
78
  "globals": "^16.0.0",
79
79
  "jsonc-eslint-parser": "^2.4.0",
80
- "local-pkg": "^1.1.0",
81
- "prettier": "^3.5.2",
80
+ "local-pkg": "^1.1.1",
81
+ "prettier": "^3.5.3",
82
82
  "sort-package-json": "^2.15.1",
83
83
  "svelte-eslint-parser": "^1.0.0",
84
84
  "toml-eslint-parser": "^0.10.0",
@@ -92,7 +92,7 @@
92
92
  "eslint-config-xo-typescript": "^7.0.0",
93
93
  "eslint-typegen": "^2.0.0",
94
94
  "globby": "^14.1.0",
95
- "svelte": "^5.20.5",
95
+ "svelte": "^5.21.0",
96
96
  "tsup": "^8.4.0"
97
97
  },
98
98
  "engines": {