@kirill.konshin/lint 0.3.6 → 0.4.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 +135 -57
- package/dist/configs/base.d.ts +29 -0
- package/dist/configs/base.d.ts.map +1 -0
- package/{configs → dist/configs}/base.js +7 -25
- package/dist/configs/imports.d.ts +21 -0
- package/dist/configs/imports.d.ts.map +1 -0
- package/{configs → dist/configs}/imports.js +0 -10
- package/dist/configs/nx.d.ts +16 -0
- package/dist/configs/nx.d.ts.map +1 -0
- package/{configs → dist/configs}/nx.js +3 -8
- package/dist/configs/prettier.d.ts +17 -0
- package/dist/configs/prettier.d.ts.map +1 -0
- package/{configs → dist/configs}/prettier.js +0 -3
- package/dist/configs/promise.d.ts +6 -0
- package/dist/configs/promise.d.ts.map +1 -0
- package/{configs → dist/configs}/promise.js +0 -3
- package/dist/configs/react.d.ts +84 -0
- package/dist/configs/react.d.ts.map +1 -0
- package/{configs → dist/configs}/react.js +14 -41
- package/dist/configs/storybook.d.ts +14 -0
- package/dist/configs/storybook.d.ts.map +1 -0
- package/{configs → dist/configs}/storybook.js +3 -6
- package/dist/configs/tailwind.d.ts +29 -0
- package/dist/configs/tailwind.d.ts.map +1 -0
- package/{configs → dist/configs}/tailwind.js +9 -24
- package/dist/configs/testing.d.ts +22 -0
- package/dist/configs/testing.d.ts.map +1 -0
- package/{configs → dist/configs}/testing.js +11 -25
- package/dist/configs/turbo.d.ts +9 -0
- package/dist/configs/turbo.d.ts.map +1 -0
- package/{configs → dist/configs}/turbo.js +6 -6
- package/dist/configs/typescriptTypeAware.d.ts +20 -0
- package/dist/configs/typescriptTypeAware.d.ts.map +1 -0
- package/{configs → dist/configs}/typescriptTypeAware.js +10 -23
- package/dist/configs/unicorn.d.ts +10 -0
- package/dist/configs/unicorn.d.ts.map +1 -0
- package/{configs → dist/configs}/unicorn.js +0 -4
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/{index.js → dist/index.js} +5 -54
- package/dist/lib.d.ts +116 -0
- package/dist/lib.d.ts.map +1 -0
- package/{lib.js → dist/lib.js} +69 -145
- package/dist/lintPrepare.d.ts +105 -0
- package/dist/lintPrepare.d.ts.map +1 -0
- package/{lintPrepare.js → dist/lintPrepare.js} +11 -65
- package/dist/yarn.cjs +117 -0
- package/dist/yarn.d.cts +8 -0
- package/dist/yarn.d.cts.map +1 -0
- package/package.json +42 -34
- package/rules/code-style.md +2 -0
- package/rules/mui.md +1 -1
- package/rules/nextjs.md +1 -1
- package/rules/npm-yarn.md +36 -6
- package/rules/nx.md +6 -6
- package/rules/typescript.md +13 -7
- package/rules/webstorm.md +20 -0
- package/index.d.ts +0 -281
package/rules/nx.md
CHANGED
|
@@ -23,9 +23,9 @@ paths:
|
|
|
23
23
|
- Commit changes to root `package.json` or `yarn.lock` or `nx.json` ONLY as `chore` otherwise ALL packages will be bumped
|
|
24
24
|
- https://github.com/nrwl/nx/issues/34542 (root file changes → all bumped)
|
|
25
25
|
- NX Release attributes commits to projects by FILE PATHS via `nx affected` against the CURRENT graph — commit scope (`feat(pkg):`) does not limit attribution
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- https://github.com/nrwl/nx/issues/34277 (scans too much, slow, warnings for removed)
|
|
26
|
+
- NX ≥ 23.2 (23.2.0-beta.5+): deleted projects no longer affect all projects during RELEASE attribution (https://github.com/nrwl/nx/pull/36538) — packages can be deleted/renamed freely, no tombstones needed; commit the deletion as `chore:` (generic `nx affected` keeps the conservative "deleted → all affected" fallback)
|
|
27
|
+
- NX < 23.2: NEVER fully delete (or `nx g move`-rename) a package — a historical `feat`/`fix` that touched a `package.json`/`project.json` which no longer exists on disk is attributed to ALL projects, and mass-bumps the whole workspace on the very next release run (even a `chore` push) — https://github.com/nrwl/nx/issues/33374
|
|
28
|
+
- leave a tombstone `package.json` at the EXACT old path (`private: true`, no scripts), and exclude it in `release.projects` (`!packages/<retired>`) so it's never versioned/published;
|
|
29
|
+
- removable once EVERY package has a tag newer than the last `feat`/`fix` that touched the retired `package.json` — or after upgrading to NX ≥ 23.2;
|
|
30
|
+
- moving the tombstone elsewhere breaks it — the check is on the historical file path
|
|
31
|
+
- https://github.com/nrwl/nx/issues/34277 (scans too much, slow, warnings for removed) — still open
|
package/rules/typescript.md
CHANGED
|
@@ -25,7 +25,9 @@ paths:
|
|
|
25
25
|
- `isolatedDeclarations: true`: USE ONLY FOR PUBLISHED LIBRARIES, enables faster declaration emit and requires explicit type annotations on exports
|
|
26
26
|
- In such case all exported functions and variables must have explicit type annotations:
|
|
27
27
|
- `strictNullChecks: true`: Null and undefined are distinct types
|
|
28
|
-
- `moduleResolution: "bundler"`
|
|
28
|
+
- `moduleResolution: "bundler"`: MANDATORY for ALL TypeScript projects, no exceptions — never `node16`/`nodenext`/`node10`
|
|
29
|
+
- Keeps import specifiers extensionless (`next/link`, `./file`), which is what every bundler and every modern runtime target expects; `node16`/`nodenext` would force `.js` suffixes on source that never runs through Node's own resolver
|
|
30
|
+
- Requires `module: "esnext"` (or `preserve`) — `bundler` is rejected with CommonJS-emitting `module` settings
|
|
29
31
|
- `jsx: "react-jsx"`: Modern JSX transform (no React default import needed)
|
|
30
32
|
|
|
31
33
|
# File Structure
|
|
@@ -79,14 +81,18 @@ paths:
|
|
|
79
81
|
6. Local CSS (e.g. `./styles.css`)
|
|
80
82
|
- Side-effect imports (polyfills, CSS) are sorted into their group too; the linter only keeps the written order of multiple side-effect imports landing in the _same_ group, so sequence order-dependent ones yourself
|
|
81
83
|
|
|
84
|
+
# Published Libraries
|
|
85
|
+
|
|
86
|
+
- Publish ESM ONLY — NEVER add a `require` condition or a CJS build; the sole exception is a file a tool can only load as CJS (`@kirill.konshin/lint`'s `./yarn` entry, forced by Yarn constraints), which ships as an explicit `.cjs` with its own `.d.cts`
|
|
87
|
+
- `exports` conditions must be FLAT and `types`-first (`{types, import, default}`) — a nested or `import`-only map matches NO condition outside `import`, so CJS resolvers get `ERR_PACKAGE_PATH_NOT_EXPORTED` (the entry is invisible, not merely interop-incompatible); `default` is the catch-all, not a CJS build, and Node >= 22.12 loads the ESM behind it through `require()`
|
|
88
|
+
- Next.js transpiles `next.config.ts` to CommonJS and `require()`s it, so config-only helpers MUST be reachable this way — keep them in their own subpath that imports nothing at runtime
|
|
89
|
+
- Every subpath export needs its OWN bundler entry — a pure re-export barrel that is merely reachable from the main entry gets inlined, and its `dist/<mod>/index.js` is never written
|
|
90
|
+
- NEVER import an OPTIONAL peerDependency at runtime, not even for a single constant — inline it (annotate with `typeof` of a type-only import as a drift guard); a barrel re-exporting such a module makes the WHOLE entry unresolvable when the peer is absent
|
|
91
|
+
|
|
82
92
|
# Type Annotation Patterns
|
|
83
93
|
|
|
84
|
-
- Use `interface` only for declaration merging/augmentation (e.g. extending a third-party global
|
|
85
|
-
|
|
86
|
-
for `interface`
|
|
87
|
-
- This is enforced by lint (`@typescript-eslint/consistent-type-definitions`), which can't special-case
|
|
88
|
-
augmentation - when it's genuinely needed, add
|
|
89
|
-
`// eslint-disable-next-line @typescript-eslint/consistent-type-definitions` above the `interface`
|
|
94
|
+
- Use `interface` only for declaration merging/augmentation (e.g. extending a third-party global interface) - a class can `implements` a `type` alias just as well, so that's not a reason to reach for `interface`
|
|
95
|
+
- This is enforced by lint (`@typescript-eslint/consistent-type-definitions`), which can't special-case augmentation - when it's genuinely needed, add `// eslint-disable-next-line @typescript-eslint/consistent-type-definitions` above the `interface`
|
|
90
96
|
- Prefer to inline types into function signature or variable declarations
|
|
91
97
|
- Introduce types when reused or complex. Avoid creating a type for every single thing
|
|
92
98
|
- Try to reuse types that exist in project (e.g. redux state, zod schema, component props, final function signature can have one shared type + derivatives like `Omit<>`, `Partial<>` etc.)
|
package/rules/webstorm.md
CHANGED
|
@@ -177,3 +177,23 @@ Applies if project is using Tailwind.
|
|
|
177
177
|
</component>
|
|
178
178
|
</project>
|
|
179
179
|
```
|
|
180
|
+
|
|
181
|
+
# Configure `indexLayout.xml`
|
|
182
|
+
|
|
183
|
+
Ban build directories from search using examples:
|
|
184
|
+
|
|
185
|
+
```xml
|
|
186
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
187
|
+
<project version="4">
|
|
188
|
+
<component name="UserContentModel">
|
|
189
|
+
<attachedFolders />
|
|
190
|
+
<explicitIncludes>
|
|
191
|
+
</explicitIncludes>
|
|
192
|
+
<explicitExcludes>
|
|
193
|
+
<Path>path-to-eve/.eve</Path>
|
|
194
|
+
<Path>path-to-vite/dist</Path>
|
|
195
|
+
<Path>path-to-next/.next</Path>
|
|
196
|
+
</explicitExcludes>
|
|
197
|
+
</component>
|
|
198
|
+
</project>
|
|
199
|
+
```
|
package/index.d.ts
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Hand-written declarations for the raw-JS package (see README "Why raw JS" - there is no build to
|
|
3
|
-
* emit them from). Keep in sync with index.js / configs/*.js and their JSDoc.
|
|
4
|
-
*
|
|
5
|
-
* Types are pulled from the real underlying packages wherever they export them (eslint's
|
|
6
|
-
* `Linter.Config`, eslint-plugin-tailwindcss's `PluginSettings`, prettier's `Config`,
|
|
7
|
-
* lint-staged's `Configuration`, the plugins' own default-export types), so the options here stay
|
|
8
|
-
* in sync with how the tools themselves define their configs. `@next/eslint-plugin-next` exports
|
|
9
|
-
* no settings type - `NextOptions.rootDir` mirrors its documented `settings.next.rootDir` schema.
|
|
10
|
-
*/
|
|
11
|
-
import type { ParserOptions as TsParserOptions } from '@typescript-eslint/parser';
|
|
12
|
-
import type { Linter } from 'eslint';
|
|
13
|
-
import type { PluginSettings as TailwindPluginSettings } from 'eslint-plugin-tailwindcss';
|
|
14
|
-
import type { Configuration as LintStagedConfiguration } from 'lint-staged';
|
|
15
|
-
import type { Config as PrettierConfig } from 'prettier';
|
|
16
|
-
|
|
17
|
-
type ProjectServiceOptions = Exclude<NonNullable<TsParserOptions['projectService']>, boolean>;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Base shape of every tool's options object. Using the object form implies the tool is ON -
|
|
21
|
-
* `enabled` defaults to `true`, so a partially configured tool doesn't also need a separate
|
|
22
|
-
* `true` anywhere; set `enabled: false` to force it off while keeping the other options in place.
|
|
23
|
-
*/
|
|
24
|
-
export type ToggleOptions = {
|
|
25
|
-
enabled?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Detection behavior ({@link defineLintConfig} `detection`) - the same toggle notation as the
|
|
30
|
-
* tool flags:
|
|
31
|
-
* - `undefined` / `true` / `{}` - tools default ON via full auto-detection
|
|
32
|
-
* - `false` / `{ enabled: false }` - tools default OFF; explicitly enabled tools still
|
|
33
|
-
* auto-detect their settings
|
|
34
|
-
* - `strict: true` - same-scope package probes only (exactly what the `has*` checks are): no
|
|
35
|
-
* evidence scans; mandatory settings like `cssConfigPath` must be explicit, and `nx.json` is
|
|
36
|
-
* checked at cwd instead of the workspace root. `{ enabled: false, strict: true }` is ideal for
|
|
37
|
-
* per-package monorepo configs.
|
|
38
|
-
*/
|
|
39
|
-
export type DetectionOptions = ToggleOptions & {
|
|
40
|
-
/** same-scope package probes only - no workspace evidence scans */
|
|
41
|
-
strict?: boolean;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** Options for the Next.js blocks ({@link nextBaseConfig}). */
|
|
45
|
-
export type NextOptions = ToggleOptions & {
|
|
46
|
-
/**
|
|
47
|
-
* Root of the Next.js app(s) for `@next/eslint-plugin-next` (`settings.next.rootDir`) - needed
|
|
48
|
-
* when the apps don't live at the workspace root, e.g. `path/to/next-app` (globs are supported
|
|
49
|
-
* by the plugin; pass the package root, not `src` - the plugin resolves both the `pages`/`app`
|
|
50
|
-
* and `src/pages`/`src/app` layouts from it). When omitted, auto-detected via
|
|
51
|
-
* {@link findNextRoots}: no evidence found → no settings (the setting is optional), several
|
|
52
|
-
* apps → all of them as an array.
|
|
53
|
-
*
|
|
54
|
-
* @see https://nextjs.org/docs/app/api-reference/config/eslint
|
|
55
|
-
*/
|
|
56
|
-
rootDir?: string | string[];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/** Options for the Tailwind block ({@link tailwindConfig}). */
|
|
60
|
-
export type TailwindOptions = ToggleOptions & {
|
|
61
|
-
/**
|
|
62
|
-
* Tailwind v4 entry CSS for `eslint-plugin-tailwindcss` (`settings.tailwindcss.cssConfigPath`),
|
|
63
|
-
* absolute or relative to the lint working directory. When omitted, auto-detected via
|
|
64
|
-
* {@link findTailwindEntry}.
|
|
65
|
-
*/
|
|
66
|
-
cssConfigPath?: TailwindPluginSettings['cssConfigPath'];
|
|
67
|
-
/**
|
|
68
|
-
* Scope the Tailwind rules to the workspace package that owns the entry CSS (emitted as the
|
|
69
|
-
* block's `basePath`, ESLint >= 9.30) instead of the whole workspace. No-op when the entry is
|
|
70
|
-
* owned by the workspace root itself (single-package repo, or not inside a declared
|
|
71
|
-
* workspace package).
|
|
72
|
-
*
|
|
73
|
-
* @default true
|
|
74
|
-
*/
|
|
75
|
-
scoped?: boolean;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Options for the type-aware block ({@link typeAwareConfig}). `allowDefaultProject` and
|
|
80
|
-
* `maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING` are typescript-eslint's own
|
|
81
|
-
* `projectService` options (real types). `allowDefaultProject` has NO default - generate the file
|
|
82
|
-
* list with {@link scanWorkspace} (absolute entries are relativized against `tsconfigRootDir`
|
|
83
|
-
* automatically); the match cap defaults to that list's length when it is given (set it explicitly
|
|
84
|
-
* when using multi-match globs); `tsconfigRootDir` defaults to the detected workspace root.
|
|
85
|
-
*/
|
|
86
|
-
export type TypeAwareOptions = ToggleOptions &
|
|
87
|
-
Pick<
|
|
88
|
-
ProjectServiceOptions,
|
|
89
|
-
'allowDefaultProject' | 'maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING'
|
|
90
|
-
> & {
|
|
91
|
-
/** Defaults to {@link findWorkspaceRoot}. */
|
|
92
|
-
tsconfigRootDir?: TsParserOptions['tsconfigRootDir'];
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/** Options for the default-ignore block ({@link defaultIgnoreConfig}). */
|
|
96
|
-
export type DefaultIgnoreOptions = ToggleOptions & {
|
|
97
|
-
/**
|
|
98
|
-
* `import.meta.url` of the consumer's `eslint.config.mjs` - the `.gitignore` and
|
|
99
|
-
* `.prettierignore` files are resolved next to it. Required: the config file location cannot
|
|
100
|
-
* be auto-detected.
|
|
101
|
-
*/
|
|
102
|
-
importMetaUrl: string;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Per-tool toggles for {@link defineLintConfig}. Every flag is optional:
|
|
107
|
-
* - `undefined` (default) - auto-detect via the corresponding `has*` export
|
|
108
|
-
* - `true` or an options object - force the tool's blocks ON (use when detection misses a tool
|
|
109
|
-
* that lives only in leaf packages of a monorepo); in the object form `enabled` defaults to
|
|
110
|
-
* `true` and can be set to `false` to force OFF while keeping the other options in place
|
|
111
|
-
* - `false` - force OFF
|
|
112
|
-
*
|
|
113
|
-
* The gated `*Config()` block functions accept the same flag value directly.
|
|
114
|
-
*/
|
|
115
|
-
export type LintOptions = {
|
|
116
|
-
/** Detection behavior: default tool state + strict mode; see {@link DetectionOptions} */
|
|
117
|
-
detection?: boolean | DetectionOptions;
|
|
118
|
-
/** Next.js (`eslint-config-next`); when off, generic React/JSX rules apply instead */
|
|
119
|
-
next?: boolean | NextOptions;
|
|
120
|
-
/** Storybook (`eslint-plugin-storybook`) */
|
|
121
|
-
storybook?: boolean | ToggleOptions;
|
|
122
|
-
/** Turborepo (`eslint-plugin-turbo`) */
|
|
123
|
-
turbo?: boolean | ToggleOptions;
|
|
124
|
-
/** Nx (`@nx/eslint-plugin` base + `@nx/dependency-checks`) */
|
|
125
|
-
nx?: boolean | ToggleOptions;
|
|
126
|
-
/** Jest recommended rules for `*.{test,spec}.*` */
|
|
127
|
-
jest?: boolean | ToggleOptions;
|
|
128
|
-
/** Vitest recommended rules for `*.{test,spec}.*` */
|
|
129
|
-
vitest?: boolean | ToggleOptions;
|
|
130
|
-
/** Tailwind (`eslint-plugin-tailwindcss`); forcing ON without a resolvable entry CSS is a hard error, several entry CSS candidates always are */
|
|
131
|
-
tailwind?: boolean | TailwindOptions;
|
|
132
|
-
/** Type-aware TypeScript rules; off by default (slow), nothing to auto-detect */
|
|
133
|
-
typeAware?: boolean | TypeAwareOptions;
|
|
134
|
-
/** `.gitignore` + `.prettierignore` as ESLint ignores; off by default, `true` without `importMetaUrl` is a hard error */
|
|
135
|
-
defaultIgnore?: boolean | DefaultIgnoreOptions;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Build the shared flat ESLint config. By default every tool integration is auto-detected (see the
|
|
140
|
-
* `has*` exports); pass {@link LintOptions} to force any of them on/off or to supply tool-specific
|
|
141
|
-
* settings. ESLint natively awaits a Promise default export, so a plain
|
|
142
|
-
* `export default defineLintConfig({...})` works; `await` it only when composing with extra blocks.
|
|
143
|
-
*/
|
|
144
|
-
export function defineLintConfig(
|
|
145
|
-
options?: LintOptions | Promise<LintOptions> | (() => LintOptions | Promise<LintOptions>),
|
|
146
|
-
): Promise<Linter.Config[]>;
|
|
147
|
-
|
|
148
|
-
// ----- Blocks (in the order defineLintConfig applies them; from configs/*.js) -----
|
|
149
|
-
// Gated blocks take their LintOptions flag and return [] when resolved off.
|
|
150
|
-
|
|
151
|
-
/** Core JS recommended rules, global ignores, browser + Node globals, and core-rule overrides. */
|
|
152
|
-
export function baseConfig(): Linter.Config[];
|
|
153
|
-
/**
|
|
154
|
-
* `.gitignore` + `.prettierignore` (next to the consumer's config file, both must exist) as
|
|
155
|
-
* ESLint ignores. Off by default; enabling without `importMetaUrl` is a hard error.
|
|
156
|
-
*/
|
|
157
|
-
export function defaultIgnoreConfig(option?: boolean | DefaultIgnoreOptions): Linter.Config[];
|
|
158
|
-
/** The whole `eslint-config-next` flat config, plus `settings.next.rootDir` when given. Next-only, ungated. */
|
|
159
|
-
export function nextBaseConfig(options?: NextOptions): Promise<Linter.Config[]>;
|
|
160
|
-
/** React/React Hooks/jsx-a11y rules for non-Next (e.g. Vite) React projects. Ungated. */
|
|
161
|
-
export function reactBaseConfig(): Linter.Config[];
|
|
162
|
-
/** Chooser: {@link nextBaseConfig} when Next is enabled, the {@link reactBaseConfig} fallback otherwise. */
|
|
163
|
-
export function nextConfig(option?: boolean | NextOptions, strict?: boolean): Promise<Linter.Config[]>;
|
|
164
|
-
/**
|
|
165
|
-
* The whole React family in its load-bearing order - {@link nextConfig} (Next is just a shortcut
|
|
166
|
-
* to an opinionated React/TypeScript setup), then {@link typescriptOverridesConfig},
|
|
167
|
-
* {@link nextOverridesConfig} and {@link reactSettingsConfig}, which apply no matter whether Next
|
|
168
|
-
* or plain React won. Used by {@link defineLintConfig}; `option` is the `next` flag.
|
|
169
|
-
*/
|
|
170
|
-
export function reactConfig(option?: boolean | NextOptions, strict?: boolean): Promise<Linter.Config[]>;
|
|
171
|
-
/** `eslint-config-next/typescript` (typescript-eslint wiring, which stems from Next) + deliberate rule overrides. */
|
|
172
|
-
export function typescriptOverridesConfig(): Linter.Config[];
|
|
173
|
-
/** Overrides of rules set by `eslint-config-next` (always applied, harmless without Next). */
|
|
174
|
-
export function nextOverridesConfig(): Linter.Config[];
|
|
175
|
-
/** React version settings workaround (ESLint 10 + Next). Always applied. */
|
|
176
|
-
export function reactSettingsConfig(): Linter.Config[];
|
|
177
|
-
/** Prettier compatibility (`eslint-config-prettier/flat`). */
|
|
178
|
-
export function prettierConfig(): Linter.Config[];
|
|
179
|
-
/** Storybook recommended rules. */
|
|
180
|
-
export function storybookConfig(option?: boolean | ToggleOptions, strict?: boolean): Promise<Linter.Config[]>;
|
|
181
|
-
/** eslint-plugin-import-x recommended rules + overrides + the default-export relaxation for conventional files. */
|
|
182
|
-
export function importXConfig(): Linter.Config[];
|
|
183
|
-
/** Deterministic import ordering (eslint-plugin-simple-import-sort). */
|
|
184
|
-
export function importSortConfig(): Linter.Config[];
|
|
185
|
-
/** Autofixable removal of unused imports. */
|
|
186
|
-
export function unusedImportsConfig(): Linter.Config[];
|
|
187
|
-
/** eslint-plugin-promise recommended rules + overrides. */
|
|
188
|
-
export function promiseConfig(): Linter.Config[];
|
|
189
|
-
/** Filename casing + node: protocol (two hand-picked unicorn rules). */
|
|
190
|
-
export function unicornConfig(): Linter.Config[];
|
|
191
|
-
/** Type-aware rules via typescript-eslint's projectService; off unless the flag is set (nothing to auto-detect). */
|
|
192
|
-
export function typeAwareConfig(option?: boolean | TypeAwareOptions, strict?: boolean): Linter.Config[];
|
|
193
|
-
/** Turborepo rules. */
|
|
194
|
-
export function turboConfig(option?: boolean | ToggleOptions): Promise<Linter.Config[]>;
|
|
195
|
-
/**
|
|
196
|
-
* Tailwind recommended rules. Explicit `cssConfigPath` wins; otherwise auto-found via
|
|
197
|
-
* {@link findTailwindEntry}. Zero entries: inert when auto-detected, throws when forced on
|
|
198
|
-
* (`true`/options). Several entries ALWAYS throw - pass `cssConfigPath` to pick one.
|
|
199
|
-
*/
|
|
200
|
-
export function tailwindConfig(option?: boolean | TailwindOptions, strict?: boolean): Promise<Linter.Config[]>;
|
|
201
|
-
/** Nx plugin registration + `@nx/dependency-checks`. */
|
|
202
|
-
export function nxConfig(option?: boolean | ToggleOptions, strict?: boolean): Promise<Linter.Config[]>;
|
|
203
|
-
/** Jest recommended rules, scoped to test files. */
|
|
204
|
-
export function jestConfig(option?: boolean | ToggleOptions, strict?: boolean): Linter.Config[];
|
|
205
|
-
/** Vitest recommended rules + globals, scoped to test files. */
|
|
206
|
-
export function vitestConfig(option?: boolean | ToggleOptions, strict?: boolean): Linter.Config[];
|
|
207
|
-
/** Runner-agnostic test rules (consistent-test-it, test colocation). Always applied. */
|
|
208
|
-
export function testConfig(): Linter.Config[];
|
|
209
|
-
|
|
210
|
-
// ----- Detection (module-load time capability probes, exported for debugging; from lib.js) -----
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Workspace root of the consumer project - the anchor for every config-file scan and for `nx.json`
|
|
214
|
-
* detection. Resolved from the package manager (env: Yarn Berry `PROJECT_CWD` / npm
|
|
215
|
-
* `npm_config_local_prefix`; CLIs: `pnpm root -w`, Yarn Berry via `yarn node`, `npm prefix`),
|
|
216
|
-
* falling back to a lockfile walk bounded by `.git`; every candidate must contain `cwd`.
|
|
217
|
-
* Cached per `cwd`.
|
|
218
|
-
*/
|
|
219
|
-
export function findWorkspaceRoot(cwd?: string): string;
|
|
220
|
-
|
|
221
|
-
export const hasNext: boolean;
|
|
222
|
-
export const hasStorybook: boolean;
|
|
223
|
-
export const hasVite: boolean;
|
|
224
|
-
export const hasJest: boolean;
|
|
225
|
-
export const hasVitest: boolean;
|
|
226
|
-
export const hasTurbo: boolean;
|
|
227
|
-
export const hasNx: boolean;
|
|
228
|
-
export const hasTailwind: boolean;
|
|
229
|
-
|
|
230
|
-
// ----- Extension lists (from lib.js) -----
|
|
231
|
-
|
|
232
|
-
export const tsExtsRaw: string;
|
|
233
|
-
export const eslintExtsRaw: string;
|
|
234
|
-
export const prettierExtsRaw: string;
|
|
235
|
-
export const tsExts: string;
|
|
236
|
-
export const eslintExts: string;
|
|
237
|
-
export const prettierExts: string;
|
|
238
|
-
|
|
239
|
-
// ----- Plugin re-exports (detection-gated at module load; null when the tool wasn't detected) -----
|
|
240
|
-
|
|
241
|
-
export const nextPlugin: typeof import('@next/eslint-plugin-next').default | null;
|
|
242
|
-
export const nxPlugin: typeof import('@nx/eslint-plugin').default | null;
|
|
243
|
-
export const turboPlugin: typeof import('eslint-plugin-turbo').default | null;
|
|
244
|
-
export const jestPlugin: typeof import('eslint-plugin-jest');
|
|
245
|
-
export const vitestPlugin: typeof import('@vitest/eslint-plugin').default;
|
|
246
|
-
|
|
247
|
-
// ----- Helpers & companion configs -----
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Auto-find the Tailwind v4 entry CSS: the single `*.css` (scanned across the workspace root and
|
|
251
|
-
* every workspace package, skipping `.gitignore`d files and build outputs) containing
|
|
252
|
-
* `@import "tailwindcss"`; null when zero or several match.
|
|
253
|
-
*/
|
|
254
|
-
export function findTailwindEntry(ignores: string[]): string | null;
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Auto-find Next.js app roots (scanned across the workspace root and every workspace package,
|
|
258
|
-
* skipping `.gitignore`d files and build outputs). `next.config.*` is optional in Next.js, so any of three
|
|
259
|
-
* signals marks an app root: a `next.config.*`, a `package.json` depending on `next`
|
|
260
|
-
* (dependencies/devDependencies - peer declarations mark libraries, not apps), or a
|
|
261
|
-
* `src/app`/`src/pages` directory (the reported root is the directory containing `src`);
|
|
262
|
-
* deduplicated and sorted.
|
|
263
|
-
*/
|
|
264
|
-
export function findNextRoots(ignores: string[]): string[];
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Glob for config-file candidates across the workspace - the root directory plus every workspace
|
|
268
|
-
* package (the real `workspaces` globs, not a depth heuristic) - skipping dot dirs unless `dot`,
|
|
269
|
-
* build outputs, extra `ignores` and everything in the root `.gitignore`.
|
|
270
|
-
* Returns absolute paths - useful for building file lists like `typeAware.allowDefaultProject`.
|
|
271
|
-
*/
|
|
272
|
-
export function scanWorkspace(fileGlob: string, ignores?: string[], options?: { dot?: boolean }): string[];
|
|
273
|
-
|
|
274
|
-
/** Convert an ignore file (`.gitignore`, `.prettierignore`) into an ESLint ignores block. */
|
|
275
|
-
export function includeIgnoreFile(importMetaUrl: string, ignoreFile: string): Linter.Config;
|
|
276
|
-
|
|
277
|
-
/** Shared Prettier configuration (`.prettierrc.mjs`: `export default prettier`). */
|
|
278
|
-
export const prettier: PrettierConfig;
|
|
279
|
-
|
|
280
|
-
/** Shared lint-staged configuration (`.lintstagedrc.mjs`: `export default listStaged`). */
|
|
281
|
-
export const listStaged: LintStagedConfiguration;
|