@will-stone/eslint-config 25.2.1 → 26.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +82 -70
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -5,9 +5,9 @@ import c from "globals";
5
5
  import k from "eslint-config-flat-gitignore";
6
6
  import q from "eslint-plugin-jsdoc";
7
7
  import P from "eslint-plugin-n";
8
- import O from "eslint-plugin-package-json";
9
- import _ from "eslint-plugin-perfectionist";
10
- import D from "@stylistic/eslint-plugin";
8
+ import D from "eslint-plugin-package-json";
9
+ import O from "eslint-plugin-perfectionist";
10
+ import _ from "@stylistic/eslint-plugin";
11
11
  import w from "@typescript-eslint/eslint-plugin";
12
12
  import C from "eslint-plugin-unicorn";
13
13
  import { globbySync as N } from "globby";
@@ -19,7 +19,7 @@ const i = "?([cm])[jt]s?(x)", d = `**/*.${i}`, j = "**/*.?([cm])ts", x = "**/*.?
19
19
  `**/*.test.${i}`,
20
20
  `**/*.bench.${i}`,
21
21
  `**/*.benchmark.${i}`
22
- ], T = "**/*.astro", A = "**/*.astro/*.ts", I = "**/*.{jsx,tsx,astro}", B = [
22
+ ], T = "**/*.astro", A = "**/*.astro/*.ts", B = "**/*.{jsx,tsx,astro}", I = [
23
23
  "**/node_modules",
24
24
  "**/dist",
25
25
  "**/package-lock.json",
@@ -349,8 +349,20 @@ function K() {
349
349
  // Can cause issues when Prettier is enabled
350
350
  "prefer-arrow-callback": "off",
351
351
  "prefer-const": "warn",
352
- // Make compatible with Unicorn's no-unreadable-array-destructuring
353
- "prefer-destructuring": ["warn", { array: !1, object: !0 }],
352
+ "prefer-destructuring": [
353
+ "error",
354
+ {
355
+ AssignmentExpression: {
356
+ array: !1,
357
+ object: !1
358
+ },
359
+ VariableDeclarator: {
360
+ // Make compatible with Unicorn's no-unreadable-array-destructuring.
361
+ array: !1,
362
+ object: !0
363
+ }
364
+ }
365
+ ],
354
366
  "prefer-exponentiation-operator": "warn",
355
367
  "prefer-named-capture-group": "off",
356
368
  "prefer-numeric-literals": "warn",
@@ -390,7 +402,7 @@ function K() {
390
402
  function $() {
391
403
  return [
392
404
  {
393
- ignores: B,
405
+ ignores: I,
394
406
  name: "will-stone/ignores"
395
407
  },
396
408
  {
@@ -549,7 +561,7 @@ function U() {
549
561
  function F() {
550
562
  return [
551
563
  {
552
- ...O.configs.recommended,
564
+ ...D.configs.recommended,
553
565
  name: "will-stone/package.json",
554
566
  rules: {
555
567
  "package-json/bin-name-casing": "error",
@@ -649,7 +661,7 @@ function J() {
649
661
  {
650
662
  name: "will-stone/perfectionist",
651
663
  plugins: {
652
- perfectionist: _
664
+ perfectionist: O
653
665
  },
654
666
  rules: {
655
667
  "perfectionist/sort-array-includes": "off",
@@ -698,6 +710,7 @@ async function z(r) {
698
710
  },
699
711
  name: "will-stone/react",
700
712
  plugins: {
713
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
701
714
  "jsx-a11y": e,
702
715
  react: o,
703
716
  "react-hooks": t
@@ -957,7 +970,7 @@ function M() {
957
970
  {
958
971
  name: "will-stone/style",
959
972
  plugins: {
960
- "@stylistic": D
973
+ "@stylistic": _
961
974
  },
962
975
  rules: {
963
976
  "@stylistic/array-bracket-newline": "off",
@@ -1065,13 +1078,10 @@ function M() {
1065
1078
  async function V({
1066
1079
  options: { tailwind: r }
1067
1080
  }) {
1068
- const e = !r || r === !0 ? {} : r, o = await s(
1069
- // @ts-expect-error -- no types
1070
- import("eslint-plugin-tailwindcss")
1071
- );
1081
+ const e = r === !1 || r === !0 ? {} : r, o = await s(import("eslint-plugin-tailwindcss"));
1072
1082
  return [
1073
1083
  {
1074
- files: [I],
1084
+ files: [B],
1075
1085
  name: "will-stone/tailwind",
1076
1086
  plugins: { tailwindcss: o },
1077
1087
  rules: {
@@ -1086,7 +1096,7 @@ async function V({
1086
1096
  },
1087
1097
  settings: {
1088
1098
  tailwindcss: {
1089
- config: e.config,
1099
+ config: e?.config,
1090
1100
  /**
1091
1101
  * Default to no custom CSS files, due to performance issue with the
1092
1102
  * plugin can be somewhat mitigated by setting this config to `[]` so
@@ -1094,7 +1104,7 @@ async function V({
1094
1104
  * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/276
1095
1105
  * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/174
1096
1106
  */
1097
- cssFiles: e.cssFiles || []
1107
+ cssFiles: e?.cssFiles || []
1098
1108
  }
1099
1109
  }
1100
1110
  }
@@ -1212,67 +1222,69 @@ function X() {
1212
1222
  /**
1213
1223
  * These require type checking.
1214
1224
  */
1215
- "@typescript-eslint/await-thenable": "off",
1225
+ "@typescript-eslint/await-thenable": "error",
1216
1226
  "@typescript-eslint/consistent-return": "off",
1217
1227
  "@typescript-eslint/consistent-type-exports": "warn",
1218
- "@typescript-eslint/dot-notation": "off",
1228
+ "@typescript-eslint/dot-notation": "warn",
1219
1229
  "@typescript-eslint/naming-convention": "off",
1220
- "@typescript-eslint/no-array-delete": "off",
1221
- "@typescript-eslint/no-base-to-string": "off",
1222
- "@typescript-eslint/no-confusing-void-expression": "off",
1230
+ "@typescript-eslint/no-array-delete": "error",
1231
+ "@typescript-eslint/no-base-to-string": "error",
1232
+ "@typescript-eslint/no-confusing-void-expression": "warn",
1223
1233
  "@typescript-eslint/no-deprecated": "off",
1224
- "@typescript-eslint/no-duplicate-type-constituents": "off",
1225
- "@typescript-eslint/no-floating-promises": "off",
1226
- "@typescript-eslint/no-for-in-array": "off",
1227
- "@typescript-eslint/no-implied-eval": "off",
1234
+ "@typescript-eslint/no-duplicate-type-constituents": "warn",
1235
+ "@typescript-eslint/no-floating-promises": "error",
1236
+ "@typescript-eslint/no-for-in-array": "error",
1237
+ "@typescript-eslint/no-implied-eval": "error",
1228
1238
  "@typescript-eslint/no-meaningless-void-operator": "warn",
1229
1239
  "@typescript-eslint/no-misused-promises": "off",
1230
- "@typescript-eslint/no-misused-spread": "off",
1231
- "@typescript-eslint/no-mixed-enums": "off",
1232
- "@typescript-eslint/no-redundant-type-constituents": "off",
1233
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
1234
- "@typescript-eslint/no-unnecessary-condition": "off",
1235
- "@typescript-eslint/no-unnecessary-qualifier": "off",
1240
+ "@typescript-eslint/no-misused-spread": "error",
1241
+ "@typescript-eslint/no-mixed-enums": "error",
1242
+ "@typescript-eslint/no-redundant-type-constituents": "error",
1243
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
1244
+ "@typescript-eslint/no-unnecessary-condition": "error",
1245
+ "@typescript-eslint/no-unnecessary-qualifier": "warn",
1236
1246
  "@typescript-eslint/no-unnecessary-template-expression": "error",
1237
- "@typescript-eslint/no-unnecessary-type-arguments": "off",
1238
- "@typescript-eslint/no-unnecessary-type-assertion": "off",
1239
- "@typescript-eslint/no-unnecessary-type-conversion": "off",
1247
+ "@typescript-eslint/no-unnecessary-type-arguments": "warn",
1248
+ "@typescript-eslint/no-unnecessary-type-assertion": "warn",
1249
+ "@typescript-eslint/no-unnecessary-type-conversion": "error",
1240
1250
  "@typescript-eslint/no-unnecessary-type-parameters": "error",
1241
- "@typescript-eslint/no-unsafe-argument": "off",
1242
- "@typescript-eslint/no-unsafe-assignment": "off",
1243
- "@typescript-eslint/no-unsafe-call": "off",
1244
- "@typescript-eslint/no-unsafe-enum-comparison": "off",
1245
- "@typescript-eslint/no-unsafe-member-access": "off",
1246
- "@typescript-eslint/no-unsafe-return": "off",
1251
+ "@typescript-eslint/no-unsafe-argument": "error",
1252
+ "@typescript-eslint/no-unsafe-assignment": "error",
1253
+ "@typescript-eslint/no-unsafe-call": "error",
1254
+ "@typescript-eslint/no-unsafe-enum-comparison": "error",
1255
+ "@typescript-eslint/no-unsafe-member-access": "error",
1256
+ "@typescript-eslint/no-unsafe-return": "error",
1257
+ // All assertions are unsafe and this makes it more difficult to cast.
1247
1258
  "@typescript-eslint/no-unsafe-type-assertion": "off",
1248
- "@typescript-eslint/no-unsafe-unary-minus": "off",
1249
- "@typescript-eslint/no-useless-default-assignment": "off",
1250
- "@typescript-eslint/non-nullable-type-assertion-style": "off",
1251
- "@typescript-eslint/only-throw-error": "off",
1252
- "@typescript-eslint/prefer-destructuring": "off",
1253
- "@typescript-eslint/prefer-find": "off",
1254
- "@typescript-eslint/prefer-includes": "off",
1259
+ "@typescript-eslint/no-unsafe-unary-minus": "error",
1260
+ "@typescript-eslint/no-useless-default-assignment": "warn",
1261
+ "@typescript-eslint/non-nullable-type-assertion-style": "warn",
1262
+ "@typescript-eslint/only-throw-error": "error",
1263
+ "@typescript-eslint/prefer-destructuring": ["warn", { array: !1, object: !0 }],
1264
+ "@typescript-eslint/prefer-find": "error",
1265
+ "@typescript-eslint/prefer-includes": "warn",
1255
1266
  "@typescript-eslint/prefer-nullish-coalescing": "off",
1256
- "@typescript-eslint/prefer-optional-chain": "off",
1257
- "@typescript-eslint/prefer-promise-reject-errors": "off",
1258
- "@typescript-eslint/prefer-readonly": "off",
1267
+ "@typescript-eslint/prefer-optional-chain": "warn",
1268
+ "@typescript-eslint/prefer-promise-reject-errors": "error",
1269
+ "@typescript-eslint/prefer-readonly": "warn",
1270
+ // Typing all args as readonly is tiresome.
1259
1271
  "@typescript-eslint/prefer-readonly-parameter-types": "off",
1260
- "@typescript-eslint/prefer-reduce-type-parameter": "off",
1272
+ "@typescript-eslint/prefer-reduce-type-parameter": "warn",
1261
1273
  "@typescript-eslint/prefer-regexp-exec": "off",
1262
- "@typescript-eslint/prefer-return-this-type": "off",
1263
- "@typescript-eslint/prefer-string-starts-ends-with": "off",
1264
- "@typescript-eslint/promise-function-async": "off",
1265
- "@typescript-eslint/related-getter-setter-pairs": "off",
1266
- "@typescript-eslint/require-array-sort-compare": "off",
1267
- "@typescript-eslint/require-await": "off",
1268
- "@typescript-eslint/restrict-plus-operands": "off",
1269
- "@typescript-eslint/restrict-template-expressions": "off",
1270
- "@typescript-eslint/return-await": "off",
1271
- "@typescript-eslint/strict-boolean-expressions": "off",
1272
- "@typescript-eslint/strict-void-return": "off",
1273
- "@typescript-eslint/switch-exhaustiveness-check": "off",
1274
- "@typescript-eslint/unbound-method": "off",
1275
- "@typescript-eslint/use-unknown-in-catch-callback-variable": "off"
1274
+ "@typescript-eslint/prefer-return-this-type": "warn",
1275
+ "@typescript-eslint/prefer-string-starts-ends-with": "warn",
1276
+ "@typescript-eslint/promise-function-async": "warn",
1277
+ "@typescript-eslint/related-getter-setter-pairs": "error",
1278
+ "@typescript-eslint/require-array-sort-compare": "error",
1279
+ "@typescript-eslint/require-await": "error",
1280
+ "@typescript-eslint/restrict-plus-operands": "error",
1281
+ "@typescript-eslint/restrict-template-expressions": "error",
1282
+ "@typescript-eslint/return-await": "warn",
1283
+ "@typescript-eslint/strict-boolean-expressions": "error",
1284
+ "@typescript-eslint/strict-void-return": "error",
1285
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
1286
+ "@typescript-eslint/unbound-method": "error",
1287
+ "@typescript-eslint/use-unknown-in-catch-callback-variable": "error"
1276
1288
  }
1277
1289
  }
1278
1290
  ];
@@ -1597,7 +1609,7 @@ function Y(r) {
1597
1609
  for (const a of e) {
1598
1610
  const p = L(a), l = new TextDecoder().decode(p), f = JSON.parse(l);
1599
1611
  for (const n of r)
1600
- if (f && (f.dependencies?.[n] || f.devDependencies?.[n]) && (o[n] = !0, t()))
1612
+ if ((typeof f.dependencies?.[n] == "string" || typeof f.devDependencies?.[n] == "string") && (o[n] = !0, t()))
1601
1613
  break;
1602
1614
  if (t())
1603
1615
  break;
@@ -1608,15 +1620,15 @@ const Z = E("eslint:ws"), ee = {};
1608
1620
  async function re(r = ee) {
1609
1621
  const e = [], o = Object.values(m).map(({ dep: n }) => n), t = Y(o), a = m.filter(({ dep: n, optionName: u }) => (
1610
1622
  // Is forced on.
1611
- r?.[u] || // Is present and not forced off.
1612
- t[n] && r?.[u] !== !1
1623
+ !!r[u] || // Is present and not forced off.
1624
+ t[n] && r[u] !== !1
1613
1625
  )), p = {
1614
1626
  options: r
1615
1627
  };
1616
1628
  for (const n of Q)
1617
1629
  e.push(n.config(p));
1618
1630
  const l = await Promise.all(
1619
- a.map((n) => (Z(`Auto-configured ${n.name} plugin`), n.config(p)))
1631
+ a.map(async (n) => (Z(`Auto-configured ${n.name} plugin`), n.config(p)))
1620
1632
  );
1621
1633
  return e.push(...l), e.flat();
1622
1634
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@will-stone/eslint-config",
3
- "version": "25.2.1",
3
+ "version": "26.0.1",
4
4
  "description": "Will Stone's ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config"
@@ -55,6 +55,7 @@
55
55
  "@commits-with-character/conventional-changelog-preset": "^5.1.1",
56
56
  "@eslint/config-inspector": "^1.4.2",
57
57
  "@release-it/conventional-changelog": "^10.0.5",
58
+ "@types/eslint-plugin-tailwindcss": "^3.17.0",
58
59
  "@types/node": "^24.10.13",
59
60
  "@typescript-eslint/utils": "^8.55.0",
60
61
  "@vitest/eslint-plugin": "^1.6.7",
@@ -106,7 +107,7 @@
106
107
  "optional": true
107
108
  }
108
109
  },
109
- "packageManager": "pnpm@10.29.3",
110
+ "packageManager": "pnpm@10.30.3",
110
111
  "engines": {
111
112
  "node": ">=22"
112
113
  },