@kirill.konshin/lint 0.5.5 → 0.6.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 (91) hide show
  1. package/README.md +38 -3
  2. package/commands/spec-author.md +39 -0
  3. package/dist/configs/base.d.ts +4 -3
  4. package/dist/configs/base.js +61 -74
  5. package/dist/configs/imports.d.ts +3 -2
  6. package/dist/configs/imports.js +95 -146
  7. package/dist/configs/nx.d.ts +4 -3
  8. package/dist/configs/nx.js +31 -41
  9. package/dist/configs/prettier.d.ts +3 -2
  10. package/dist/configs/prettier.js +19 -16
  11. package/dist/configs/promise.d.ts +3 -2
  12. package/dist/configs/promise.js +16 -16
  13. package/dist/configs/react.d.ts +4 -3
  14. package/dist/configs/react.js +178 -217
  15. package/dist/configs/storybook.d.ts +4 -3
  16. package/dist/configs/storybook.js +22 -22
  17. package/dist/configs/tailwind.d.ts +4 -3
  18. package/dist/configs/tailwind.js +67 -91
  19. package/dist/configs/testing.d.ts +7 -6
  20. package/dist/configs/testing.js +112 -146
  21. package/dist/configs/turbo.d.ts +4 -3
  22. package/dist/configs/turbo.js +19 -27
  23. package/dist/configs/typescriptTypeAware.d.ts +4 -3
  24. package/dist/configs/typescriptTypeAware.js +99 -95
  25. package/dist/configs/unicorn.d.ts +3 -2
  26. package/dist/configs/unicorn.js +34 -41
  27. package/dist/exts.d.ts +2 -1
  28. package/dist/exts.js +10 -11
  29. package/dist/index.d.ts +44 -42
  30. package/dist/index.js +53 -85
  31. package/dist/lib.d.ts +21 -21
  32. package/dist/lib.js +262 -301
  33. package/dist/lintPrepare.d.ts +20 -17
  34. package/dist/lintPrepare.js +341 -371
  35. package/dist/lintStaged.d.ts +4 -3
  36. package/dist/lintStaged.js +25 -22
  37. package/dist/prettier.d.ts +4 -3
  38. package/dist/prettier.js +16 -17
  39. package/dist/restrictions.d.ts +11 -10
  40. package/dist/restrictions.js +18 -22
  41. package/dist/yarn.cjs +79 -98
  42. package/dist/yarn.d.cts +3 -2
  43. package/package.json +22 -8
  44. package/rules/agent.md +2 -0
  45. package/rules/openspec.md +1 -1
  46. package/skills/spec-steward/SKILL.md +4 -12
  47. package/skills/spec-steward/references/audit.md +18 -43
  48. package/skills/spec-steward/references/contract.md +9 -9
  49. package/skills/spec-steward/references/criteria.md +4 -4
  50. package/skills/spec-steward/references/review-format.md +6 -6
  51. package/skills/spec-steward/references/wiring.md +2 -2
  52. package/skills/spec-steward/references/worker.md +67 -0
  53. package/skills/spec-steward/sweeps.json +49 -0
  54. package/skills/spec-tools/SKILL.md +48 -0
  55. package/skills/spec-tools/references/contract.md +111 -0
  56. package/skills/spec-tools/references/gitlab.md +120 -0
  57. package/skills/spec-tools/scripts/cli.js +8129 -0
  58. package/skills/spec-verify/SKILL.md +153 -0
  59. package/dist/configs/base.d.ts.map +0 -1
  60. package/dist/configs/imports.d.ts.map +0 -1
  61. package/dist/configs/nx.d.ts.map +0 -1
  62. package/dist/configs/prettier.d.ts.map +0 -1
  63. package/dist/configs/promise.d.ts.map +0 -1
  64. package/dist/configs/react.d.ts.map +0 -1
  65. package/dist/configs/storybook.d.ts.map +0 -1
  66. package/dist/configs/tailwind.d.ts.map +0 -1
  67. package/dist/configs/testing.d.ts.map +0 -1
  68. package/dist/configs/turbo.d.ts.map +0 -1
  69. package/dist/configs/typescriptTypeAware.d.ts.map +0 -1
  70. package/dist/configs/unicorn.d.ts.map +0 -1
  71. package/dist/exts.d.ts.map +0 -1
  72. package/dist/index.d.ts.map +0 -1
  73. package/dist/lib.d.ts.map +0 -1
  74. package/dist/lintPrepare.d.ts.map +0 -1
  75. package/dist/lintStaged.d.ts.map +0 -1
  76. package/dist/prettier.d.ts.map +0 -1
  77. package/dist/restrictions.d.ts.map +0 -1
  78. package/dist/yarn.d.cts.map +0 -1
  79. package/skills/spec-steward/scripts/lib/align.mjs +0 -127
  80. package/skills/spec-steward/scripts/lib/checks.mjs +0 -589
  81. package/skills/spec-steward/scripts/lib/citations.mjs +0 -156
  82. package/skills/spec-steward/scripts/lib/corpus.mjs +0 -256
  83. package/skills/spec-steward/scripts/lib/coverage.mjs +0 -123
  84. package/skills/spec-steward/scripts/lib/evidence.mjs +0 -334
  85. package/skills/spec-steward/scripts/lib/git.mjs +0 -138
  86. package/skills/spec-steward/scripts/lib/review.mjs +0 -347
  87. package/skills/spec-steward/scripts/lib/scan.mjs +0 -364
  88. package/skills/spec-steward/scripts/lib/util.mjs +0 -161
  89. package/skills/spec-steward/scripts/lib/wire.mjs +0 -331
  90. package/skills/spec-steward/scripts/steward.mjs +0 -350
  91. package/skills/spec-steward/workflows/audit.js +0 -539
