@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.
- package/README.md +38 -3
- package/commands/spec-author.md +39 -0
- package/dist/configs/base.d.ts +4 -3
- package/dist/configs/base.js +61 -74
- package/dist/configs/imports.d.ts +3 -2
- package/dist/configs/imports.js +95 -146
- package/dist/configs/nx.d.ts +4 -3
- package/dist/configs/nx.js +31 -41
- package/dist/configs/prettier.d.ts +3 -2
- package/dist/configs/prettier.js +19 -16
- package/dist/configs/promise.d.ts +3 -2
- package/dist/configs/promise.js +16 -16
- package/dist/configs/react.d.ts +4 -3
- package/dist/configs/react.js +178 -217
- package/dist/configs/storybook.d.ts +4 -3
- package/dist/configs/storybook.js +22 -22
- package/dist/configs/tailwind.d.ts +4 -3
- package/dist/configs/tailwind.js +67 -91
- package/dist/configs/testing.d.ts +7 -6
- package/dist/configs/testing.js +112 -146
- package/dist/configs/turbo.d.ts +4 -3
- package/dist/configs/turbo.js +19 -27
- package/dist/configs/typescriptTypeAware.d.ts +4 -3
- package/dist/configs/typescriptTypeAware.js +99 -95
- package/dist/configs/unicorn.d.ts +3 -2
- package/dist/configs/unicorn.js +34 -41
- package/dist/exts.d.ts +2 -1
- package/dist/exts.js +10 -11
- package/dist/index.d.ts +44 -42
- package/dist/index.js +53 -85
- package/dist/lib.d.ts +21 -21
- package/dist/lib.js +262 -301
- package/dist/lintPrepare.d.ts +20 -17
- package/dist/lintPrepare.js +341 -371
- package/dist/lintStaged.d.ts +4 -3
- package/dist/lintStaged.js +25 -22
- package/dist/prettier.d.ts +4 -3
- package/dist/prettier.js +16 -17
- package/dist/restrictions.d.ts +11 -10
- package/dist/restrictions.js +18 -22
- package/dist/yarn.cjs +79 -98
- package/dist/yarn.d.cts +3 -2
- package/package.json +22 -8
- package/rules/agent.md +2 -0
- package/rules/openspec.md +1 -1
- package/skills/spec-steward/SKILL.md +4 -12
- package/skills/spec-steward/references/audit.md +18 -43
- package/skills/spec-steward/references/contract.md +9 -9
- package/skills/spec-steward/references/criteria.md +4 -4
- package/skills/spec-steward/references/review-format.md +6 -6
- package/skills/spec-steward/references/wiring.md +2 -2
- package/skills/spec-steward/references/worker.md +67 -0
- package/skills/spec-steward/sweeps.json +49 -0
- package/skills/spec-tools/SKILL.md +48 -0
- package/skills/spec-tools/references/contract.md +111 -0
- package/skills/spec-tools/references/gitlab.md +120 -0
- package/skills/spec-tools/scripts/cli.js +8129 -0
- package/skills/spec-verify/SKILL.md +153 -0
- package/dist/configs/base.d.ts.map +0 -1
- package/dist/configs/imports.d.ts.map +0 -1
- package/dist/configs/nx.d.ts.map +0 -1
- package/dist/configs/prettier.d.ts.map +0 -1
- package/dist/configs/promise.d.ts.map +0 -1
- package/dist/configs/react.d.ts.map +0 -1
- package/dist/configs/storybook.d.ts.map +0 -1
- package/dist/configs/tailwind.d.ts.map +0 -1
- package/dist/configs/testing.d.ts.map +0 -1
- package/dist/configs/turbo.d.ts.map +0 -1
- package/dist/configs/typescriptTypeAware.d.ts.map +0 -1
- package/dist/configs/unicorn.d.ts.map +0 -1
- package/dist/exts.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib.d.ts.map +0 -1
- package/dist/lintPrepare.d.ts.map +0 -1
- package/dist/lintStaged.d.ts.map +0 -1
- package/dist/prettier.d.ts.map +0 -1
- package/dist/restrictions.d.ts.map +0 -1
- package/dist/yarn.d.cts.map +0 -1
- package/skills/spec-steward/scripts/lib/align.mjs +0 -127
- package/skills/spec-steward/scripts/lib/checks.mjs +0 -589
- package/skills/spec-steward/scripts/lib/citations.mjs +0 -156
- package/skills/spec-steward/scripts/lib/corpus.mjs +0 -256
- package/skills/spec-steward/scripts/lib/coverage.mjs +0 -123
- package/skills/spec-steward/scripts/lib/evidence.mjs +0 -334
- package/skills/spec-steward/scripts/lib/git.mjs +0 -138
- package/skills/spec-steward/scripts/lib/review.mjs +0 -347
- package/skills/spec-steward/scripts/lib/scan.mjs +0 -364
- package/skills/spec-steward/scripts/lib/util.mjs +0 -161
- package/skills/spec-steward/scripts/lib/wire.mjs +0 -331
- package/skills/spec-steward/scripts/steward.mjs +0 -350
- package/skills/spec-steward/workflows/audit.js +0 -539
|
@@ -1,97 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { asOptions, findWorkspaceRoot } from "../lib.js";
|
|
2
|
+
import { isAbsolute, relative } from "node:path";
|
|
3
|
+
//#region src/configs/typescriptTypeAware.ts
|
|
3
4
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
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
|
-
//#
|
|
11
|
+
//#endregion
|
package/dist/configs/unicorn.js
CHANGED
|
@@ -1,43 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { tsExts } from "../exts.js";
|
|
2
|
+
import unicornPlugin from "eslint-plugin-unicorn";
|
|
3
|
+
//#region src/configs/unicorn.ts
|
|
3
4
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
//#
|
|
9
|
+
//#endregion
|
package/dist/exts.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
+
enabled?: boolean;
|
|
24
25
|
};
|
|
25
26
|
export type DetectionOptions = ToggleOptions & {
|
|
26
|
-
|
|
27
|
+
strict?: boolean;
|
|
27
28
|
};
|
|
28
29
|
export type NextOptions = ToggleOptions & {
|
|
29
|
-
|
|
30
|
+
rootDir?: string | string[];
|
|
30
31
|
};
|
|
31
32
|
export type TailwindOptions = ToggleOptions & {
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
37
|
+
tsconfigRootDir?: ParserOptions['tsconfigRootDir'];
|
|
37
38
|
};
|
|
38
39
|
export type DefaultIgnoreOptions = {
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
enabled: false;
|
|
41
|
+
importMetaUrl?: string;
|
|
41
42
|
} | {
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
enabled?: true;
|
|
44
|
+
importMetaUrl: string;
|
|
44
45
|
};
|
|
45
46
|
export type LintOptions = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
//#
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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 };
|