@eslinted/core 29.1.0 → 29.2.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.
@@ -1,3 +1,3 @@
1
1
  import type Core from "../index.js";
2
- export default function factory<Scope extends string, Optional extends Scope, RequiredPlugin extends string, RequiredParser extends Scope, TPlugin extends RequiredPlugin | Optional, Parser extends RequiredParser | Optional>(scopes: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[0], optional: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[1], tree: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[2], { plugins, parsers, }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[3], settings: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[4], { defaults, extensions, }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[5]): import("@eslint/config-helpers").Config[];
2
+ export default function factory<Scope extends string, Optional extends Scope, RequiredPlugin extends string, RequiredParser extends Scope, Plugin extends RequiredPlugin | Optional, Parser extends RequiredParser | Optional>(scopes: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[0], optional: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[1], tree: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[2], { plugins, parsers, }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[3], settings: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[4], { defaults, extensions, }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[5]): import("@eslint/config-helpers").Config[];
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1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,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,6CA8J/F"}
@@ -5,7 +5,7 @@ export default function factory(scopes, optional, tree, { plugins, parsers, }, s
5
5
  plugins[scope] = extensions[scope].plugin;
6
6
  parsers[scope] = extensions[scope].parser;
7
7
  }
8
- const extended = scopes.filter(scope => extensions[scope] !== undefined);
8
+ const extended = scopes.filter(scope => extensions[scope] !== undefined), optionalized = new Set(optional.filter(scope => !(scope in parsers)));
9
9
  for (const scope of extended) {
10
10
  const { [scope]: { files, ignores, rules, } = {}, } = extensions;
11
11
  if (files !== undefined)
@@ -20,39 +20,15 @@ export default function factory(scopes, optional, tree, { plugins, parsers, }, s
20
20
  .ignores[scope]
21
21
  .push(...ignores);
22
22
  if (rules !== undefined)
23
- if (defaults.rules[scope] === undefined)
24
- defaults.rules[scope] = [
25
- {
26
- rules,
27
- name: scope.concat("/user"),
28
- },
29
- ];
30
- else
31
- defaults.rules[scope][defaults.rules[scope].length] = {
32
- rules,
33
- name: scope.concat("/user"),
34
- };
23
+ defaults.rules[scope][defaults.rules[scope].length] = { rules };
35
24
  }
36
- const Optional = new Set(optional);
37
25
  for (const [scope, parents] of tree)
38
- if (!Optional.has(scope)
39
- || scope in parsers) {
40
- const files = defaults.files[scope], ignores = defaults.ignores[scope];
41
- if (files.length !== 0)
26
+ if (!optionalized.has(scope))
27
+ if (defaults.files[scope].length !== 0)
42
28
  for (const parent of parents)
43
29
  defaults
44
30
  .files[parent]
45
- .push(...files);
46
- if (ignores !== undefined)
47
- if (ignores.length !== 0)
48
- for (const parent of parents)
49
- if (defaults.ignores[parent] === undefined)
50
- defaults.ignores[parent] = ignores;
51
- else
52
- defaults
53
- .ignores[parent]
54
- .push(...ignores);
55
- }
31
+ .push(...defaults.files[scope]);
56
32
  if (extensions["*"] !== undefined)
57
33
  if (extensions["*"].override === true
58
34
  || defaults.ignores["*"] === undefined)
@@ -62,16 +38,20 @@ export default function factory(scopes, optional, tree, { plugins, parsers, }, s
62
38
  defaults
63
39
  .ignores["*"]
64
40
  .push(...extensions["*"].ignores);
65
- const activeScopes = scopes.filter(scope => defaults.rules[scope] !== undefined
41
+ const active = scopes.filter(scope => !optionalized.has(scope)
66
42
  && defaults.files[scope].length !== 0
67
- && defaults.rules[scope].length !== 0
68
- && (!Optional.has(scope)
69
- || scope in parsers)), activeScopeSettings = activeScopes.filter(scope => settings[scope] !== undefined);
70
- return defineConfig(activeScopeSettings
43
+ && defaults.rules[scope].length !== 0), activeSettings = active.filter(scope => settings[scope] !== undefined);
44
+ return defineConfig(defaults.ignores["*"] === undefined
45
+ ? []
46
+ : globalIgnores(defaults.ignores["*"]), activeSettings
71
47
  .filter(scope => settings[scope].plugins !== undefined)
72
48
  .map(scope => ({
73
49
  files: defaults.files[scope],
74
- ignores: defaults.ignores[scope] ?? [],
50
+ ...defaults.ignores[scope] === undefined
51
+ ? {}
52
+ : {
53
+ ignores: defaults.ignores[scope],
54
+ },
75
55
  "extends": [
76
56
  settings[scope].plugins.map(plugin => ({
77
57
  plugins: {
@@ -79,7 +59,7 @@ export default function factory(scopes, optional, tree, { plugins, parsers, }, s
79
59
  },
80
60
  })),
81
61
  ],
82
- })), defaults.ignores["*"] === undefined ? [] : globalIgnores(defaults.ignores["*"]), activeScopeSettings.map(scope => {
62
+ })), activeSettings.map(scope => {
83
63
  const { languageOptions, parserOptions, processor, language, } = settings[scope];
84
64
  if (languageOptions?.parser !== undefined)
85
65
  languageOptions.parser = parsers[languageOptions.parser];
@@ -103,13 +83,11 @@ export default function factory(scopes, optional, tree, { plugins, parsers, }, s
103
83
  if (language !== undefined)
104
84
  definition.language = language;
105
85
  return {
106
- name: "scope/".concat(scope, "/definition"),
107
86
  files: defaults.files[scope],
108
87
  ignores: defaults.ignores[scope] ?? [],
109
88
  "extends": [definition],
110
89
  };
111
- }), activeScopes.map(scope => ({
112
- name: "scope/".concat(scope),
90
+ }), active.map(scope => ({
113
91
  files: defaults.files[scope],
114
92
  ignores: defaults.ignores[scope] ?? [],
115
93
  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AC,CAAC,MAAM,CAAC,MAAM,CACX,eAAe,EACf,EAAE,aAAa,EAAE,CAClB;aACN,CAAC;QAEN,IAAI,SAAS,KAAK,SAAS;YACxB,UAAwD,CAAC,SAAS,GAAG,SAAS,CAAC;QAElF,IAAI,QAAQ,KAAK,SAAS;YACvB,UAAuD,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAE/E,OAAO;YACL,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5B,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE;YACtC,SAAS,EAAE,CAAC,UAAU,CAAC;SACxB,CAAC;IACJ,CAAC,CACF,EACD,MAAM,CAAC,GAAG,CACR,KAAK,CAAC,EAAE,CAAC,CAAC;QACR,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;QAC5B,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE;QACtC,SAAS,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAyE,CAAC;KAC3G,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  import type { Settings, Configuration } from "./interface/index.js";
2
+ import type { MutableRules } from "./interface/rules.js";
2
3
  export default function <Scope extends string, Optional extends Scope, RequiredPlugin extends string, RequiredParser extends Scope, Plugin extends RequiredPlugin | Optional, Parser extends RequiredParser | Optional>(scopes: readonly Scope[], optional: readonly Optional[], tree: Array<readonly [
3
4
  Scope,
4
5
  readonly Scope[]
5
6
  ]>, imports: {
6
7
  plugins: Record<RequiredPlugin, unknown> & Partial<Record<Optional, unknown>>;
7
8
  parsers: Record<RequiredParser, unknown> & Partial<Record<Optional, unknown>>;
8
- }, settings: Settings<Scope, Plugin, Parser>, configuration: Configuration<Scope, Optional>): import("@eslint/config-helpers").Config[];
9
+ }, settings: Settings<Scope, Plugin, Parser>, configuration: Configuration<Scope, Optional>): Array<{
10
+ files?: (string | string[])[];
11
+ ignores?: (string)[];
12
+ rules?: MutableRules;
13
+ }>;
9
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACd,MAAM,aAAa,CAAC;AAGrB,MAAM,CAAC,OAAO,WACZ,KAAK,SAAS,MAAM,EACpB,QAAQ,SAAS,KAAK,EACtB,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,KAAK,EAC5B,MAAM,SAAS,cAAc,GAAG,QAAQ,EACxC,MAAM,SAAS,cAAc,GAAG,QAAQ,EAExC,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAC7B,IAAI,EAAE,KAAK,CACT,SAAS,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC,CACnC,EACD,OAAO,EAAE;IACP,OAAO,EACH,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACvC,OAAO,EACH,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;CACxC,EACD,QAAQ,EAAE,QAAQ,CAChB,KAAK,EACL,MAAM,EACN,MAAM,CACP,EACD,aAAa,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,6CAU9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,OAAO,WACZ,KAAK,SAAS,MAAM,EACpB,QAAQ,SAAS,KAAK,EACtB,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,KAAK,EAC5B,MAAM,SAAS,cAAc,GAAG,QAAQ,EACxC,MAAM,SAAS,cAAc,GAAG,QAAQ,EAExC,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAC7B,IAAI,EAAE,KAAK,CACT,SAAS,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC,CACnC,EACD,OAAO,EAAE;IACP,OAAO,EACH,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACvC,OAAO,EACH,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;CACxC,EACD,QAAQ,EAAE,QAAQ,CAChB,KAAK,EACL,MAAM,EACN,MAAM,CACP,EACD,aAAa,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,GASxC,KAAK,CACR;IACE,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,CACF,CACF"}
@@ -64,12 +64,7 @@ export declare const scopes: readonly ["js", "ts", "mocha", "svelte", "html", "j
64
64
  ignores: {
65
65
  "*": string[];
66
66
  js: string[];
67
- ts: string[];
68
- mocha: string[];
69
- svelte: string[];
70
- html: string[];
71
67
  json: string[];
72
- jsonc: string[];
73
68
  jsoncc: string[];
74
69
  };
75
70
  rules: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.input.spec.d.ts","sourceRoot":"","sources":["../src/index.input.spec.ts"],"names":[],"mappings":"AAAA,mBAAW,KAAK;IACd,GAAG,IAAI;IACP,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAID,eAAO,MAAM,MAAM,6EAST,EACV,QAAQ,qBAAsB,EAC9B,IAAI,qMAqBH,EACD,OAAO;;;;;;;;;;;;;;;CAeN,EACD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BP,EACD,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IZ,CAAC"}
1
+ {"version":3,"file":"index.input.spec.d.ts","sourceRoot":"","sources":["../src/index.input.spec.ts"],"names":[],"mappings":"AAAA,mBAAW,KAAK;IACd,GAAG,IAAI;IACP,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAID,eAAO,MAAM,MAAM,6EAST,EACV,QAAQ,qBAAsB,EAC9B,IAAI,qMAqBH,EACD,OAAO;;;;;;;;;;;;;;;CAeN,EACD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BP,EACD,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIZ,CAAC"}
@@ -90,12 +90,7 @@ export const scopes = [
90
90
  ignores: {
91
91
  "*": ["ignore/default.*"],
92
92
  js: ["ignore/default.js"],
93
- ts: ["ignore/default.ts"],
94
- mocha: ["ignore/default.mocha"],
95
- svelte: ["ignore/default.svelte"],
96
- html: ["ignore/default.html"],
97
93
  json: ["ignore/default.json"],
98
- jsonc: ["ignore/default.jsonc"],
99
94
  jsoncc: ["ignore/default-comma.jsonc"],
100
95
  },
101
96
  rules: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.input.spec.js","sourceRoot":"","sources":["../src/index.input.spec.ts"],"names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ACF;gBACD;oBACE,IAAI,EAAE,kBAAkB;oBACxB,KAAK,EAAE;wBACL,0BAA0B,GAAa;wBACvC,2CAA2C,GAAa;wBACxD,2BAA2B,GAAa;qBACzC;iBACF;aACF;YACD,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE;wBACL,QAAQ,GAAW;qBACpB;iBACF;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE;wBACL,2BAA2B,GAAa;qBACzC;iBACF;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL,uBAAuB,GAAa;qBACrC;iBACF;aACF;YACD,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE;wBACL,QAAQ,GAAW;qBACpB;iBACF;gBACD;oBACE,IAAI,EAAE,kBAAkB;oBACxB,KAAK,EAAE;wBACL,aAAa,GAAa;qBAC3B;iBACF;aACF;YACD,IAAI,EAAE;gBACJ;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL,gBAAgB,GAAa;qBAC9B;iBACF;aACF;YACD,IAAI,EAAE;gBACJ;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL,sBAAsB,GAAa;wBACnC,eAAe,EAAE;;4BAEf,OAAO;yBACC;wBACV,sBAAsB,EAAE;;4BAEtB,OAAO;yBACC;qBACX;iBACF;aACF;YACD,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,kBAAkB;oBACxB,KAAK,EAAE;wBACL,eAAe,EAAE;;4BAEf,OAAO;yBACC;qBACX;iBACF;aACF;YACD,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE;wBACL,sBAAsB,EAAE;;4BAEtB,OAAO;yBACC;qBACX;iBACF;aACF;SACF;KACF;IACD,UAAU,EAAE,EAAE;CACf,CAAC"}
1
+ {"version":3,"file":"index.input.spec.js","sourceRoot":"","sources":["../src/index.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;oBACf,KAAK,EAAE;wBACL,QAAQ,GAAW;qBACpB;iBACF;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE;wBACL,2BAA2B,GAAa;qBACzC;iBACF;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL,uBAAuB,GAAa;qBACrC;iBACF;aACF;YACD,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE;wBACL,QAAQ,GAAW;qBACpB;iBACF;gBACD;oBACE,IAAI,EAAE,kBAAkB;oBACxB,KAAK,EAAE;wBACL,aAAa,GAAa;qBAC3B;iBACF;aACF;YACD,IAAI,EAAE;gBACJ;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL,gBAAgB,GAAa;qBAC9B;iBACF;aACF;YACD,IAAI,EAAE;gBACJ;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL,sBAAsB,GAAa;wBACnC,eAAe,EAAE;;4BAEf,OAAO;yBACC;wBACV,sBAAsB,EAAE;;4BAEtB,OAAO;yBACC;qBACX;iBACF;aACF;YACD,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,kBAAkB;oBACxB,KAAK,EAAE;wBACL,eAAe,EAAE;;4BAEf,OAAO;yBACC;qBACX;iBACF;aACF;YACD,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE;wBACL,sBAAsB,EAAE;;4BAEtB,OAAO;yBACC;qBACX;iBACF;aACF;SACF;KACF;IACD,UAAU,EAAE,EAAE;CACf,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,MAAM,CAAC,OAAO,WAQZ,MAAwB,EACxB,QAA6B,EAC7B,IAEC,EACD,OAOC,EACD,QAIC,EACD,aAA6C;IAE7C,OAAO,OAAO,CACZ,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,aAAa,CACd,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAOhC,MAAM,CAAC,OAAO,WAQZ,MAAwB,EACxB,QAA6B,EAC7B,IAEC,EACD,OAOC,EACD,QAIC,EACD,aAA6C;IAE7C,OAAO,OAAO,CACZ,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,aAAa,CAOd,CAAC;AACJ,CAAC"}
@@ -3,7 +3,7 @@ import Core from "./index.js";
3
3
  import { scopes, optional, tree, imports, settings, configuration, } from "./index.input.spec.js";
4
4
  const configs = Core(scopes, optional, tree, imports, settings, configuration);
5
5
  describe("Core", function () {
6
- describe("shape", function () {
6
+ describe("module", function () {
7
7
  it("is a function", function () {
8
8
  Core
9
9
  .should.be
@@ -22,14 +22,68 @@ describe("Core", function () {
22
22
  .should.have
23
23
  .lengthOf.above(scopes.length + 1);
24
24
  });
25
- it("containing only config-like members", function () {
26
- configs
27
- .should
28
- .satisfy((configs) => configs
29
- .every(config => typeof config === "object"
30
- && config !== null
31
- && "name" in config
32
- && typeof config.name === "string"));
25
+ it("of config objects", function () {
26
+ for (const config of configs)
27
+ config
28
+ .should.be
29
+ .an("object")
30
+ .includes
31
+ .any
32
+ .keys("files", "ignores", "rules");
33
+ });
34
+ it("with valid plugins", function () {
35
+ for (const config of configs)
36
+ if ("plugins" in config)
37
+ config.plugins
38
+ .should.be
39
+ .an("object");
40
+ });
41
+ it("or valid files", function () {
42
+ for (const config of configs)
43
+ if ("files" in config)
44
+ config
45
+ .files
46
+ .should.be
47
+ .an("array")
48
+ .not.empty;
49
+ });
50
+ it("or valid ignores", function () {
51
+ for (const config of configs)
52
+ if ("ignores" in config) {
53
+ config
54
+ .ignores
55
+ .should.be
56
+ .an("array");
57
+ for (const pattern of config.ignores)
58
+ pattern
59
+ .should.be
60
+ .a("string")
61
+ .not.empty;
62
+ }
63
+ });
64
+ it("or valid rules", function () {
65
+ for (const config of configs)
66
+ if ("rules" in config) {
67
+ config
68
+ .rules
69
+ .should.be
70
+ .an("object")
71
+ .not.empty;
72
+ for (const rule of Object.keys(config.rules)) {
73
+ rule
74
+ .should
75
+ .be
76
+ .a("string");
77
+ if (typeof config.rules[rule] !== "number")
78
+ config.rules[rule]
79
+ .should
80
+ .be
81
+ .an("array")
82
+ .with
83
+ .property("0")
84
+ .a("number");
85
+ }
86
+ }
33
87
  });
34
88
  });
35
89
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,IAAI,MAAM,GAAG,CAAC;AACrB,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,GAAG,IAAI,CAClB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,aAAa,CACd,CAAC;AAEF,QAAQ,CACN,MAAM,EACN;IACE,QAAQ,CACN,OAAO,EACP;QACE,EAAE,CACA,eAAe,EACf;YACE,IAAI;iBACD,MAAM,CAAC,EAAE;iBACT,CAAC,CAAC,UAAU,CAAC,CAAC;QACnB,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;IACF,QAAQ,CACN,QAAQ,EACR;QACE,EAAE,CACA,sBAAsB,EACtB;YACE,OAAO;iBACJ,MAAM,CAAC,EAAE;iBACT,EAAE,CAAC,OAAO,CAAC;iBACX,GAAG,CAAC,KAAK,CAAC;QACf,CAAC,CACF,CAAC;QACF,EAAE,CACA,+BAA+B,MAAM,CAAC,MAAM,aAAa,MAAM,CAAC,MAAM,GAAG,CAAC,cA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,CAAC,CAAC,QAAQ,CAAC;6BACX,GAAG,CAAC,KAAK,CAAC;gBACjB,CAAC;QACL,CAAC,CACF,CAAC;QACF,EAAE,CACA,gBAAgB,EAChB;YACE,KAAK,MAAM,MAAM,IAAI,OAAO;gBAC1B,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;oBACtB,MAAM;yBACH,KAAK;yBACL,MAAM,CAAC,EAAE;yBACT,EAAE,CAAC,QAAQ,CAAC;yBACZ,GAAG,CAAC,KAAK,CAAC;oBAEb,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC7C,IAAI;6BACD,MAAM;6BACN,EAAE;6BACF,CAAC,CAAC,QAAQ,CAAC,CAAC;wBAEf,IAAI,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ;4BACxC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAE;iCAChB,MAAM;iCACN,EAAE;iCACF,EAAE,CAAC,OAAO,CAAC;iCACX,IAAI;iCACJ,QAAQ,CAAC,GAAG,CAAC;iCACb,CAAC,CAAC,QAAQ,CAAC,CAAC;oBACnB,CAAC;gBACH,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,12 +1,7 @@
1
- import type { RuleConfig } from "@eslint/config-helpers";
1
+ import type { Rules } from "../../rules.js";
2
2
  export interface Defaults<Scope extends string> {
3
3
  files: Record<Scope, string[]>;
4
4
  ignores: Partial<Record<Scope | "*", string[]>>;
5
- rules: Partial<Record<Scope, Array<{
6
- name: string;
7
- rules: {
8
- [rule: string]: Readonly<RuleConfig>;
9
- };
10
- }>>>;
5
+ rules: Record<Scope, Array<Record<"rules", Rules>>>;
11
6
  }
12
- //# sourceMappingURL=index.d.ts.map
7
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/configuration/defaults/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,QAAQ,CAAC,KAAK,SAAS,MAAM;IAC5C,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAChD,KAAK,EAAE,OAAO,CAAC,MAAM,CACnB,KAAK,EACL,KAAK,CACH;QACE,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE;YACL,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;SACtC,CAAC;KACH,CACF,CACF,CAAC,CAAC;CACJ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/configuration/defaults/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,QAAQ,CAAC,KAAK,SAAS,MAAM;IAC5C,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAChD,KAAK,EAAE,MAAM,CACX,KAAK,EACL,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAC9B,CAAC;CACH"}
@@ -1,10 +1,10 @@
1
- import type { RuleConfig } from "@eslint/config-helpers";
1
+ import type { Rules } from "../../rules.js";
2
2
  export type ScopeExtensions<Scope extends string, Optional extends Scope> = Record<Scope, {
3
3
  files?: string[];
4
4
  ignores?: string[];
5
- rules?: Record<string, Readonly<RuleConfig>>;
5
+ rules?: Rules;
6
6
  }> & Record<Optional, {
7
7
  plugin: unknown;
8
8
  parser: unknown;
9
9
  }>;
10
- //# sourceMappingURL=scopes.d.ts.map
10
+ //# sourceMappingURL=scopes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../../src/interface/configuration/extensions/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,MAAM,EACpB,QAAQ,SAAS,KAAK,IAEpB,MAAM,CACR,KAAK,EACL;IACE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CACZ,MAAM,EACN,QAAQ,CAAC,UAAU,CAAC,CACrB,CAAC;CACH,CACF,GACC,MAAM,CACN,QAAQ,EACR;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB,CACF,CAAC"}
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../../src/interface/configuration/extensions/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,MAAM,EACpB,QAAQ,SAAS,KAAK,IAEpB,MAAM,CACR,KAAK,EACL;IACE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CACF,GACC,MAAM,CACN,QAAQ,EACR;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB,CACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ type State = 0 | 1 | 2 | "off" | "warn" | "error";
2
+ type Rule = State | [State, ...unknown[]];
3
+ export type Rules = Record<string, Readonly<Rule>>;
4
+ export type MutableRules = {
5
+ [Rule in keyof Rules]: Mutable<Rules[Rule]>;
6
+ };
7
+ export type MutableRuleConfigs<Configs> = Configs extends Array<infer Config extends {
8
+ rules: Rules;
9
+ }> ? Array<{
10
+ rules: {
11
+ [Rule in keyof Config["rules"]]: Mutable<Config["rules"][Rule]>;
12
+ };
13
+ }> : Configs;
14
+ type Mutable<Rule> = Rule extends object ? {
15
+ -readonly [Index in keyof Rule]: Rule[Index];
16
+ } : Rule;
17
+ export {};
18
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/interface/rules.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GACN,CAAC,GACD,CAAC,GACD,CAAC,GACD,KAAK,GACL,MAAM,GACN,OAAO,CAAC;AACZ,KAAK,IAAI,GAAG,KAAK,GAAG,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AAC1C,MAAM,MAAM,KAAK,GAAG,MAAM,CACxB,MAAM,EACN,QAAQ,CAAC,IAAI,CAAC,CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;KACxB,IAAI,IAAI,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,OAAO,IAAI,OAAO,SAAS,KAAK,CAC7D,MAAM,MAAM,SAAS;IACnB,KAAK,EAAE,KAAK,CAAC;CACd,CACF,GACG,KAAK,CACL;IACE,KAAK,EAAE;SACJ,IAAI,IAAI,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CACtC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CACtB;KACF,CAAC;CACH,CACF,GACC,OAAO,CAAC;AAEZ,KAAK,OAAO,CAAC,IAAI,IAAI,IAAI,SAAS,MAAM,GACpC;IAAE,CAAC,UAAU,KAAK,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;CAAE,GAChD,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/interface/rules.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "$schema": "https://json.schemastore.org/package",
4
4
  "$help": "https://docs.npmjs.com/cli/configuring-npm/package-json",
5
5
  "name": "@eslinted/core",
6
- "version": "29.1.0",
6
+ "version": "29.2.0",
7
7
  "repository": "github:jimmy-zhening-luo/linted-core",
8
8
  "description": "Internal core for npm package `linted`, responsible for producing an array of fully-formed ESLint configurations according to `linted` spec.",
9
9
  "keywords": [],
@@ -1,52 +1,30 @@
1
1
  import {
2
2
  defineConfig,
3
3
  globalIgnores,
4
- type Plugin,
5
- type RuleConfig,
6
4
  } from "@eslint/config-helpers";
7
5
  import type Core from "..";
8
-
9
- type MutableRules<RuleArray> = RuleArray extends Array<
10
- infer Rules extends {
11
- name: string;
12
- rules: Record<
13
- string,
14
- Readonly<RuleConfig>
15
- >;
16
- }
17
- >
18
- ? {
19
- name: Rules["name"];
20
- rules: {
21
- [Rule in keyof Rules["rules"]]: Mutable<Rules["rules"][Rule
22
- ]>
23
- };
24
- }[]
25
- : RuleArray;
26
- type Mutable<V> = V extends object
27
- ? { -readonly [I in keyof V]: V[I] }
28
- : V;
6
+ import type { MutableRuleConfigs } from "../interface/rules";
29
7
 
30
8
  export default function factory<
31
9
  Scope extends string,
32
10
  Optional extends Scope,
33
11
  RequiredPlugin extends string,
34
12
  RequiredParser extends Scope,
35
- TPlugin extends RequiredPlugin | Optional,
13
+ Plugin extends RequiredPlugin | Optional,
36
14
  Parser extends RequiredParser | Optional,
37
15
  >(
38
- scopes: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[0],
39
- optional: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[1],
40
- tree: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[2],
16
+ scopes: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[0],
17
+ optional: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[1],
18
+ tree: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[2],
41
19
  {
42
20
  plugins,
43
21
  parsers,
44
- }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[3],
45
- settings: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[4],
22
+ }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[3],
23
+ settings: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[4],
46
24
  {
47
25
  defaults,
48
26
  extensions = {},
49
- }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, TPlugin, Parser>>[5],
27
+ }: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Plugin, Parser>>[5],
50
28
  ) {
51
29
  for (const scope of optional)
52
30
  if (extensions[scope] !== undefined) {
@@ -57,6 +35,11 @@ export default function factory<
57
35
 
58
36
  const extended = scopes.filter(
59
37
  scope => extensions[scope] !== undefined,
38
+ ),
39
+ optionalized = new Set<Scope>(
40
+ optional.filter(
41
+ scope => !(scope in parsers),
42
+ ),
60
43
  );
61
44
 
62
45
  for (const scope of extended) {
@@ -83,50 +66,19 @@ export default function factory<
83
66
  .push(...ignores);
84
67
 
85
68
  if (rules !== undefined)
86
- if (defaults.rules[scope] === undefined)
87
69
  /* eslint-disable no-param-reassign */
88
- defaults.rules[scope] = [
89
- {
90
- rules,
91
- name: scope.concat("/user"),
92
- },
93
- ];
94
- else
95
- /* eslint-disable no-param-reassign */
96
- defaults.rules[scope][
97
- defaults.rules[scope].length
98
- ] = {
99
- rules,
100
- name: scope.concat("/user"),
101
- };
70
+ defaults.rules[scope][
71
+ defaults.rules[scope].length
72
+ ] = { rules };
102
73
  }
103
74
 
104
- const Optional = new Set<Scope>(optional);
105
-
106
75
  for (const [scope, parents] of tree)
107
- if (
108
- !Optional.has(scope)
109
- || scope in parsers
110
- ) {
111
- const files = defaults.files[scope],
112
- ignores = defaults.ignores[scope];
113
-
114
- if (files.length !== 0)
76
+ if (!optionalized.has(scope))
77
+ if (defaults.files[scope].length !== 0)
115
78
  for (const parent of parents)
116
79
  defaults
117
80
  .files[parent]
118
- .push(...files);
119
-
120
- if (ignores !== undefined)
121
- if (ignores.length !== 0)
122
- for (const parent of parents)
123
- if (defaults.ignores[parent] === undefined)
124
- defaults.ignores[parent] = ignores;
125
- else
126
- defaults
127
- .ignores[parent]
128
- .push(...ignores);
129
- }
81
+ .push(...defaults.files[scope]);
130
82
 
131
83
  if (extensions["*"] !== undefined)
132
84
  if (
@@ -141,41 +93,43 @@ export default function factory<
141
93
  .ignores["*"]
142
94
  .push(...extensions["*"].ignores);
143
95
 
144
- const activeScopes = scopes.filter(
145
- scope => defaults.rules[scope] !== undefined
96
+ const active = scopes.filter(
97
+ scope => !optionalized.has(scope)
146
98
  && defaults.files[scope].length !== 0
147
- && defaults.rules[scope].length !== 0
148
- && (
149
- !Optional.has(scope)
150
- || scope in parsers
151
- ),
99
+ && defaults.rules[scope].length !== 0,
152
100
  ),
153
- activeScopeSettings = activeScopes.filter(
101
+ activeSettings = active.filter(
154
102
  scope => settings[scope] !== undefined,
155
103
  );
156
104
 
157
105
  return defineConfig(
158
- activeScopeSettings
106
+ defaults.ignores["*"] === undefined
107
+ ? []
108
+ : globalIgnores(defaults.ignores["*"]),
109
+ activeSettings
159
110
  .filter(
160
111
  scope => settings[scope]!.plugins !== undefined,
161
112
  )
162
113
  .map(
163
114
  scope => ({
164
115
  files: defaults.files[scope],
165
- ignores: defaults.ignores[scope] ?? [],
116
+ ...defaults.ignores[scope] === undefined
117
+ ? {}
118
+ : {
119
+ ignores: defaults.ignores[scope],
120
+ },
166
121
  "extends": [
167
122
  settings[scope]!.plugins!.map(
168
123
  plugin => ({
169
124
  plugins: {
170
- [plugin]: plugins[plugin] as Plugin,
125
+ [plugin]: plugins[plugin] as object,
171
126
  },
172
127
  }),
173
128
  ),
174
129
  ],
175
130
  }),
176
131
  ),
177
- defaults.ignores["*"] === undefined ? [] : globalIgnores(defaults.ignores["*"]),
178
- activeScopeSettings.map(
132
+ activeSettings.map(
179
133
  scope => {
180
134
  const {
181
135
  languageOptions,
@@ -214,22 +168,17 @@ export default function factory<
214
168
  (definition as typeof definition & { language: string }).language = language;
215
169
 
216
170
  return {
217
- name: "scope/".concat(
218
- scope,
219
- "/definition",
220
- ),
221
171
  files: defaults.files[scope],
222
172
  ignores: defaults.ignores[scope] ?? [],
223
173
  "extends": [definition],
224
174
  };
225
175
  },
226
176
  ),
227
- activeScopes.map(
177
+ active.map(
228
178
  scope => ({
229
- name: "scope/".concat(scope),
230
179
  files: defaults.files[scope],
231
180
  ignores: defaults.ignores[scope] ?? [],
232
- "extends": [defaults.rules[scope] as MutableRules<NonNullable<typeof defaults.rules[typeof scope]>>],
181
+ "extends": [defaults.rules[scope] as MutableRuleConfigs<NonNullable<typeof defaults.rules[typeof scope]>>],
233
182
  }),
234
183
  ),
235
184
  );
@@ -102,12 +102,7 @@ configuration = {
102
102
  ignores: {
103
103
  "*": ["ignore/default.*"],
104
104
  js: ["ignore/default.js"],
105
- ts: ["ignore/default.ts"],
106
- mocha: ["ignore/default.mocha"],
107
- svelte: ["ignore/default.svelte"],
108
- html: ["ignore/default.html"],
109
105
  json: ["ignore/default.json"],
110
- jsonc: ["ignore/default.jsonc"],
111
106
  jsoncc: ["ignore/default-comma.jsonc"],
112
107
  },
113
108
  rules: {
package/src/index.spec.ts CHANGED
@@ -22,7 +22,7 @@ describe(
22
22
  "Core",
23
23
  function () {
24
24
  describe(
25
- "shape",
25
+ "module",
26
26
  function () {
27
27
  it(
28
28
  "is a function",
@@ -55,17 +55,88 @@ describe(
55
55
  },
56
56
  );
57
57
  it(
58
- "containing only config-like members",
58
+ "of config objects",
59
59
  function () {
60
- configs
61
- .should
62
- .satisfy(
63
- (configs: unknown[]) => configs
64
- .every(config => typeof config === "object"
65
- && config !== null
66
- && "name" in config
67
- && typeof config.name === "string"),
68
- );
60
+ for (const config of configs)
61
+ config
62
+ .should.be
63
+ .an("object")
64
+ .includes
65
+ .any
66
+ .keys(
67
+ "files",
68
+ "ignores",
69
+ "rules",
70
+ );
71
+ },
72
+ );
73
+ it(
74
+ "with valid plugins",
75
+ function () {
76
+ for (const config of configs)
77
+ if ("plugins" in config)
78
+ (config.plugins as object)
79
+ .should.be
80
+ .an("object");
81
+ },
82
+ );
83
+ it(
84
+ "or valid files",
85
+ function () {
86
+ for (const config of configs)
87
+ if ("files" in config)
88
+ config
89
+ .files
90
+ .should.be
91
+ .an("array")
92
+ .not.empty;
93
+ },
94
+ );
95
+ it(
96
+ "or valid ignores",
97
+ function () {
98
+ for (const config of configs)
99
+ if ("ignores" in config) {
100
+ config
101
+ .ignores
102
+ .should.be
103
+ .an("array");
104
+
105
+ for (const pattern of config.ignores)
106
+ pattern
107
+ .should.be
108
+ .a("string")
109
+ .not.empty;
110
+ }
111
+ },
112
+ );
113
+ it(
114
+ "or valid rules",
115
+ function () {
116
+ for (const config of configs)
117
+ if ("rules" in config) {
118
+ config
119
+ .rules
120
+ .should.be
121
+ .an("object")
122
+ .not.empty;
123
+
124
+ for (const rule of Object.keys(config.rules)) {
125
+ rule
126
+ .should
127
+ .be
128
+ .a("string");
129
+
130
+ if (typeof config.rules[rule] !== "number")
131
+ config.rules[rule]!
132
+ .should
133
+ .be
134
+ .an("array")
135
+ .with
136
+ .property("0")
137
+ .a("number");
138
+ }
139
+ }
69
140
  },
70
141
  );
71
142
  },
package/src/index.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import factory from "./factory";
1
2
  import type {
2
3
  Settings,
3
4
  Configuration,
4
5
  } from "./interface";
5
- import factory from "./factory";
6
+ import type { MutableRules } from "./interface/rules";
6
7
 
7
8
  export default function<
8
9
  Scope extends string,
@@ -39,5 +40,11 @@ export default function<
39
40
  imports,
40
41
  settings,
41
42
  configuration,
42
- );
43
+ ) as Array<
44
+ {
45
+ files?: (string | string[])[];
46
+ ignores?: (string)[];
47
+ rules?: MutableRules;
48
+ }
49
+ >;
43
50
  }
@@ -1,17 +1,10 @@
1
- import type { RuleConfig } from "@eslint/config-helpers";
1
+ import type { Rules } from "../../rules";
2
2
 
3
3
  export interface Defaults<Scope extends string> {
4
4
  files: Record<Scope, string[]>;
5
5
  ignores: Partial<Record<Scope | "*", string[]>>;
6
- rules: Partial<Record<
6
+ rules: Record<
7
7
  Scope,
8
- Array<
9
- {
10
- name: string;
11
- rules: {
12
- [rule: string]: Readonly<RuleConfig>;
13
- };
14
- }
15
- >
16
- >>;
8
+ Array<Record<"rules", Rules>>
9
+ >;
17
10
  }
@@ -1,4 +1,4 @@
1
- import type { RuleConfig } from "@eslint/config-helpers";
1
+ import type { Rules } from "../../rules";
2
2
 
3
3
  export type ScopeExtensions<
4
4
  Scope extends string,
@@ -9,10 +9,7 @@ export type ScopeExtensions<
9
9
  {
10
10
  files?: string[];
11
11
  ignores?: string[];
12
- rules?: Record<
13
- string,
14
- Readonly<RuleConfig>
15
- >;
12
+ rules?: Rules;
16
13
  }
17
14
  >
18
15
  & Record<
@@ -0,0 +1,36 @@
1
+ type State
2
+ = | 0
3
+ | 1
4
+ | 2
5
+ | "off"
6
+ | "warn"
7
+ | "error";
8
+ type Rule = State | [State, ...unknown[]];
9
+ export type Rules = Record<
10
+ string,
11
+ Readonly<Rule>
12
+ >;
13
+
14
+ export type MutableRules = {
15
+ [Rule in keyof Rules]: Mutable<Rules[Rule]>
16
+ };
17
+
18
+ export type MutableRuleConfigs<Configs> = Configs extends Array<
19
+ infer Config extends {
20
+ rules: Rules;
21
+ }
22
+ >
23
+ ? Array<
24
+ {
25
+ rules: {
26
+ [Rule in keyof Config["rules"]]: Mutable<
27
+ Config["rules"][Rule]
28
+ >
29
+ };
30
+ }
31
+ >
32
+ : Configs;
33
+
34
+ type Mutable<Rule> = Rule extends object
35
+ ? { -readonly [Index in keyof Rule]: Rule[Index] }
36
+ : Rule;