@@ -1,98 +1,74 @@
1
- import { readFileSync } from 'node:fs';
2
- import { isAbsolute, resolve } from 'node:path';
3
- import { findWorkspaceRoot, GLOBAL_IGNORES, hasTailwind, packageDirOf, scanWorkspace, toolGate } from '../lib.js';
1
+ import { GLOBAL_IGNORES, findWorkspaceRoot, hasTailwind, packageDirOf, scanWorkspace, toolGate } from "../lib.js";
2
+ import { isAbsolute, resolve } from "node:path";
3
+ import { readFileSync } from "node:fs";
4
+ //#region src/configs/tailwind.ts
4
5
  /**
5
- * All Tailwind v4 entry CSS candidates: every `*.css` across the workspace (see `scanWorkspace` -
6
- * the root plus every workspace package, `.gitignore`- and build-output-aware) containing the
7
- * Tailwind v4 marker `@import "tailwindcss"`.
8
- *
9
- */
6
+ * All Tailwind v4 entry CSS candidates: every `*.css` across the workspace (see `scanWorkspace` -
7
+ * the root plus every workspace package, `.gitignore`- and build-output-aware) containing the
8
+ * Tailwind v4 marker `@import "tailwindcss"`.
9
+ *
10
+ */
10
11
  function findTailwindEntries(ignores) {
11
- return scanWorkspace('*.css', ignores).filter((file) => {
12
- try {
13
- return /@import\s+['"]tailwindcss['"]/.test(readFileSync(file, 'utf-8'));
14
- }
15
- catch {
16
- return false;
17
- }
18
- });
12
+ return scanWorkspace("*.css", ignores).filter((file) => {
13
+ try {
14
+ return /@import\s+['"]tailwindcss['"]/.test(readFileSync(file, "utf-8"));
15
+ } catch {
16
+ return false;
17
+ }
18
+ });
19
19
  }
20
20
  /**
21
- * Auto-find THE Tailwind v4 entry CSS ({@link findTailwindEntries} narrowed to exactly one).
22
- *
23
- * eslint-plugin-tailwindcss v4 loads the entry (`settings.tailwindcss.cssConfigPath`) and
24
- * HARD-CRASHES with ENOENT when it can't, so {@link tailwindConfig} only enables the plugin when
25
- * exactly one entry is found (`allowMultiple: false` in its gate spec); with zero or several the
26
- * consumer must configure `cssConfigPath` manually (MANDATORY for the plugin; several candidates
27
- * are a hard error) - see README "Detection".
28
- *
29
- */
30
- export function findTailwindEntry(ignores) {
31
- const entries = findTailwindEntries(ignores);
32
- return entries.length === 1 ? entries[0] : null;
21
+ * Auto-find THE Tailwind v4 entry CSS ({@link findTailwindEntries} narrowed to exactly one).
22
+ *
23
+ * eslint-plugin-tailwindcss v4 loads the entry (`settings.tailwindcss.cssConfigPath`) and
24
+ * HARD-CRASHES with ENOENT when it can't, so {@link tailwindConfig} only enables the plugin when
25
+ * exactly one entry is found (`allowMultiple: false` in its gate spec); with zero or several the
26
+ * consumer must configure `cssConfigPath` manually (MANDATORY for the plugin; several candidates
27
+ * are a hard error) - see README "Detection".
28
+ *
29
+ */
30
+ function findTailwindEntry(ignores) {
31
+ const entries = findTailwindEntries(ignores);
32
+ return entries.length === 1 ? entries[0] : null;
33
33
  }
34
34
  /**
35
- * Tailwind recommended rules (warnings + `no-contradicting-classname` as error) as a standalone
36
- * block (simple to override wholesale).
37
- *
38
- * Auto-detection is driven by the entry CSS (see {@link findTailwindEntries}), not by the package
39
- * probe: explicit `cssConfigPath` wins, otherwise auto-find. Zero entries stays inert in auto mode
40
- * (nothing marks the repo as Tailwind) but fails loudly when Tailwind was FORCED on (`true` /
41
- * options object). SEVERAL entries fail loudly even in auto mode: they prove the repo uses
42
- * Tailwind, the right one cannot be guessed, and a silent skip would be hard to detect - pass
43
- * `cssConfigPath` to pick one. `tailwindcss` must be resolvable from the workspace root (where
44
- * the plugin's theme-loading workers resolve it); a leaf-only install is a hard error with
45
- * hoisting guidance (see `toolGate` in lib.js).
46
- *
47
- */
48
- export async function tailwindConfig(option, strict = false) {
49
- /*
50
- * Detection is evidence-based: the entry CSS marker, NOT the package probe (`needs` makes the
51
- * evidence mandatory in the gate) - in a monorepo `tailwindcss` is often installed only in a
52
- * leaf package and unresolvable from here, while an entry CSS with `@import "tailwindcss"` is
53
- * unambiguous proof of a Tailwind project (`hasTailwind` stays exported for debugging).
54
- */
55
- const { enabled, options, files } = toolGate(option, strict, {
56
- tool: 'tailwind',
57
- has: hasTailwind,
58
- packageName: 'tailwindcss',
59
- needs: {
60
- what: 'entry CSS',
61
- detail: 'single Tailwind v4 entry CSS (a *.css containing `@import "tailwindcss"`, scanned across ' +
62
- 'the workspace root and every workspace package)',
63
- hint: '`tailwind: { cssConfigPath }`',
64
- },
65
- // the plugin takes exactly ONE entry - several scan candidates are a hard error
66
- allowMultiple: false,
67
- // option paths may be relative; the resolution probe needs an absolute file context
68
- absolutizeOptions: ({ cssConfigPath }) => cssConfigPath
69
- ? [isAbsolute(cssConfigPath) ? cssConfigPath : resolve(findWorkspaceRoot(), cssConfigPath)]
70
- : [],
71
- scan: () => findTailwindEntries(GLOBAL_IGNORES),
72
- });
73
- if (!enabled)
74
- return [];
75
- // an explicit path is passed through in the consumer's own notation (the absolutized copy only
76
- // served the probes); an auto-found entry is the absolute evidence file
77
- const cssConfigPath = options.cssConfigPath ?? files[0];
78
- /*
79
- * The entry CSS pins down the ONE package that uses Tailwind, so by default the block is
80
- * scoped to it via `basePath` (ESLint >= 9.30, absolute paths supported) instead of flagging
81
- * class-like strings across the whole workspace. `files[0]` is the absolutized evidence path
82
- * even when `cssConfigPath` was supplied relative. Owning package == workspace root (single-
83
- * package repo, or the entry is not inside a declared workspace package) makes scoping a
84
- * no-op - the block stays untouched.
85
- */
86
- const { scoped = true } = options;
87
- const packageDir = scoped ? packageDirOf(files[0]) : null;
88
- const basePath = packageDir && packageDir !== findWorkspaceRoot() ? { basePath: packageDir } : {};
89
- const tailwindPlugin = (await import('eslint-plugin-tailwindcss')).default;
90
- return [
91
- {
92
- // The plugin still publishes @typescript-eslint's ESLint 9 config types.
93
- ...tailwindPlugin.configs.recommended,
94
- ...basePath,
95
- settings: { tailwindcss: { cssConfigPath } },
96
- },
97
- ];
35
+ * Tailwind recommended rules (warnings + `no-contradicting-classname` as error) as a standalone
36
+ * block (simple to override wholesale).
37
+ *
38
+ * Auto-detection is driven by the entry CSS (see {@link findTailwindEntries}), not by the package
39
+ * probe: explicit `cssConfigPath` wins, otherwise auto-find. Zero entries stays inert in auto mode
40
+ * (nothing marks the repo as Tailwind) but fails loudly when Tailwind was FORCED on (`true` /
41
+ * options object). SEVERAL entries fail loudly even in auto mode: they prove the repo uses
42
+ * Tailwind, the right one cannot be guessed, and a silent skip would be hard to detect - pass
43
+ * `cssConfigPath` to pick one. `tailwindcss` must be resolvable from the workspace root (where
44
+ * the plugin's theme-loading workers resolve it); a leaf-only install is a hard error with
45
+ * hoisting guidance (see `toolGate` in lib.js).
46
+ *
47
+ */
48
+ async function tailwindConfig(option, strict = false) {
49
+ const { enabled, options, files } = toolGate(option, strict, {
50
+ tool: "tailwind",
51
+ has: hasTailwind,
52
+ packageName: "tailwindcss",
53
+ needs: {
54
+ what: "entry CSS",
55
+ detail: "single Tailwind v4 entry CSS (a *.css containing `@import \"tailwindcss\"`, scanned across the workspace root and every workspace package)",
56
+ hint: "`tailwind: { cssConfigPath }`"
57
+ },
58
+ allowMultiple: false,
59
+ absolutizeOptions: ({ cssConfigPath }) => cssConfigPath ? [isAbsolute(cssConfigPath) ? cssConfigPath : resolve(findWorkspaceRoot(), cssConfigPath)] : [],
60
+ scan: () => findTailwindEntries(GLOBAL_IGNORES)
61
+ });
62
+ if (!enabled) return [];
63
+ const cssConfigPath = options.cssConfigPath ?? files[0];
64
+ const { scoped = true } = options;
65
+ const packageDir = scoped ? packageDirOf(files[0]) : null;
66
+ const basePath = packageDir && packageDir !== findWorkspaceRoot() ? { basePath: packageDir } : {};
67
+ return [{
68
+ ...(await import("eslint-plugin-tailwindcss")).default.configs.recommended,
69
+ ...basePath,
70
+ settings: { tailwindcss: { cssConfigPath } }
71
+ }];
98
72
  }
73
+ //#endregion
74
+ export { findTailwindEntry, tailwindConfig };
@@ -1,8 +1,8 @@
1
- import vitestPlugin from '@vitest/eslint-plugin';
2
- import type { Linter } from 'eslint';
3
- import jestPlugin from 'eslint-plugin-jest';
4
- import type { ToggleOptions } from '../index.js';
5
- export { jestPlugin, vitestPlugin };
1
+ import { ToggleOptions } from "../index.js";
2
+ import vitestPlugin from "@vitest/eslint-plugin";
3
+ import jestPlugin from "eslint-plugin-jest";
4
+ import { Linter } from "eslint";
5
+ //#region src/configs/testing.d.ts
6
6
  /**
7
7
  * Jest recommended rules, scoped to test files.
8
8
  *
@@ -19,4 +19,5 @@ export declare function vitestConfig(option?: boolean | ToggleOptions, strict?:
19
19
  *
20
20
  */
21
21
  export declare function testConfig(): Linter.Config[];
22
- //# sourceMappingURL=testing.d.ts.map
22
+ //#endregion
23
+ export { jestPlugin, vitestPlugin };
@@ -1,155 +1,121 @@
1
- /*
2
- * jest/vitest plugins are statically imported even though their recommended sets are gated:
3
- * the runner-agnostic testConfig() registers both plugins unconditionally (its rules are pure
4
- * AST checks that work without the runner installed).
5
- *
6
- * Each test-runner's recommended rule set is gated on the runner actually being installed - per
7
- * rules/testing.md ("if project use vite use vitest, otherwise jest"), a project normally has
8
- * exactly one of these, and applying the other runner's correctness rules to it would be
9
- * conceptually wrong (even if mechanically harmless, since the rule namespaces don't collide).
10
- */
11
- import fs from 'node:fs';
12
- import path from 'node:path';
13
- import vitestPlugin from '@vitest/eslint-plugin';
14
- import jestPlugin from 'eslint-plugin-jest';
15
- import { tsExts, tsExtsRaw } from '../exts.js';
16
- import { GLOBAL_IGNORES, hasJest, hasVitest, scanWorkspace, toolGate } from '../lib.js';
17
- export { jestPlugin, vitestPlugin };
18
- /*
19
- * Both runners use the evidence-based `toolGate` (see lib.js): a runner config file marks the repo
20
- * even when the runner is installed only in a leaf package (invisible to the `has*` probe), and
21
- * the runner package itself must then be resolvable - eslint-plugin-jest sniffs the installed
22
- * `jest` version (jest/no-deprecated-functions) - so leaf-only installs are bridged. Unlike the
23
- * plugin-crashing tools (next/storybook/tailwind) the rules are pure AST checks that work without
24
- * the runner, so forcing a runner on never throws (`requirePackage: false`).
25
- */
26
- // derived from the shared extension list - one source of truth with the lint file globs
27
- const SOURCE_EXTS = tsExtsRaw.split(',').map((ext) => `.${ext}`);
28
- const TEST_SUFFIX = new RegExp(`\\.test\\.(${tsExtsRaw.replaceAll(',', '|')})$`);
1
+ import { tsExts, tsExtsRaw } from "../exts.js";
2
+ import { GLOBAL_IGNORES, hasJest, hasVitest, scanWorkspace, toolGate } from "../lib.js";
3
+ import path from "node:path";
4
+ import fs from "node:fs";
5
+ import vitestPlugin from "@vitest/eslint-plugin";
6
+ import jestPlugin from "eslint-plugin-jest";
7
+ //#region src/configs/testing.ts
8
+ const SOURCE_EXTS = tsExtsRaw.split(",").map((ext) => `.${ext}`);
9
+ const TEST_SUFFIX = new RegExp(`\\.test\\.(${tsExtsRaw.replaceAll(",", "|")})$`);
29
10
  /**
30
- * Custom rule (registered as `local/test-colocation` by {@link testConfig}). Only `*.test.*` is
31
- * checked, not `*.spec.*` - per testing.md, spec files cover e2e/integration flows that don't map
32
- * 1:1 to a single sibling source file, so co-location isn't meaningful there.
33
- */
11
+ * Custom rule (registered as `local/test-colocation` by {@link testConfig}). Only `*.test.*` is
12
+ * checked, not `*.spec.*` - per testing.md, spec files cover e2e/integration flows that don't map
13
+ * 1:1 to a single sibling source file, so co-location isn't meaningful there.
14
+ */
34
15
  const testColocation = {
35
- meta: {
36
- type: 'problem',
37
- docs: {
38
- description: 'require *.test.* files to sit next to the source file they test, not in a separate folder',
39
- },
40
- schema: [],
41
- messages: {
42
- missingSibling: "No sibling source file found for '{{testFile}}'. Expected e.g. '{{expected}}' in the same directory, not a separate __tests__/ folder.",
43
- },
44
- },
45
- create(context) {
46
- const base = path.basename(context.filename);
47
- const match = base.match(TEST_SUFFIX);
48
- if (!match)
49
- return {};
50
- const stem = base.slice(0, -match[0].length);
51
- let siblings;
52
- try {
53
- siblings = fs.readdirSync(path.dirname(context.filename));
54
- }
55
- catch {
56
- return {}; // virtual filename (stdin, editor buffer) - no directory to check against
57
- }
58
- if (SOURCE_EXTS.some((ext) => siblings.includes(`${stem}${ext}`)))
59
- return {};
60
- return {
61
- Program(node) {
62
- context.report({
63
- node,
64
- messageId: 'missingSibling',
65
- data: { testFile: base, expected: `${stem}.ts` },
66
- });
67
- },
68
- };
69
- },
16
+ meta: {
17
+ type: "problem",
18
+ docs: { description: "require *.test.* files to sit next to the source file they test, not in a separate folder" },
19
+ schema: [],
20
+ messages: { missingSibling: "No sibling source file found for '{{testFile}}'. Expected e.g. '{{expected}}' in the same directory, not a separate __tests__/ folder." }
21
+ },
22
+ create(context) {
23
+ const base = path.basename(context.filename);
24
+ const match = base.match(TEST_SUFFIX);
25
+ if (!match) return {};
26
+ const stem = base.slice(0, -match[0].length);
27
+ let siblings;
28
+ try {
29
+ siblings = fs.readdirSync(path.dirname(context.filename));
30
+ } catch {
31
+ return {};
32
+ }
33
+ if (SOURCE_EXTS.some((ext) => siblings.includes(`${stem}${ext}`))) return {};
34
+ return { Program(node) {
35
+ context.report({
36
+ node,
37
+ messageId: "missingSibling",
38
+ data: {
39
+ testFile: base,
40
+ expected: `${stem}.ts`
41
+ }
42
+ });
43
+ } };
44
+ }
70
45
  };
71
46
  /**
72
- * Jest recommended rules, scoped to test files.
73
- *
74
- */
75
- export function jestConfig(option, strict = false) {
76
- const { enabled } = toolGate(option, strict, {
77
- tool: 'jest',
78
- has: hasJest,
79
- packageName: 'jest',
80
- requirePackage: false,
81
- scan: () => scanWorkspace('jest.config.*', GLOBAL_IGNORES),
82
- });
83
- if (!enabled)
84
- return [];
85
- return [
86
- {
87
- ...jestPlugin.configs['flat/recommended'],
88
- name: 'Jest Rules',
89
- files: [`**/*.{test,spec}.${tsExts}`],
90
- },
91
- ];
47
+ * Jest recommended rules, scoped to test files.
48
+ *
49
+ */
50
+ function jestConfig(option, strict = false) {
51
+ const { enabled } = toolGate(option, strict, {
52
+ tool: "jest",
53
+ has: hasJest,
54
+ packageName: "jest",
55
+ requirePackage: false,
56
+ scan: () => scanWorkspace("jest.config.*", GLOBAL_IGNORES)
57
+ });
58
+ if (!enabled) return [];
59
+ return [{
60
+ ...jestPlugin.configs["flat/recommended"],
61
+ name: "Jest Rules",
62
+ files: [`**/*.{test,spec}.${tsExts}`]
63
+ }];
92
64
  }
93
65
  /**
94
- * Vitest recommended rules + globals, scoped to test files.
95
- *
96
- */
97
- export function vitestConfig(option, strict = false) {
98
- const { enabled } = toolGate(option, strict, {
99
- tool: 'vitest',
100
- has: hasVitest,
101
- packageName: 'vitest',
102
- requirePackage: false,
103
- // vitest is often configured inside vite.config.* - both count as evidence
104
- scan: () => scanWorkspace('{vitest,vite}.config.*', GLOBAL_IGNORES),
105
- });
106
- if (!enabled)
107
- return [];
108
- return [
109
- {
110
- ...vitestPlugin.configs.recommended,
111
- name: 'Vitest Rules',
112
- files: [`**/*.{test,spec}.${tsExts}`],
113
- rules: {
114
- ...vitestPlugin.configs.recommended.rules,
115
- // `expectTypeOf` and `assertType` are assertions too: a type test proves its contract without a runtime
116
- // expect. Listed here rather than through the plugin's `typecheck` setting, which makes other rules demand
117
- // type information.
118
- 'vitest/expect-expect': [
119
- 'error',
120
- { assertFunctionNames: ['expect', 'assert', 'expectTypeOf', 'assertType'] },
121
- ],
122
- },
123
- },
124
- {
125
- ...vitestPlugin.configs.env,
126
- name: 'Vitest globals',
127
- files: [`**/*.{test,spec}.${tsExts}`],
128
- },
129
- ];
66
+ * Vitest recommended rules + globals, scoped to test files.
67
+ *
68
+ */
69
+ function vitestConfig(option, strict = false) {
70
+ const { enabled } = toolGate(option, strict, {
71
+ tool: "vitest",
72
+ has: hasVitest,
73
+ packageName: "vitest",
74
+ requirePackage: false,
75
+ scan: () => scanWorkspace("{vitest,vite}.config.*", GLOBAL_IGNORES)
76
+ });
77
+ if (!enabled) return [];
78
+ return [{
79
+ ...vitestPlugin.configs.recommended,
80
+ name: "Vitest Rules",
81
+ files: [`**/*.{test,spec}.${tsExts}`],
82
+ rules: {
83
+ ...vitestPlugin.configs.recommended.rules,
84
+ "vitest/expect-expect": ["error", { assertFunctionNames: [
85
+ "expect",
86
+ "assert",
87
+ "expectTypeOf",
88
+ "assertType"
89
+ ] }]
90
+ }
91
+ }, {
92
+ ...vitestPlugin.configs.env,
93
+ name: "Vitest globals",
94
+ files: [`**/*.{test,spec}.${tsExts}`]
95
+ }];
130
96
  }
131
97
  /**
132
- * Runner-agnostic test rules: pure AST/call-name checking, needs neither jest nor vitest installed
133
- * to work correctly, so it applies regardless of which one (if either) is present.
134
- *
135
- */
136
- export function testConfig() {
137
- return [
138
- {
139
- name: 'Test rules',
140
- files: [`**/*.{test,spec}.${tsExts}`],
141
- plugins: {
142
- jest: jestPlugin,
143
- vitest: vitestPlugin,
144
- local: { rules: { 'test-colocation': testColocation } },
145
- },
146
- rules: {
147
- 'jest/consistent-test-it': ['error', { fn: 'test' }],
148
- 'vitest/consistent-test-it': ['error', { fn: 'test' }],
149
- 'local/test-colocation': 'error',
150
- 'jest/no-disabled-tests': 'warn',
151
- 'vitest/no-disabled-tests': 'warn',
152
- },
153
- },
154
- ];
98
+ * Runner-agnostic test rules: pure AST/call-name checking, needs neither jest nor vitest installed
99
+ * to work correctly, so it applies regardless of which one (if either) is present.
100
+ *
101
+ */
102
+ function testConfig() {
103
+ return [{
104
+ name: "Test rules",
105
+ files: [`**/*.{test,spec}.${tsExts}`],
106
+ plugins: {
107
+ jest: jestPlugin,
108
+ vitest: vitestPlugin,
109
+ local: { rules: { "test-colocation": testColocation } }
110
+ },
111
+ rules: {
112
+ "jest/consistent-test-it": ["error", { fn: "test" }],
113
+ "vitest/consistent-test-it": ["error", { fn: "test" }],
114
+ "local/test-colocation": "error",
115
+ "jest/no-disabled-tests": "warn",
116
+ "vitest/no-disabled-tests": "warn"
117
+ }
118
+ }];
155
119
  }
120
+ //#endregion
121
+ export { jestConfig, jestPlugin, testConfig, vitestConfig, vitestPlugin };
@@ -1,9 +1,10 @@
1
- import type { Linter } from 'eslint';
2
- import type { ToggleOptions } from '../index.js';
1
+ import { ToggleOptions } from "../index.js";
2
+ import { Linter } from "eslint";
3
+ //#region src/configs/turbo.d.ts
3
4
  export declare const turboPlugin: typeof import("eslint-plugin-turbo") | null;
4
5
  /**
5
6
  * Turborepo rules. Probe-only gate (see `toolGate` in lib.js) - no evidence scan, no bridge.
6
7
  *
7
8
  */
8
9
  export declare function turboConfig(option?: boolean | ToggleOptions): Promise<Linter.Config[]>;
9
- //# sourceMappingURL=turbo.d.ts.map
10
+ //#endregion
@@ -1,29 +1,21 @@
1
- import { hasTurbo, toolGate } from '../lib.js';
2
- // lazy so consumers without Turbo don't pay the load cost - re-exported from index.js
3
- export const turboPlugin = hasTurbo ? (await import('eslint-plugin-turbo')).default : null;
1
+ import { hasTurbo, toolGate } from "../lib.js";
2
+ //#region src/configs/turbo.ts
3
+ const turboPlugin = hasTurbo ? (await import("eslint-plugin-turbo")).default : null;
4
4
  /**
5
- * Turborepo rules. Probe-only gate (see `toolGate` in lib.js) - no evidence scan, no bridge.
6
- *
7
- */
8
- export async function turboConfig(option) {
9
- const { enabled } = toolGate(option, false, { tool: 'turbo', has: hasTurbo });
10
- if (!enabled)
11
- return [];
12
- const turbo = (await import('eslint-plugin-turbo')).default;
13
- const recommended = turbo.configs?.['flat/recommended'];
14
- // Turbo's declaration permits both legacy and flat shapes; this entry is flat at runtime.
15
- const base = (Array.isArray(recommended) ? recommended : [recommended ?? {}]);
16
- return [
17
- ...base,
18
- {
19
- name: 'eslint-plugin-turbo overrides',
20
- rules: {
21
- /*
22
- * Only covers undeclared env vars, not the full dependsOn/outputs consistency - that part has no
23
- * ESLint-shaped check. Downgraded from their default 'error' to 'warn'.
24
- */
25
- 'turbo/no-undeclared-env-vars': 'warn',
26
- },
27
- },
28
- ];
5
+ * Turborepo rules. Probe-only gate (see `toolGate` in lib.js) - no evidence scan, no bridge.
6
+ *
7
+ */
8
+ async function turboConfig(option) {
9
+ const { enabled } = toolGate(option, false, {
10
+ tool: "turbo",
11
+ has: hasTurbo
12
+ });
13
+ if (!enabled) return [];
14
+ const recommended = (await import("eslint-plugin-turbo")).default.configs?.["flat/recommended"];
15
+ return [...Array.isArray(recommended) ? recommended : [recommended ?? {}], {
16
+ name: "eslint-plugin-turbo overrides",
17
+ rules: { "turbo/no-undeclared-env-vars": "warn" }
18
+ }];
29
19
  }
20
+ //#endregion
21
+ export { turboConfig, turboPlugin };
@@ -1,5 +1,6 @@
1
- import type { Linter } from 'eslint';
2
- import type { TypeAwareOptions } from '../index.js';
1
+ import { TypeAwareOptions } from "../index.js";
2
+ import { Linter } from "eslint";
3
+ //#region src/configs/typescriptTypeAware.d.ts
3
4
  /**
4
5
  * Type-aware rules. Off by default (FIXME: does not perform) - enable via
5
6
  * `defineLintConfig({ typeAware: true })` or by composing this block manually; it is self-contained
@@ -17,4 +18,4 @@ import type { TypeAwareOptions } from '../index.js';
17
18
  * There is nothing to auto-detect, so only an explicit `true` or options object enables the block.
18
19
  */
19
20
  export declare function typeAwareConfig(option?: boolean | TypeAwareOptions, strict?: boolean): Linter.Config[];
20
- //# sourceMappingURL=typescriptTypeAware.d.ts.map
21
+ //#endregion