@will-stone/eslint-config 26.2.0 → 27.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/README.md CHANGED
@@ -28,7 +28,7 @@ plugin.
28
28
  // eslint.config.js
29
29
  import config from '@will-stone/eslint-config'
30
30
 
31
- export default config()
31
+ export default config({ cwd: import.meta.dirname })
32
32
  ```
33
33
 
34
34
  ### Add script for package.json
package/dist/index.d.ts CHANGED
@@ -9,13 +9,17 @@ import { TSESLint } from '@typescript-eslint/utils';
9
9
  * @param extraConfigs - Each extra argument is an optional Flat Config.
10
10
  * @returns An array of ESLint Flat Configs.
11
11
  */
12
- declare const config: (options?: Options, ...extraConfigs: (TSESLint.FlatConfig.Config | Linter.Config)[]) => Promise<(TSESLint.FlatConfig.Config | Linter.Config)[]>;
12
+ declare const config: (options: Options, ...extraConfigs: (TSESLint.FlatConfig.Config | Linter.Config)[]) => Promise<(TSESLint.FlatConfig.Config | Linter.Config)[]>;
13
13
  export default config;
14
14
 
15
15
  /**
16
16
  * This is a set of optional features that can be turned on.
17
17
  */
18
18
  declare type Options = {
19
+ /**
20
+ * Set this to `import.meta.dirname` as some IDEs look for deps in the wrong directory.
21
+ */
22
+ cwd: string;
19
23
  astro?: boolean;
20
24
  react?: boolean;
21
25
  tailwind?: {
package/dist/index.js CHANGED
@@ -1,25 +1,26 @@
1
1
  import b from "typescript-eslint";
2
2
  import g from "@typescript-eslint/parser";
3
3
  import h from "confusing-browser-globals";
4
- import c from "globals";
4
+ import p 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
8
  import D from "eslint-plugin-package-json";
9
- import O from "eslint-plugin-perfectionist";
10
- import _ from "@stylistic/eslint-plugin";
9
+ import _ from "eslint-plugin-perfectionist";
10
+ import O 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";
14
14
  import { readFileSync as E } from "node:fs";
15
- import L from "debug";
16
- const i = "?([cm])[jt]s?(x)", d = `**/*.${i}`, j = "**/*.?([cm])ts", x = "**/*.?([cm])tsx", A = [
17
- `**/__tests__/**/*.${i}`,
18
- `**/*.spec.${i}`,
19
- `**/*.test.${i}`,
20
- `**/*.bench.${i}`,
21
- `**/*.benchmark.${i}`
22
- ], S = "**/*.astro", T = "**/*.astro/*.ts", B = "**/*.{jsx,tsx,astro}", I = [
15
+ import L from "node:path";
16
+ import A from "debug";
17
+ const c = "?([cm])[jt]s?(x)", d = `**/*.${c}`, j = "**/*.?([cm])ts", x = "**/*.?([cm])tsx", S = [
18
+ `**/__tests__/**/*.${c}`,
19
+ `**/*.spec.${c}`,
20
+ `**/*.test.${c}`,
21
+ `**/*.bench.${c}`,
22
+ `**/*.benchmark.${c}`
23
+ ], T = "**/*.astro", B = "**/*.astro/*.ts", I = "**/*.{jsx,tsx,astro}", G = [
23
24
  "**/node_modules",
24
25
  "**/dist",
25
26
  "**/package-lock.json",
@@ -49,14 +50,14 @@ async function s(r) {
49
50
  const e = await r;
50
51
  return e.default || e;
51
52
  }
52
- async function G(r) {
53
+ async function K(r) {
53
54
  const [e, o] = await Promise.all([
54
55
  s(import("eslint-plugin-astro")),
55
56
  s(import("astro-eslint-parser"))
56
57
  ]);
57
58
  return [
58
59
  {
59
- files: [S],
60
+ files: [T],
60
61
  languageOptions: {
61
62
  globals: e.environments.astro.globals,
62
63
  parser: o,
@@ -134,13 +135,13 @@ async function G(r) {
134
135
  }
135
136
  ];
136
137
  }
137
- function K() {
138
+ function $() {
138
139
  return [
139
140
  {
140
141
  languageOptions: {
141
142
  globals: {
142
- ...c.browser,
143
- ...c.es2021
143
+ ...p.browser,
144
+ ...p.es2021
144
145
  }
145
146
  },
146
147
  linterOptions: {
@@ -399,10 +400,10 @@ function K() {
399
400
  }
400
401
  ];
401
402
  }
402
- function $() {
403
+ function R() {
403
404
  return [
404
405
  {
405
- ignores: I,
406
+ ignores: G,
406
407
  name: "will-stone/ignores"
407
408
  },
408
409
  {
@@ -414,7 +415,7 @@ function $() {
414
415
  }
415
416
  ];
416
417
  }
417
- function R() {
418
+ function U() {
418
419
  return [
419
420
  {
420
421
  files: [j, x],
@@ -503,10 +504,10 @@ function R() {
503
504
  }
504
505
  ];
505
506
  }
506
- function U() {
507
+ function F() {
507
508
  return [
508
509
  {
509
- languageOptions: { globals: c.node },
510
+ languageOptions: { globals: p.node },
510
511
  name: "will-stone/node",
511
512
  plugins: { n: P },
512
513
  rules: {
@@ -558,7 +559,7 @@ function U() {
558
559
  }
559
560
  ];
560
561
  }
561
- function F() {
562
+ function J() {
562
563
  return [
563
564
  {
564
565
  ...D.configs.recommended,
@@ -656,12 +657,12 @@ const y = [
656
657
  type: "natural"
657
658
  }
658
659
  ];
659
- function J() {
660
+ function z() {
660
661
  return [
661
662
  {
662
663
  name: "will-stone/perfectionist",
663
664
  plugins: {
664
- perfectionist: O
665
+ perfectionist: _
665
666
  },
666
667
  rules: {
667
668
  "perfectionist/sort-array-includes": "off",
@@ -690,7 +691,7 @@ function J() {
690
691
  }
691
692
  ];
692
693
  }
693
- async function z(r) {
694
+ async function M(r) {
694
695
  const [e, o, t] = await Promise.all([
695
696
  // @ts-expect-error -- no types
696
697
  s(import("eslint-plugin-jsx-a11y")),
@@ -701,7 +702,7 @@ async function z(r) {
701
702
  {
702
703
  files: [d],
703
704
  languageOptions: {
704
- globals: c.browser,
705
+ globals: p.browser,
705
706
  parserOptions: {
706
707
  ecmaFeatures: {
707
708
  jsx: !0
@@ -958,19 +959,19 @@ async function z(r) {
958
959
  {
959
960
  files: [d],
960
961
  languageOptions: {
961
- globals: c.browser
962
+ globals: p.browser
962
963
  },
963
964
  name: "will-stone/react-hooks",
964
965
  ...t.configs.flat["recommended-latest"]
965
966
  }
966
967
  ];
967
968
  }
968
- function M() {
969
+ function V() {
969
970
  return [
970
971
  {
971
972
  name: "will-stone/style",
972
973
  plugins: {
973
- "@stylistic": _
974
+ "@stylistic": O
974
975
  },
975
976
  rules: {
976
977
  "@stylistic/array-bracket-newline": "off",
@@ -1075,13 +1076,13 @@ function M() {
1075
1076
  }
1076
1077
  ];
1077
1078
  }
1078
- async function V({
1079
+ async function X({
1079
1080
  options: { tailwind: r }
1080
1081
  }) {
1081
1082
  const e = r === !1 || r === !0 ? {} : r, o = await s(import("eslint-plugin-tailwindcss"));
1082
1083
  return [
1083
1084
  {
1084
- files: [B],
1085
+ files: [I],
1085
1086
  name: "will-stone/tailwind",
1086
1087
  plugins: { tailwindcss: o },
1087
1088
  rules: {
@@ -1115,10 +1116,10 @@ for (const r of w.configs["flat/all"])
1115
1116
  for (const [e, o] of Object.entries(r.rules || {}))
1116
1117
  !e.startsWith("@typescript") && // Deprecated rules.
1117
1118
  !["no-new-symbol", "no-return-await"].includes(e) && (v[e] = o);
1118
- function X() {
1119
+ function H() {
1119
1120
  return [
1120
1121
  {
1121
- files: [T, j, x],
1122
+ files: [B, j, x],
1122
1123
  languageOptions: {
1123
1124
  parser: g,
1124
1125
  parserOptions: {
@@ -1304,7 +1305,7 @@ function X() {
1304
1305
  }
1305
1306
  ];
1306
1307
  }
1307
- function H() {
1308
+ function W() {
1308
1309
  return [
1309
1310
  {
1310
1311
  name: "will-stone/unicorn",
@@ -1479,11 +1480,11 @@ function H() {
1479
1480
  }
1480
1481
  ];
1481
1482
  }
1482
- async function W(r) {
1483
+ async function Q(r) {
1483
1484
  const e = await s(import("@vitest/eslint-plugin"));
1484
1485
  return [
1485
1486
  {
1486
- files: A,
1487
+ files: S,
1487
1488
  name: "will-stone/vitest",
1488
1489
  plugins: { vitest: e },
1489
1490
  rules: {
@@ -1581,73 +1582,73 @@ async function W(r) {
1581
1582
  }
1582
1583
  ];
1583
1584
  }
1584
- const Q = [
1585
- { config: $, name: "Ignores" },
1586
- { config: K, name: "Base" },
1587
- { config: H, name: "Unicorn" },
1588
- { config: U, name: "Node" },
1589
- { config: F, name: "package.json" },
1590
- { config: R, name: "JSDoc" },
1591
- { config: M, name: "Style" },
1592
- { config: J, name: "Perfectionist" },
1593
- { config: X, name: "Typescript" }
1585
+ const Y = [
1586
+ { config: R, name: "Ignores" },
1587
+ { config: $, name: "Base" },
1588
+ { config: W, name: "Unicorn" },
1589
+ { config: F, name: "Node" },
1590
+ { config: J, name: "package.json" },
1591
+ { config: U, name: "JSDoc" },
1592
+ { config: V, name: "Style" },
1593
+ { config: z, name: "Perfectionist" },
1594
+ { config: H, name: "Typescript" }
1594
1595
  ], m = [
1595
1596
  {
1596
- config: G,
1597
+ config: K,
1597
1598
  dep: "astro",
1598
1599
  name: "Astro.js",
1599
1600
  optionName: "astro"
1600
1601
  },
1601
1602
  {
1602
- config: z,
1603
+ config: M,
1603
1604
  dep: "react",
1604
1605
  name: "React",
1605
1606
  optionName: "react"
1606
1607
  },
1607
1608
  {
1608
- config: V,
1609
+ config: X,
1609
1610
  dep: "tailwindcss",
1610
1611
  name: "Tailwind",
1611
1612
  optionName: "tailwind"
1612
1613
  },
1613
1614
  {
1614
- config: W,
1615
+ config: Q,
1615
1616
  dep: "vitest",
1616
1617
  name: "Vitest",
1617
1618
  optionName: "vitest"
1618
1619
  }
1619
1620
  ];
1620
- function Y(r) {
1621
- const e = N(["**/package.json", "!**/node_modules/**"]), o = {}, t = () => Object.values(o).every(Boolean);
1622
- for (const a of r)
1623
- o[a] = !1;
1624
- for (const a of e) {
1625
- const p = E(a), l = new TextDecoder().decode(p), f = JSON.parse(l);
1626
- for (const n of r)
1627
- if ((typeof f.dependencies?.[n] == "string" || typeof f.devDependencies?.[n] == "string") && (o[n] = !0, t()))
1621
+ function Z(r, e) {
1622
+ const o = N(["**/package.json", "!**/node_modules/**"], { cwd: e }), t = {}, l = () => Object.values(t).every(Boolean);
1623
+ for (const i of r)
1624
+ t[i] = !1;
1625
+ for (const i of o) {
1626
+ const f = E(L.join(e, i)), u = new TextDecoder().decode(f), n = JSON.parse(u);
1627
+ for (const a of r)
1628
+ if ((typeof n.dependencies?.[a] == "string" || typeof n.devDependencies?.[a] == "string") && (t[a] = !0, l()))
1628
1629
  break;
1629
- if (t())
1630
+ if (l())
1630
1631
  break;
1631
1632
  }
1632
- return o;
1633
+ return t;
1633
1634
  }
1634
- const Z = L("eslint:ws"), ee = {};
1635
- async function re(r = ee) {
1636
- const e = [], o = Object.values(m).map(({ dep: n }) => n), t = Y(o), a = m.filter(({ dep: n, optionName: u }) => (
1635
+ const ee = A("eslint:ws");
1636
+ async function re(r) {
1637
+ const e = [], o = Object.values(m).map(({ dep: n }) => n), t = Z(o, r.cwd), l = m.filter(({ dep: n, optionName: a }) => (
1637
1638
  // Is forced on.
1638
- !!r[u] || // Is present and not forced off.
1639
- t[n] && r[u] !== !1
1640
- )), p = {
1639
+ !!r[a] || // Is present and not forced off.
1640
+ t[n] && r[a] !== !1
1641
+ )), i = {
1641
1642
  options: r
1642
1643
  };
1643
- for (const n of Q)
1644
- e.push(n.config(p));
1645
- const l = await Promise.all(
1646
- a.map(async (n) => (Z(`Auto-configured ${n.name} plugin`), n.config(p)))
1644
+ for (const n of Y)
1645
+ e.push(n.config(i));
1646
+ const f = await Promise.all(
1647
+ l.map(async (n) => (ee(`Auto-configured ${n.name} plugin`), n.config(i)))
1647
1648
  );
1648
- return e.push(...l), e.flat();
1649
+ return e.push(...f), e.flat();
1649
1650
  }
1650
- const we = async (r, ...e) => b.config(await re(r), ...e);
1651
+ const je = async (r, ...e) => b.config(await re(r), ...e);
1651
1652
  export {
1652
- we as default
1653
+ je as default
1653
1654
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@will-stone/eslint-config",
3
- "version": "26.2.0",
3
+ "version": "27.0.0",
4
4
  "description": "Will Stone's ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config"
@@ -52,9 +52,9 @@
52
52
  "typescript-eslint": "^8.55.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@commits-with-character/conventional-changelog-preset": "^5.1.1",
55
+ "@commits-with-character/conventional-changelog-preset": "^6.0.0",
56
56
  "@eslint/config-inspector": "^1.4.2",
57
- "@release-it/conventional-changelog": "^10.0.5",
57
+ "@release-it/conventional-changelog": "^11.0.0",
58
58
  "@types/eslint-plugin-tailwindcss": "^3.17.0",
59
59
  "@types/node": "^24.10.13",
60
60
  "@typescript-eslint/utils": "^8.55.0",
@@ -72,7 +72,7 @@
72
72
  "lint-staged": "^16.2.7",
73
73
  "memfs": "^4.56.10",
74
74
  "prettier": "^3.8.1",
75
- "release-it": "^19.2.4",
75
+ "release-it": "^20.0.1",
76
76
  "typescript": "^5.9.3",
77
77
  "vite": "^7.3.1",
78
78
  "vite-plugin-dts": "^4.5.4",