agent-eslint-config 0.1.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/LICENSE +21 -0
- package/README.md +832 -0
- package/dist/index.d.mts +60 -0
- package/dist/index.mjs +760 -0
- package/package.json +61 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import antfu, { OptionsConfig, TypedFlatConfigItem, TypedFlatConfigItem as TypedFlatConfigItem$1 } from "@antfu/eslint-config";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Fully-resolved alias settings consumed by the root-alias rule.
|
|
6
|
+
*
|
|
7
|
+
* Both fields are required here (unlike {@link AliasOption}) because these are
|
|
8
|
+
* the values *after* the factory has applied {@link DEFAULT_ALIAS}. Builders and
|
|
9
|
+
* the root-alias rule read concrete `prefix`/`sourceDir` values, never optionals.
|
|
10
|
+
*/
|
|
11
|
+
interface AliasSettings {
|
|
12
|
+
/** Import-path prefix that stands in for the source root (e.g. `@`). */
|
|
13
|
+
prefix: string;
|
|
14
|
+
/** Source directory the prefix maps to, relative to the project root (e.g. `src`). */
|
|
15
|
+
sourceDir: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The single bespoke option this package adds on top of antfu's {@link OptionsConfig}.
|
|
19
|
+
*
|
|
20
|
+
* `false` disables the root-alias rule entirely; an object customizes it. Both
|
|
21
|
+
* fields are optional so a consumer can override just one and inherit the other
|
|
22
|
+
* from {@link DEFAULT_ALIAS}. Derived from {@link AliasSettings} so the two stay
|
|
23
|
+
* in lockstep (DRY).
|
|
24
|
+
*/
|
|
25
|
+
type AliasOption = false | Partial<AliasSettings>;
|
|
26
|
+
/**
|
|
27
|
+
* Public options for the `config()` factory: a strict superset of antfu's
|
|
28
|
+
* {@link OptionsConfig}, so every antfu toggle (`typescript`, `vue`, `stylistic`,
|
|
29
|
+
* `ignores`, …) passes through unchanged and the package is a drop-in replacement.
|
|
30
|
+
*
|
|
31
|
+
* The only addition is {@link AliasOption `alias`}; the factory strips it before
|
|
32
|
+
* forwarding the remaining options to `antfu()`, since it is not a valid antfu key.
|
|
33
|
+
*/
|
|
34
|
+
interface AgentConfigOptions extends OptionsConfig {
|
|
35
|
+
/**
|
|
36
|
+
* Configure the custom root-alias rule. Defaults to {@link DEFAULT_ALIAS}
|
|
37
|
+
* (`{ prefix: '@', sourceDir: 'src' }`); set to `false` to disable the rule.
|
|
38
|
+
*/
|
|
39
|
+
alias?: AliasOption;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/index.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* Build the agent ESLint flat config: a thin factory over an untouched
|
|
45
|
+
* `@antfu/eslint-config` base with our opinionated rule groups layered on top.
|
|
46
|
+
*
|
|
47
|
+
* Composition is the override guarantee: `antfu(antfuOptions, ...ourItems,
|
|
48
|
+
* ...userConfigs)` emits every one of our blocks BEFORE the user's configs, so
|
|
49
|
+
* any trailing native `{ files, rules }` item wins by last-match-wins. Nothing
|
|
50
|
+
* we ship is locked.
|
|
51
|
+
*
|
|
52
|
+
* @param options - antfu options (passed through unchanged) plus the bespoke
|
|
53
|
+
* `alias` option. The `alias` key is stripped before reaching antfu, since it
|
|
54
|
+
* is not a valid antfu option.
|
|
55
|
+
* @param userConfigs - Native flat-config items appended last to override ours.
|
|
56
|
+
* @returns antfu's `FlatConfigComposer` (supports `.append()`/`.override()`).
|
|
57
|
+
*/
|
|
58
|
+
declare function config(options?: AgentConfigOptions, ...userConfigs: TypedFlatConfigItem$1[]): ReturnType<typeof antfu>;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { type AgentConfigOptions, type AliasOption, type TypedFlatConfigItem, config as default };
|