@eslinted/core 5.0.0-rc.4 → 5.0.0-rc.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,7 @@
1
1
  import type { Input } from "./index.js";
2
2
  export declare class Files {
3
- private readonly input;
4
3
  private readonly _files;
5
- constructor(input: Input["files"]);
4
+ constructor(files: Input["files"]);
6
5
  files(scope: string): string[];
7
6
  }
8
7
  //# sourceMappingURL=files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/factory/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE/B,qBAAa,KAAK;IAGJ,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;gBAEzB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAc3C,KAAK,CAAC,KAAK,EAAE,MAAM,GAIS,MAAM,EAAE;CAE5C"}
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/factory/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE/B,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;gBAE1C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAc1B,KAAK,CAAC,KAAK,EAAE,MAAM,GAIS,MAAM,EAAE;CAE5C"}
@@ -1,12 +1,10 @@
1
1
  export class Files {
2
- input;
3
2
  _files = new Map();
4
- constructor(input) {
5
- this.input = input;
6
- const { files, includes } = this.input, scopes = Object.keys(files);
3
+ constructor(files) {
4
+ const { files: base, includes } = files, scopes = Object.keys(base);
7
5
  for (const scope of scopes)
8
6
  this._files.set(scope, [
9
- ...files[scope],
7
+ ...base[scope],
10
8
  ...scope in includes ? includes[scope] : [],
11
9
  ]);
12
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../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QAAQ,CAAC,KAAK,CAAc,CAAC,CAAC,CAAC,EAAE;aAC1D,CACF,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,KAAa;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YACzB,MAAM,IAAI,cAAc,CAAC,8BAA8B,KAAK,EAAE,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAa,CAAC;IAC5C,CAAC;CACF"}
@@ -2,9 +2,8 @@ import type { Input } from "../index.js";
2
2
  export type { Input };
3
3
  import { Ruleset } from "./ruleset.js";
4
4
  export declare class Rulesets {
5
- private readonly input;
6
5
  private readonly rulesets;
7
- constructor(input: Input["rules"]);
6
+ constructor(rules: Input["rules"]);
8
7
  ruleset(scope: string): Ruleset;
9
8
  }
10
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factory/rulesets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAEhC,YAAY,EAAE,KAAK,EAAE,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,QAAQ;IAGP,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;gBAE1B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAQ3C,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAMvC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factory/rulesets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAEhC,YAAY,EAAE,KAAK,EAAE,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;gBAE3C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAQ1B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAMvC"}
@@ -1,12 +1,10 @@
1
1
  import { Ruleset } from "./ruleset.js";
2
2
  export class Rulesets {
3
- input;
4
3
  rulesets = new Map();
5
- constructor(input) {
6
- this.input = input;
7
- const { rules, overrides } = this.input, scopes = Object.keys(rules);
4
+ constructor(rules) {
5
+ const { rules: base, overrides } = rules, scopes = Object.keys(base);
8
6
  for (const scope of scopes)
9
- this.rulesets.set(scope, new Ruleset(scope, rules[scope], overrides[scope]));
7
+ this.rulesets.set(scope, new Ruleset(scope, base[scope], overrides[scope]));
10
8
  }
11
9
  ruleset(scope) {
12
10
  if (!this.rulesets.has(scope))
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factory/rulesets/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,QAAQ;IAGU;IAFZ,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEvD,YAA6B,KAAqB;QAArB,UAAK,GAAL,KAAK,CAAgB;QAChD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,EACvC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAA2B,CAAC;QAEtD,KAAK,MAAM,KAAK,IAAI,MAAM;YACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IAEM,OAAO,CAAC,KAAa;QAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;YAC3B,MAAM,IAAI,cAAc,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;QAEpE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAY,CAAC;IAC7C,CAAC;CACF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factory/rulesets/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,QAAQ;IACF,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEvD,YAAY,KAAqB;QAC/B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EACxC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAA0B,CAAC;QAEpD,KAAK,MAAM,KAAK,IAAI,MAAM;YACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;IAEM,OAAO,CAAC,KAAa;QAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;YAC3B,MAAM,IAAI,cAAc,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;QAEpE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAY,CAAC;IAC7C,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -2,25 +2,5 @@ export type { Scope } from "./scopes.js";
2
2
  import type { Input } from "./input/index.js";
3
3
  import type { Output } from "./output.js";
4
4
  export type { Input, Output };
5
- import { scopes } from "./scopes.js";
6
- export default function (plugins: Input["plugins"], parsers: Input["parsers"], files: Input["files"], rules: Input["rules"]): Output;
7
- declare namespace Core {
8
- type Scopes = typeof scopes[number];
9
- namespace Input {
10
- type Parsers = Input["parsers"];
11
- type Plugins = Input["plugins"];
12
- type Files = Input["files"];
13
- namespace Files {
14
- type Base = Files["files"];
15
- type Includes = Files["includes"];
16
- }
17
- type Rules = Input["rules"];
18
- namespace Rules {
19
- type Base = Rules["rules"];
20
- type Overrides = Rules["overrides"];
21
- }
22
- }
23
- type Output = Output[];
24
- }
25
- export type { Core };
5
+ export default function (input: Input): Output;
26
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAOlC,MAAM,CAAC,OAAO,WACZ,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EACzB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EACzB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,GACpB,MAAM,CAkER;AAGD,kBAAU,IAAI,CAAC;IACb,KAAY,MAAM,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,UAAiB,KAAK,CAAC;QACrB,KAAY,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QACvC,KAAY,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QACvC,KAAY,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,UAAiB,KAAK,CAAC;YACrB,KAAY,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;YAClC,KAAY,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;SAC1C;QACD,KAAY,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,UAAiB,KAAK,CAAC;YACrB,KAAY,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;YAClC,KAAY,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;SAC5C;KACF;IACD,KAAY,MAAM,GAAG,MAAM,EAAE,CAAC;CAC/B;AAED,YAAY,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAS9B,MAAM,CAAC,OAAO,WAAW,KAAK,EAAE,KAAK,GAAG,MAAM,CAmE7C"}
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
1
  import { scopes } from "./scopes.js";
2
2
  import { Files, Rulesets, Options, } from "./factory/index.js";
3
- export default function (plugins, parsers, files, rules) {
3
+ export default function (input) {
4
4
  try {
5
- const F = new Files(files), R = new Rulesets(rules), options = {
5
+ const files = new Files(input.files), rulesets = new Rulesets(input.rules), { parsers, plugins } = input, options = {
6
6
  js: new Options
7
- .js({ "@stylistic": plugins["@stylistic"] }, [], F.files("js"), R.ruleset("js")).configs,
7
+ .js({ "@stylistic": plugins["@stylistic"] }, [], files.files("js"), rulesets.ruleset("js")).configs,
8
8
  ts: new Options
9
- .ts({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] }, [parsers.ts], F.files("ts"), R.ruleset("ts")).configs,
9
+ .ts({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] }, [parsers.ts], files.files("ts"), rulesets.ruleset("ts")).configs,
10
10
  svelte: new Options
11
- .svelte({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte }, [parsers.svelte, parsers.ts], F.files("svelte"), R.ruleset("svelte")).configs,
11
+ .svelte({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte }, [parsers.svelte, parsers.ts], files.files("svelte"), rulesets.ruleset("svelte")).configs,
12
12
  mocha: new Options
13
- .mocha({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha }, [parsers.ts], F.files("mocha"), R.ruleset("mocha")).configs,
13
+ .mocha({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha }, [parsers.ts], files.files("mocha"), rulesets.ruleset("mocha")).configs,
14
14
  html: new Options
15
- .html({ "@html-eslint": plugins["@html-eslint"] }, [parsers.html], F.files("html"), R.ruleset("html")).configs,
15
+ .html({ "@html-eslint": plugins["@html-eslint"] }, [parsers.html], files.files("html"), rulesets.ruleset("html")).configs,
16
16
  json: new Options
17
- .json({ jsonc: plugins.jsonc }, [parsers.jsonc], F.files("json"), R.ruleset("json")).configs,
17
+ .json({ jsonc: plugins.jsonc }, [parsers.jsonc], files.files("json"), rulesets.ruleset("json")).configs,
18
18
  jsonc: new Options
19
- .jsonc({ jsonc: plugins.jsonc }, [parsers.jsonc], F.files("jsonc"), R.ruleset("jsonc")).configs,
19
+ .jsonc({ jsonc: plugins.jsonc }, [parsers.jsonc], files.files("jsonc"), rulesets.ruleset("jsonc")).configs,
20
20
  yml: new Options
21
- .yml({ yml: plugins.yml }, [parsers.yml], F.files("yml"), R.ruleset("yml")).configs,
21
+ .yml({ yml: plugins.yml }, [parsers.yml], files.files("yml"), rulesets.ruleset("yml")).configs,
22
22
  };
23
23
  return scopes.flatMap(scope => options[scope]);
24
24
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../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C,CAC1B,CAAC,OAAO;YACX,GAAG,EAAE,IAAI,OAAO;iBACb,GAAG,CACF,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EACpB,CAAC,OAAO,CAAC,GAAG,CAAC,EACb,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAClB,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CACxB,CAAC,OAAO;SACZ,CAAC;QAEF,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_schemaVersion": "20.18.0",
3
3
  "name": "@eslinted/core",
4
- "version": "5.0.0-rc.4",
4
+ "version": "5.0.0-rc.6",
5
5
  "description": "Core ESLint flat config factory npm package `linted`.",
6
6
  "keywords": [],
7
7
  "repository": "github:jimmy-zhening-luo/linted-core",
@@ -3,15 +3,15 @@ import type { Input } from ".";
3
3
  export class Files {
4
4
  private readonly _files = new Map<string, string[]>();
5
5
 
6
- constructor(private readonly input: Input["files"]) {
7
- const { files, includes } = this.input,
8
- scopes = Object.keys(files) as (keyof typeof files)[];
6
+ constructor(files: Input["files"]) {
7
+ const { files: base, includes } = files,
8
+ scopes = Object.keys(base) as (keyof typeof base)[];
9
9
 
10
10
  for (const scope of scopes)
11
11
  this._files.set(
12
12
  scope,
13
13
  [
14
- ...files[scope],
14
+ ...base[scope],
15
15
  ...scope in includes ? (includes[scope] as string[]) : [],
16
16
  ],
17
17
  );
@@ -7,12 +7,12 @@ import { Ruleset } from "./ruleset";
7
7
  export class Rulesets {
8
8
  private readonly rulesets = new Map<string, Ruleset>();
9
9
 
10
- constructor(private readonly input: Input["rules"]) {
11
- const { rules, overrides } = this.input,
12
- scopes = Object.keys(rules) as (keyof typeof rules)[];
10
+ constructor(rules: Input["rules"]) {
11
+ const { rules: base, overrides } = rules,
12
+ scopes = Object.keys(base) as (keyof typeof base)[];
13
13
 
14
14
  for (const scope of scopes)
15
- this.rulesets.set(scope, new Ruleset(scope, rules[scope], overrides[scope]));
15
+ this.rulesets.set(scope, new Ruleset(scope, base[scope], overrides[scope]));
16
16
  }
17
17
 
18
18
  public ruleset(scope: string): Ruleset {
package/src/index.ts CHANGED
@@ -12,71 +12,67 @@ import {
12
12
  Options,
13
13
  } from "./factory";
14
14
 
15
- export default function (
16
- plugins: Input["plugins"],
17
- parsers: Input["parsers"],
18
- files: Input["files"],
19
- rules: Input["rules"],
20
- ): Output {
15
+ export default function (input: Input): Output {
21
16
  try {
22
- const F = new Files(files),
23
- R = new Rulesets(rules),
17
+ const files = new Files(input.files),
18
+ rulesets = new Rulesets(input.rules),
19
+ { parsers, plugins } = input,
24
20
  options: { [S in typeof scopes[number]]: InstanceType<typeof Options[S]>["configs"] } = {
25
21
  js: new Options
26
22
  .js(
27
23
  { "@stylistic": plugins["@stylistic"] },
28
24
  [],
29
- F.files("js"),
30
- R.ruleset("js"),
25
+ files.files("js"),
26
+ rulesets.ruleset("js"),
31
27
  ).configs,
32
28
  ts: new Options
33
29
  .ts(
34
30
  { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
35
31
  [parsers.ts],
36
- F.files("ts"),
37
- R.ruleset("ts"),
32
+ files.files("ts"),
33
+ rulesets.ruleset("ts"),
38
34
  ).configs,
39
35
  svelte: new Options
40
36
  .svelte(
41
37
  { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
42
38
  [parsers.svelte, parsers.ts],
43
- F.files("svelte"),
44
- R.ruleset("svelte"),
39
+ files.files("svelte"),
40
+ rulesets.ruleset("svelte"),
45
41
  ).configs,
46
42
  mocha: new Options
47
43
  .mocha(
48
44
  { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
49
45
  [parsers.ts],
50
- F.files("mocha"),
51
- R.ruleset("mocha"),
46
+ files.files("mocha"),
47
+ rulesets.ruleset("mocha"),
52
48
  ).configs,
53
49
  html: new Options
54
50
  .html(
55
51
  { "@html-eslint": plugins["@html-eslint"] },
56
52
  [parsers.html],
57
- F.files("html"),
58
- R.ruleset("html"),
53
+ files.files("html"),
54
+ rulesets.ruleset("html"),
59
55
  ).configs,
60
56
  json: new Options
61
57
  .json(
62
58
  { jsonc: plugins.jsonc },
63
59
  [parsers.jsonc],
64
- F.files("json"),
65
- R.ruleset("json"),
60
+ files.files("json"),
61
+ rulesets.ruleset("json"),
66
62
  ).configs,
67
63
  jsonc: new Options
68
64
  .jsonc(
69
65
  { jsonc: plugins.jsonc },
70
66
  [parsers.jsonc],
71
- F.files("jsonc"),
72
- R.ruleset("jsonc"),
67
+ files.files("jsonc"),
68
+ rulesets.ruleset("jsonc"),
73
69
  ).configs,
74
70
  yml: new Options
75
71
  .yml(
76
72
  { yml: plugins.yml },
77
73
  [parsers.yml],
78
- F.files("yml"),
79
- R.ruleset("yml"),
74
+ files.files("yml"),
75
+ rulesets.ruleset("yml"),
80
76
  ).configs,
81
77
  };
82
78
 
@@ -84,27 +80,3 @@ export default function (
84
80
  }
85
81
  catch (e) { throw new Error(`linted-core`, { cause: e }); }
86
82
  }
87
-
88
- // #region DEPRECATED
89
- namespace Core {
90
- export type Scopes = typeof scopes[number];
91
- export namespace Input {
92
- export type Parsers = Input["parsers"];
93
- export type Plugins = Input["plugins"];
94
- export type Files = Input["files"];
95
- export namespace Files {
96
- export type Base = Files["files"];
97
- export type Includes = Files["includes"];
98
- }
99
- export type Rules = Input["rules"];
100
- export namespace Rules {
101
- export type Base = Rules["rules"];
102
- export type Overrides = Rules["overrides"];
103
- }
104
- }
105
- export type Output = Output[];
106
- }
107
-
108
- export type { Core };
109
-
110
- // #endregion