@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,97 +1,101 @@
1
- import { isAbsolute, relative } from 'node:path';
2
- import { asOptions, findWorkspaceRoot } from '../lib.js';
1
+ import { asOptions, findWorkspaceRoot } from "../lib.js";
2
+ import { isAbsolute, relative } from "node:path";
3
+ //#region src/configs/typescriptTypeAware.ts
3
4
  /**
4
- * Type-aware rules. Off by default (FIXME: does not perform) - enable via
5
- * `defineLintConfig({ typeAware: true })` or by composing this block manually; it is self-contained
6
- * (wires typescript-eslint's projectService itself).
7
- *
8
- * Config files like vite.config.ts and .storybook/{main,preview}.ts sit at the package root or in
9
- * a dotfolder, outside their tsconfig.json `include` - projectService has no tsconfig to attach
10
- * them to. `allowDefaultProject` falls back to a synthetic single-file program for these instead
11
- * of erroring; it has NO default (the layout is project-specific and its patterns may not contain
12
- * `**` - see README "Type-aware rules" for how to generate the list).
13
- * `maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING` defaults to the length of
14
- * `allowDefaultProject` when that list is given (upstream default is 8), and `tsconfigRootDir`
15
- * defaults to the detected workspace root.
16
- *
17
- * There is nothing to auto-detect, so only an explicit `true` or options object enables the block.
18
- */
19
- export function typeAwareConfig(option, strict = false) {
20
- const { enabled = false, allowDefaultProject: configuredDefaultProject,
21
- // matches the list when it's exact files (the scanWorkspace flow); with multi-match globs
22
- // set the cap explicitly - typescript-eslint errors loudly when matches exceed it
23
- maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING = configuredDefaultProject?.length,
24
- // strict detection avoids the workspace walk
25
- tsconfigRootDir = strict ? process.cwd() : findWorkspaceRoot(), } = asOptions(option);
26
- if (!enabled)
27
- return [];
28
- // typescript-eslint requires allowDefaultProject globs to be RELATIVE to tsconfigRootDir -
29
- // absolute entries (e.g. produced by scanWorkspace, see README) are relativized automatically
30
- const allowDefaultProject = configuredDefaultProject?.map((file) => isAbsolute(file) ? relative(tsconfigRootDir, file) : file);
31
- return [
32
- {
33
- name: 'Type-aware rules (separate for performance)',
34
- files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '**/*.mdx'],
35
- languageOptions: {
36
- parserOptions: {
37
- projectService: {
38
- ...(allowDefaultProject ? { allowDefaultProject } : {}),
39
- ...(maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING
40
- ? { maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING }
41
- : {}),
42
- },
43
- tsconfigRootDir,
44
- },
45
- },
46
- rules: {
47
- '@typescript-eslint/prefer-optional-chain': 'warn',
48
- '@typescript-eslint/prefer-nullish-coalescing': 'warn',
49
- /**
50
- * https://typescript-eslint.io/rules/naming-convention/
51
- *
52
- * Naming Conventions. Lives here (not 'Custom
53
- * rules') because the `types: ['boolean']` filter below needs type info too, even
54
- * though naming-convention as a whole isn't in the typed-linting rule set.
55
- */
56
- '@typescript-eslint/naming-convention': [
57
- 'warn',
58
- { selector: 'default', format: null },
59
- /*
60
- * PascalCase allowed too: this codebase's actual
61
- * convention is `const Cmp: FC<Props> = memo(...)` - components are PascalCase
62
- * variables, not just PascalCase function declarations.
63
- */
64
- {
65
- selector: 'variable',
66
- format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
67
- leadingUnderscore: 'forbid',
68
- },
69
- {
70
- selector: 'variable',
71
- types: ['boolean'],
72
- /*
73
- * The part AFTER the prefix is naturally capitalized (isLoading, hasError, ...),
74
- * so it's validated as PascalCase, not camelCase - format here is for the suffix,
75
- * not the identifier as a whole.
76
- */
77
- format: ['PascalCase'],
78
- prefix: ['is', 'has', 'had', 'can', 'should', 'will', 'did'],
79
- },
80
- /*
81
- * Established exceptions to the boolean-prefix rule above - conventional enough on
82
- * their own (React's own `loading`/`done` state names, DOM/library `enabled` flags)
83
- * that requiring is/has/can/should here would just be noise.
84
- */
85
- {
86
- selector: 'variable',
87
- types: ['boolean'],
88
- filter: { regex: '^(done|loading|enabled)$', match: true },
89
- format: ['camelCase'],
90
- },
91
- { selector: 'function', format: ['camelCase', 'PascalCase'] },
92
- { selector: 'class', format: ['PascalCase'] },
93
- ],
94
- },
95
- },
96
- ];
5
+ * Type-aware rules. Off by default (FIXME: does not perform) - enable via
6
+ * `defineLintConfig({ typeAware: true })` or by composing this block manually; it is self-contained
7
+ * (wires typescript-eslint's projectService itself).
8
+ *
9
+ * Config files like vite.config.ts and .storybook/{main,preview}.ts sit at the package root or in
10
+ * a dotfolder, outside their tsconfig.json `include` - projectService has no tsconfig to attach
11
+ * them to. `allowDefaultProject` falls back to a synthetic single-file program for these instead
12
+ * of erroring; it has NO default (the layout is project-specific and its patterns may not contain
13
+ * `**` - see README "Type-aware rules" for how to generate the list).
14
+ * `maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING` defaults to the length of
15
+ * `allowDefaultProject` when that list is given (upstream default is 8), and `tsconfigRootDir`
16
+ * defaults to the detected workspace root.
17
+ *
18
+ * There is nothing to auto-detect, so only an explicit `true` or options object enables the block.
19
+ */
20
+ function typeAwareConfig(option, strict = false) {
21
+ const { enabled = false, allowDefaultProject: configuredDefaultProject, maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING = configuredDefaultProject?.length, tsconfigRootDir = strict ? process.cwd() : findWorkspaceRoot() } = asOptions(option);
22
+ if (!enabled) return [];
23
+ const allowDefaultProject = configuredDefaultProject?.map((file) => isAbsolute(file) ? relative(tsconfigRootDir, file) : file);
24
+ return [{
25
+ name: "Type-aware rules (separate for performance)",
26
+ files: [
27
+ "**/*.ts",
28
+ "**/*.tsx",
29
+ "**/*.mts",
30
+ "**/*.cts",
31
+ "**/*.mdx"
32
+ ],
33
+ languageOptions: { parserOptions: {
34
+ projectService: {
35
+ ...allowDefaultProject ? { allowDefaultProject } : {},
36
+ ...maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING ? { maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING } : {}
37
+ },
38
+ tsconfigRootDir
39
+ } },
40
+ rules: {
41
+ "@typescript-eslint/prefer-optional-chain": "warn",
42
+ "@typescript-eslint/prefer-nullish-coalescing": "warn",
43
+ /**
44
+ * https://typescript-eslint.io/rules/naming-convention/
45
+ *
46
+ * Naming Conventions. Lives here (not 'Custom
47
+ * rules') because the `types: ['boolean']` filter below needs type info too, even
48
+ * though naming-convention as a whole isn't in the typed-linting rule set.
49
+ */
50
+ "@typescript-eslint/naming-convention": [
51
+ "warn",
52
+ {
53
+ selector: "default",
54
+ format: null
55
+ },
56
+ {
57
+ selector: "variable",
58
+ format: [
59
+ "camelCase",
60
+ "UPPER_CASE",
61
+ "PascalCase"
62
+ ],
63
+ leadingUnderscore: "forbid"
64
+ },
65
+ {
66
+ selector: "variable",
67
+ types: ["boolean"],
68
+ format: ["PascalCase"],
69
+ prefix: [
70
+ "is",
71
+ "has",
72
+ "had",
73
+ "can",
74
+ "should",
75
+ "will",
76
+ "did"
77
+ ]
78
+ },
79
+ {
80
+ selector: "variable",
81
+ types: ["boolean"],
82
+ filter: {
83
+ regex: "^(done|loading|enabled)$",
84
+ match: true
85
+ },
86
+ format: ["camelCase"]
87
+ },
88
+ {
89
+ selector: "function",
90
+ format: ["camelCase", "PascalCase"]
91
+ },
92
+ {
93
+ selector: "class",
94
+ format: ["PascalCase"]
95
+ }
96
+ ]
97
+ }
98
+ }];
97
99
  }
100
+ //#endregion
101
+ export { typeAwareConfig };
@@ -1,4 +1,5 @@
1
- import type { Linter } from 'eslint';
1
+ import { Linter } from "eslint";
2
+ //#region src/configs/unicorn.d.ts
2
3
  /**
3
4
  * Filename casing + node: protocol.
4
5
  *
@@ -7,4 +8,4 @@ import type { Linter } from 'eslint';
7
8
  * Only the two rules below are actually wanted.
8
9
  */
9
10
  export declare function unicornConfig(): Linter.Config[];
10
- //# sourceMappingURL=unicorn.d.ts.map
11
+ //#endregion
@@ -1,43 +1,36 @@
1
- import unicornPlugin from 'eslint-plugin-unicorn';
2
- import { tsExts } from '../exts.js';
1
+ import { tsExts } from "../exts.js";
2
+ import unicornPlugin from "eslint-plugin-unicorn";
3
+ //#region src/configs/unicorn.ts
3
4
  /**
4
- * Filename casing + node: protocol.
5
- *
6
- * Deliberately NOT using unicorn.configs['flat/recommended'] - it's 337 rules (it even folds in
7
- * a few unprefixed core-ESLint rules), extremely opinionated, and far beyond what was asked for.
8
- * Only the two rules below are actually wanted.
9
- */
10
- export function unicornConfig() {
11
- return [
12
- {
13
- name: 'Unicorn rules',
14
- files: [`**/*.${tsExts}`],
15
- plugins: { unicorn: unicornPlugin },
16
- rules: {
17
- 'unicorn/filename-case': [
18
- 'error',
19
- {
20
- case: 'camelCase',
21
- /*
22
- * code-style.md only mandates FILE names; this repo's own kebab-case package
23
- * directories (e.g. electron-builder, react-native) are an established convention.
24
- */
25
- checkDirectories: false,
26
- // Next.js App Router mandates these exact hyphenated filenames - not a naming choice.
27
- ignore: [
28
- /^not-found\.[jt]sx?$/,
29
- /^global-error\.[jt]sx?$/,
30
- /^opengraph-image\.[jt]sx?$/,
31
- /^twitter-image\.[jt]sx?$/,
32
- /^apple-icon\.[jt]sx?$/,
33
- /^mdx-components\.[jt]sx?$/,
34
- /\.d\.tsx?$/,
35
- /^electron-builder\..+$/,
36
- ],
37
- },
38
- ],
39
- 'unicorn/prefer-node-protocol': 'error',
40
- },
41
- },
42
- ];
5
+ * Filename casing + node: protocol.
6
+ *
7
+ * Deliberately NOT using unicorn.configs['flat/recommended'] - it's 337 rules (it even folds in
8
+ * a few unprefixed core-ESLint rules), extremely opinionated, and far beyond what was asked for.
9
+ * Only the two rules below are actually wanted.
10
+ */
11
+ function unicornConfig() {
12
+ return [{
13
+ name: "Unicorn rules",
14
+ files: [`**/*.${tsExts}`],
15
+ plugins: { unicorn: unicornPlugin },
16
+ rules: {
17
+ "unicorn/filename-case": ["error", {
18
+ case: "camelCase",
19
+ checkDirectories: false,
20
+ ignore: [
21
+ /^not-found\.[jt]sx?$/,
22
+ /^global-error\.[jt]sx?$/,
23
+ /^opengraph-image\.[jt]sx?$/,
24
+ /^twitter-image\.[jt]sx?$/,
25
+ /^apple-icon\.[jt]sx?$/,
26
+ /^mdx-components\.[jt]sx?$/,
27
+ /\.d\.tsx?$/,
28
+ /^electron-builder\..+$/
29
+ ]
30
+ }],
31
+ "unicorn/prefer-node-protocol": "error"
32
+ }
33
+ }];
43
34
  }
35
+ //#endregion
36
+ export { unicornConfig };
package/dist/exts.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ //#region src/exts.d.ts
1
2
  export declare const tsExtsRaw = "js,jsx,ts,tsx,cjs,cts,mjs,mts";
2
3
  export declare const markupExtsRaw = "md,mdx,htm,html,vue";
3
4
  export declare const eslintExtsRaw = "js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue";
@@ -5,4 +6,4 @@ export declare const prettierExtsRaw = "css,scss,sass,less,yml,yaml,json,json5,j
5
6
  export declare const tsExts = "{js,jsx,ts,tsx,cjs,cts,mjs,mts}";
6
7
  export declare const eslintExts = "*.{js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue}";
7
8
  export declare const prettierExts = "*.{css,scss,sass,less,yml,yaml,json,json5,jsonc,graphql,graphqls,xml}";
8
- //# sourceMappingURL=exts.d.ts.map
9
+ //#endregion
package/dist/exts.js CHANGED
@@ -1,11 +1,10 @@
1
- /*
2
- * File extension lists shared by the ESLint blocks and the Prettier / lint-staged configs. Free of imports and side
3
- * effects, so the `./prettier` and `./lint-staged` entries load nothing else.
4
- */
5
- export const tsExtsRaw = 'js,jsx,ts,tsx,cjs,cts,mjs,mts'; // TODO mdx, needs loader
6
- export const markupExtsRaw = 'md,mdx,htm,html,vue';
7
- export const eslintExtsRaw = `${tsExtsRaw},${markupExtsRaw}`;
8
- export const prettierExtsRaw = 'css,scss,sass,less,yml,yaml,json,json5,jsonc,graphql,graphqls,xml';
9
- export const tsExts = `{${tsExtsRaw}}`;
10
- export const eslintExts = `*.{${eslintExtsRaw}}`;
11
- export const prettierExts = `*.{${prettierExtsRaw}}`;
1
+ //#region src/exts.ts
2
+ const tsExtsRaw = "js,jsx,ts,tsx,cjs,cts,mjs,mts";
3
+ const markupExtsRaw = "md,mdx,htm,html,vue";
4
+ const eslintExtsRaw = `${tsExtsRaw},${markupExtsRaw}`;
5
+ const prettierExtsRaw = "css,scss,sass,less,yml,yaml,json,json5,jsonc,graphql,graphqls,xml";
6
+ const tsExts = `{${tsExtsRaw}}`;
7
+ const eslintExts = `*.{${eslintExtsRaw}}`;
8
+ const prettierExts = `*.{${prettierExtsRaw}}`;
9
+ //#endregion
10
+ export { eslintExts, eslintExtsRaw, markupExtsRaw, prettierExts, prettierExtsRaw, tsExts, tsExtsRaw };
package/dist/index.d.ts CHANGED
@@ -1,58 +1,59 @@
1
- import type { ParserOptions as TsParserOptions } from '@typescript-eslint/parser';
2
- import type { Linter } from 'eslint';
3
- import type { PluginSettings as TailwindPluginSettings } from 'eslint-plugin-tailwindcss';
4
- export * from './configs/base.js';
5
- export * from './configs/imports.js';
6
- export * from './configs/react.js';
7
- export * from './configs/nx.js';
8
- export * from './configs/prettier.js';
9
- export * from './configs/promise.js';
10
- export * from './configs/storybook.js';
11
- export * from './configs/tailwind.js';
12
- export * from './configs/testing.js';
13
- export * from './configs/turbo.js';
14
- export * from './configs/typescriptTypeAware.js';
15
- export * from './configs/unicorn.js';
16
- export * from './exts.js';
17
- export * from './lib.js';
18
- export * from './restrictions.js';
19
- export * from './lintStaged.js';
20
- export * from './prettier.js';
21
- type ProjectServiceOptions = Exclude<NonNullable<TsParserOptions['projectService']>, boolean>;
1
+ import { importSortConfig, importXConfig, unusedImportsConfig } from "./configs/imports.js";
2
+ import { findNextRoots, nextBaseConfig, nextConfig, nextOverridesConfig, nextPlugin, reactBaseConfig, reactConfig, reactSettingsConfig, typescriptOverridesConfig } from "./configs/react.js";
3
+ import { nxConfig, nxPlugin } from "./configs/nx.js";
4
+ import { prettierConfig } from "./configs/prettier.js";
5
+ import { promiseConfig } from "./configs/promise.js";
6
+ import { storybookConfig } from "./configs/storybook.js";
7
+ import { findTailwindEntry, tailwindConfig } from "./configs/tailwind.js";
8
+ import { jestConfig, jestPlugin, testConfig, vitestConfig, vitestPlugin } from "./configs/testing.js";
9
+ import { turboConfig, turboPlugin } from "./configs/turbo.js";
10
+ import { typeAwareConfig } from "./configs/typescriptTypeAware.js";
11
+ import { unicornConfig } from "./configs/unicorn.js";
12
+ import { eslintExts, eslintExtsRaw, markupExtsRaw, prettierExts, prettierExtsRaw, tsExts, tsExtsRaw } from "./exts.js";
13
+ import { GLOBAL_IGNORES, asOptions, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate } from "./lib.js";
14
+ import { Restriction, restrictions } from "./restrictions.js";
15
+ import { listStaged } from "./lintStaged.js";
16
+ import { prettier } from "./prettier.js";
17
+ import { baseConfig, defaultIgnoreConfig, includeIgnoreFile } from "./configs/base.js";
18
+ import { Linter } from "eslint";
19
+ import { ParserOptions } from "@typescript-eslint/parser";
20
+ import { PluginSettings } from "eslint-plugin-tailwindcss";
21
+ //#region src/index.d.ts
22
+ type ProjectServiceOptions = Exclude<NonNullable<ParserOptions['projectService']>, boolean>;
22
23
  export type ToggleOptions = {
23
- enabled?: boolean;
24
+ enabled?: boolean;
24
25
  };
25
26
  export type DetectionOptions = ToggleOptions & {
26
- strict?: boolean;
27
+ strict?: boolean;
27
28
  };
28
29
  export type NextOptions = ToggleOptions & {
29
- rootDir?: string | string[];
30
+ rootDir?: string | string[];
30
31
  };
31
32
  export type TailwindOptions = ToggleOptions & {
32
- cssConfigPath?: TailwindPluginSettings['cssConfigPath'];
33
- scoped?: boolean;
33
+ cssConfigPath?: PluginSettings['cssConfigPath'];
34
+ scoped?: boolean;
34
35
  };
35
36
  export type TypeAwareOptions = ToggleOptions & Pick<ProjectServiceOptions, 'allowDefaultProject' | 'maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING'> & {
36
- tsconfigRootDir?: TsParserOptions['tsconfigRootDir'];
37
+ tsconfigRootDir?: ParserOptions['tsconfigRootDir'];
37
38
  };
38
39
  export type DefaultIgnoreOptions = {
39
- enabled: false;
40
- importMetaUrl?: string;
40
+ enabled: false;
41
+ importMetaUrl?: string;
41
42
  } | {
42
- enabled?: true;
43
- importMetaUrl: string;
43
+ enabled?: true;
44
+ importMetaUrl: string;
44
45
  };
45
46
  export type LintOptions = {
46
- detection?: boolean | DetectionOptions;
47
- next?: boolean | NextOptions;
48
- storybook?: boolean | ToggleOptions;
49
- turbo?: boolean | ToggleOptions;
50
- nx?: boolean | ToggleOptions;
51
- jest?: boolean | ToggleOptions;
52
- vitest?: boolean | ToggleOptions;
53
- tailwind?: boolean | TailwindOptions;
54
- typeAware?: boolean | TypeAwareOptions;
55
- defaultIgnore?: boolean | DefaultIgnoreOptions;
47
+ detection?: boolean | DetectionOptions;
48
+ next?: boolean | NextOptions;
49
+ storybook?: boolean | ToggleOptions;
50
+ turbo?: boolean | ToggleOptions;
51
+ nx?: boolean | ToggleOptions;
52
+ jest?: boolean | ToggleOptions;
53
+ vitest?: boolean | ToggleOptions;
54
+ tailwind?: boolean | TailwindOptions;
55
+ typeAware?: boolean | TypeAwareOptions;
56
+ defaultIgnore?: boolean | DefaultIgnoreOptions;
56
57
  };
57
58
  /**
58
59
  * Build the shared flat ESLint config.
@@ -65,4 +66,5 @@ export type LintOptions = {
65
66
  *
66
67
  */
67
68
  export declare function defineLintConfig(options?: LintOptions | Promise<LintOptions> | (() => LintOptions | Promise<LintOptions>)): Promise<Linter.Config[]>;
68
- //# sourceMappingURL=index.d.ts.map
69
+ //#endregion
70
+ export { GLOBAL_IGNORES, Restriction, asOptions, baseConfig, defaultIgnoreConfig, eslintExts, eslintExtsRaw, findNextRoots, findTailwindEntry, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, importSortConfig, importXConfig, includeIgnoreFile, isPackageResolvable, jestConfig, jestPlugin, listStaged, markupExtsRaw, nextBaseConfig, nextConfig, nextOverridesConfig, nextPlugin, nxConfig, nxPlugin, packageDirOf, prettier, prettierConfig, prettierExts, prettierExtsRaw, promiseConfig, reactBaseConfig, reactConfig, reactSettingsConfig, restrictions, scanWorkspace, storybookConfig, tailwindConfig, testConfig, toolGate, tsExts, tsExtsRaw, turboConfig, turboPlugin, typeAwareConfig, typescriptOverridesConfig, unicornConfig, unusedImportsConfig, vitestConfig, vitestPlugin };
package/dist/index.js CHANGED
@@ -1,87 +1,55 @@
1
- import { baseConfig, defaultIgnoreConfig } from './configs/base.js';
2
- import { importSortConfig, importXConfig, unusedImportsConfig } from './configs/imports.js';
3
- import { nxConfig } from './configs/nx.js';
4
- import { prettierConfig } from './configs/prettier.js';
5
- import { promiseConfig } from './configs/promise.js';
6
- import { reactConfig } from './configs/react.js';
7
- import { storybookConfig } from './configs/storybook.js';
8
- import { tailwindConfig } from './configs/tailwind.js';
9
- import { jestConfig, testConfig, vitestConfig } from './configs/testing.js';
10
- import { turboConfig } from './configs/turbo.js';
11
- import { typeAwareConfig } from './configs/typescriptTypeAware.js';
12
- import { unicornConfig } from './configs/unicorn.js';
13
- import { asOptions } from './lib.js';
14
- export * from './configs/base.js';
15
- export * from './configs/imports.js';
16
- export * from './configs/react.js';
17
- export * from './configs/nx.js';
18
- export * from './configs/prettier.js';
19
- export * from './configs/promise.js';
20
- export * from './configs/storybook.js';
21
- export * from './configs/tailwind.js';
22
- export * from './configs/testing.js';
23
- export * from './configs/turbo.js';
24
- export * from './configs/typescriptTypeAware.js';
25
- export * from './configs/unicorn.js';
26
- export * from './exts.js';
27
- export * from './lib.js';
28
- export * from './restrictions.js';
29
- export * from './lintStaged.js';
30
- export * from './prettier.js';
1
+ import { eslintExts, eslintExtsRaw, markupExtsRaw, prettierExts, prettierExtsRaw, tsExts, tsExtsRaw } from "./exts.js";
2
+ import { GLOBAL_IGNORES, asOptions, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate } from "./lib.js";
3
+ import { baseConfig, defaultIgnoreConfig, includeIgnoreFile } from "./configs/base.js";
4
+ import { importSortConfig, importXConfig, unusedImportsConfig } from "./configs/imports.js";
5
+ import { nxConfig, nxPlugin } from "./configs/nx.js";
6
+ import { prettierConfig } from "./configs/prettier.js";
7
+ import { promiseConfig } from "./configs/promise.js";
8
+ import { findNextRoots, nextBaseConfig, nextConfig, nextOverridesConfig, nextPlugin, reactBaseConfig, reactConfig, reactSettingsConfig, typescriptOverridesConfig } from "./configs/react.js";
9
+ import { storybookConfig } from "./configs/storybook.js";
10
+ import { findTailwindEntry, tailwindConfig } from "./configs/tailwind.js";
11
+ import { jestConfig, jestPlugin, testConfig, vitestConfig, vitestPlugin } from "./configs/testing.js";
12
+ import { turboConfig, turboPlugin } from "./configs/turbo.js";
13
+ import { typeAwareConfig } from "./configs/typescriptTypeAware.js";
14
+ import { unicornConfig } from "./configs/unicorn.js";
15
+ import { restrictions } from "./restrictions.js";
16
+ import { listStaged } from "./lintStaged.js";
17
+ import { prettier } from "./prettier.js";
18
+ //#region src/index.ts
31
19
  /**
32
- * Build the shared flat ESLint config.
33
- *
34
- * By default every tool integration is auto-detected (see the `has*` exports); pass
35
- * {@link LintOptions} to force any of them on/off or to supply tool-specific settings.
36
- *
37
- * Returns a Promise - ESLint natively awaits a Promise default export, so a plain
38
- * `export default defineLintConfig({...})` works; `await` it only when composing with extra blocks.
39
- *
40
- */
41
- export async function defineLintConfig(options = {}) {
42
- if (typeof options === 'function')
43
- options = options();
44
- options = (await options) ?? {};
45
- /*
46
- * `detection` uses the same toggle notation as the tool flags (true <> { enabled: true } <>
47
- * false <> { enabled: false }): `enabled` = are tools ON unless said otherwise (default true),
48
- * `strict` = same-scope package probes only, no workspace evidence scans (default false;
49
- * ideal for per-package monorepo configs).
50
- */
51
- const { enabled: defaultOn = true, strict = false } = asOptions(options.detection);
52
- // with detection off, tools not mentioned explicitly are OFF instead of auto-detected
53
- const flag = (option) => option === undefined && !defaultOn ? false : option;
54
- // blocks from the same configs/* file stay consecutive - ordering inside a family matters
55
- // (e.g. next: base config, then the TS wiring stemming from it, then overrides, then settings)
56
- return [
57
- // base.js
58
- ...baseConfig(),
59
- ...defaultIgnoreConfig(options.defaultIgnore),
60
- // react.js - the whole family (Next or plain React + TS wiring + overrides + settings)
61
- ...(await reactConfig(flag(options.next), strict)),
62
- // prettier.js
63
- ...prettierConfig(),
64
- // storybook.js
65
- ...(await storybookConfig(flag(options.storybook), strict)),
66
- // typescriptTypeAware (should be before imports)
67
- ...typeAwareConfig(options.typeAware, strict),
68
- // imports.js
69
- ...importXConfig(),
70
- ...importSortConfig(),
71
- ...unusedImportsConfig(),
72
- // promise.js
73
- ...promiseConfig(),
74
- // unicorn.js
75
- ...unicornConfig(),
76
- // turbo.js
77
- ...(await turboConfig(flag(options.turbo))),
78
- // tailwind.js
79
- ...(await tailwindConfig(flag(options.tailwind), strict)),
80
- // nx.js
81
- ...(await nxConfig(flag(options.nx), strict)),
82
- // testing.js
83
- ...jestConfig(flag(options.jest), strict),
84
- ...vitestConfig(flag(options.vitest), strict),
85
- ...testConfig(),
86
- ];
20
+ * Build the shared flat ESLint config.
21
+ *
22
+ * By default every tool integration is auto-detected (see the `has*` exports); pass
23
+ * {@link LintOptions} to force any of them on/off or to supply tool-specific settings.
24
+ *
25
+ * Returns a Promise - ESLint natively awaits a Promise default export, so a plain
26
+ * `export default defineLintConfig({...})` works; `await` it only when composing with extra blocks.
27
+ *
28
+ */
29
+ async function defineLintConfig(options = {}) {
30
+ if (typeof options === "function") options = options();
31
+ options = await options ?? {};
32
+ const { enabled: defaultOn = true, strict = false } = asOptions(options.detection);
33
+ const flag = (option) => option === void 0 && !defaultOn ? false : option;
34
+ return [
35
+ ...baseConfig(),
36
+ ...defaultIgnoreConfig(options.defaultIgnore),
37
+ ...await reactConfig(flag(options.next), strict),
38
+ ...prettierConfig(),
39
+ ...await storybookConfig(flag(options.storybook), strict),
40
+ ...typeAwareConfig(options.typeAware, strict),
41
+ ...importXConfig(),
42
+ ...importSortConfig(),
43
+ ...unusedImportsConfig(),
44
+ ...promiseConfig(),
45
+ ...unicornConfig(),
46
+ ...await turboConfig(flag(options.turbo)),
47
+ ...await tailwindConfig(flag(options.tailwind), strict),
48
+ ...await nxConfig(flag(options.nx), strict),
49
+ ...jestConfig(flag(options.jest), strict),
50
+ ...vitestConfig(flag(options.vitest), strict),
51
+ ...testConfig()
52
+ ];
87
53
  }
54
+ //#endregion
55
+ export { GLOBAL_IGNORES, asOptions, baseConfig, defaultIgnoreConfig, defineLintConfig, eslintExts, eslintExtsRaw, findNextRoots, findTailwindEntry, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, importSortConfig, importXConfig, includeIgnoreFile, isPackageResolvable, jestConfig, jestPlugin, listStaged, markupExtsRaw, nextBaseConfig, nextConfig, nextOverridesConfig, nextPlugin, nxConfig, nxPlugin, packageDirOf, prettier, prettierConfig, prettierExts, prettierExtsRaw, promiseConfig, reactBaseConfig, reactConfig, reactSettingsConfig, restrictions, scanWorkspace, storybookConfig, tailwindConfig, testConfig, toolGate, tsExts, tsExtsRaw, turboConfig, turboPlugin, typeAwareConfig, typescriptOverridesConfig, unicornConfig, unusedImportsConfig, vitestConfig, vitestPlugin };