@eslinted/core 19.0.3 → 20.0.0-rc.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.
Files changed (48) hide show
  1. package/dist/_test/index.d.ts +18 -18
  2. package/dist/_test/index.js +18 -18
  3. package/dist/_test/index.js.map +1 -1
  4. package/dist/factory/index.d.ts +5 -5
  5. package/dist/factory/index.d.ts.map +1 -1
  6. package/dist/factory/index.js +76 -69
  7. package/dist/factory/index.js.map +1 -1
  8. package/dist/index.d.ts +3 -5
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +18 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/interface/input/imports/index.d.ts +7 -0
  13. package/dist/interface/input/imports/index.d.ts.map +1 -0
  14. package/dist/interface/input/imports/index.js +2 -0
  15. package/dist/interface/input/imports/index.js.map +1 -0
  16. package/dist/interface/input/imports/optional.d.ts +5 -0
  17. package/dist/interface/input/imports/optional.d.ts.map +1 -0
  18. package/dist/interface/input/imports/optional.js +2 -0
  19. package/dist/interface/input/imports/optional.js.map +1 -0
  20. package/dist/interface/input/imports/required.d.ts +5 -0
  21. package/dist/interface/input/imports/required.d.ts.map +1 -0
  22. package/dist/interface/input/imports/required.js +2 -0
  23. package/dist/interface/input/imports/required.js.map +1 -0
  24. package/dist/interface/input/index.d.ts +3 -5
  25. package/dist/interface/input/index.d.ts.map +1 -1
  26. package/dist/scope/dependencies/index.d.ts +2 -2
  27. package/dist/scope/dependencies/index.d.ts.map +1 -1
  28. package/dist/scope/dependencies/parsers.d.ts +1 -1
  29. package/dist/scope/dependencies/parsers.d.ts.map +1 -1
  30. package/dist/scope/dependencies/plugins.d.ts +1 -1
  31. package/dist/scope/dependencies/plugins.d.ts.map +1 -1
  32. package/dist/scope/index.d.ts +4 -1
  33. package/dist/scope/index.d.ts.map +1 -1
  34. package/dist/scope/index.js +1 -0
  35. package/dist/scope/index.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/_test/index.ts +18 -18
  38. package/src/factory/index.ts +121 -83
  39. package/src/factory/model/manifest.d.ts +3 -1
  40. package/src/index.ts +45 -26
  41. package/src/interface/input/imports/index.ts +16 -0
  42. package/src/interface/input/imports/optional.ts +11 -0
  43. package/src/interface/input/imports/required.ts +13 -0
  44. package/src/interface/input/index.ts +9 -12
  45. package/src/scope/dependencies/index.ts +2 -2
  46. package/src/scope/dependencies/parsers.ts +1 -2
  47. package/src/scope/dependencies/plugins.ts +1 -2
  48. package/src/scope/index.ts +3 -2
@@ -1,23 +1,23 @@
1
1
  export declare const TEST_INPUT: {
2
2
  imports: {
3
- plugins: {
4
- "@stylistic": string;
5
- "@typescript-eslint": string;
6
- mocha: string;
7
- "chai-friendly": string;
8
- "chai-expect": string;
9
- svelte: string;
10
- "@html-eslint": string;
11
- css: string;
12
- json: string;
13
- jsonc: string;
14
- yml: string;
15
- };
16
- parsers: {
17
- ts: string;
18
- svelte: string;
19
- html: string;
20
- yml: string;
3
+ required: {
4
+ plugins: {
5
+ "@stylistic": string;
6
+ "@typescript-eslint": string;
7
+ mocha: string;
8
+ "chai-friendly": string;
9
+ "chai-expect": string;
10
+ "@html-eslint": string;
11
+ css: string;
12
+ json: string;
13
+ jsonc: string;
14
+ yml: string;
15
+ };
16
+ parsers: {
17
+ ts: string;
18
+ html: string;
19
+ yml: string;
20
+ };
21
21
  };
22
22
  };
23
23
  configuration: {
@@ -1,24 +1,24 @@
1
1
  const ERROR = "error", OFF = "off", Plugin = "MOCK_PLUGIN", Parser = (scope) => `MOCK_PARSER:${scope}`;
2
2
  export const TEST_INPUT = {
3
3
  imports: {
4
- plugins: {
5
- "@stylistic": Plugin,
6
- "@typescript-eslint": Plugin,
7
- mocha: Plugin,
8
- "chai-friendly": Plugin,
9
- "chai-expect": Plugin,
10
- svelte: Plugin,
11
- "@html-eslint": Plugin,
12
- css: Plugin,
13
- json: Plugin,
14
- jsonc: Plugin,
15
- yml: Plugin,
16
- },
17
- parsers: {
18
- ts: Parser("TS"),
19
- svelte: Parser("SVELTE"),
20
- html: Parser("HTML"),
21
- yml: Parser("YML"),
4
+ required: {
5
+ plugins: {
6
+ "@stylistic": Plugin,
7
+ "@typescript-eslint": Plugin,
8
+ mocha: Plugin,
9
+ "chai-friendly": Plugin,
10
+ "chai-expect": Plugin,
11
+ "@html-eslint": Plugin,
12
+ css: Plugin,
13
+ json: Plugin,
14
+ jsonc: Plugin,
15
+ yml: Plugin,
16
+ },
17
+ parsers: {
18
+ ts: Parser("TS"),
19
+ html: Parser("HTML"),
20
+ yml: Parser("YML"),
21
+ },
22
22
  },
23
23
  },
24
24
  configuration: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_test/index.ts"],"names":[],"mappings":"AAAA,MACA,KAAK,GAAG,OAAO,EACf,GAAG,GAAG,KAAK,EACX,MAAM,GAAG,aAAa,EACtB,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,eAAe,KAAK,EAAE,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE;QACP,OAAO,EAAE;YACP,YAAY,EAAE,MAAM;YACpB,oBAAoB,EAAE,MAAM;YAC5B,KAAK,EAAE,MAAM;YACb,eAAe,EAAE,MAAM;YACvB,aAAa,EAAE,MAAM;YACrB,MAAM,EAAE,MAAM;YACd,cAAc,EAAE,MAAM;YACtB,GAAG,EAAE,MAAM;YACX,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;SACZ;QACD,OAAO,EAAE;YACP,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC;YAChB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;YACxB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;YACpB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC;SACnB;KACF;IACD,aAAa,EAAE;QACb,QAAQ,EAAE;YACR,QAAQ,EAAE;gBACR,WAAW,EAAE,IAAI;gBACjB,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,EAAE,kBAAkB;wBACtB,KAAK,EAAE;4BACL,eAAe,EAAE;gCACf,KAAK;gCACL,OAAO;6BACR;yBACO;qBACX;iBACF;gBACD,MAAM,EAAE;oBACN;wBACE,EAAE,EAAE,gBAAgB;wBACpB,KAAK,EAAE;4BACL,sBAAsB,EAAE;gCACtB,KAAK;gCACL,OAAO;6BACR;yBACO;qBACX;iBACF;gBACD,GAAG,EAAE;oBACH;wBACE,EAAE,EAAE,QAAQ;wBACZ,KAAK,EAAE;4BACL,oBAAoB,EAAE,KAAK;yBACnB;qBACX;iBACF;aACF;SACF;QACD,UAAU,EAAE,EAAE;KACf;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_test/index.ts"],"names":[],"mappings":"AAAA,MACA,KAAK,GAAG,OAAO,EACf,GAAG,GAAG,KAAK,EACX,MAAM,GAAG,aAAa,EACtB,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,eAAe,KAAK,EAAE,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,OAAO,EAAE;gBACP,YAAY,EAAE,MAAM;gBACpB,oBAAoB,EAAE,MAAM;gBAC5B,KAAK,EAAE,MAAM;gBACb,eAAe,EAAE,MAAM;gBACvB,aAAa,EAAE,MAAM;gBACrB,cAAc,EAAE,MAAM;gBACtB,GAAG,EAAE,MAAM;gBACX,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,GAAG,EAAE,MAAM;aACZ;YACD,OAAO,EAAE;gBACP,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC;gBAChB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;gBACpB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC;aACnB;SACF;KACF;IACD,aAAa,EAAE;QACb,QAAQ,EAAE;YACR,QAAQ,EAAE;gBACR,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;g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B,KAAK,EAAE;4BACL,eAAe,EAAE;gCACf,KAAK;gCACL,OAAO;6BACR;yBACO;qBACX;iBACF;gBACD,MAAM,EAAE;oBACN;wBACE,EAAE,EAAE,gBAAgB;wBACpB,KAAK,EAAE;4BACL,sBAAsB,EAAE;gCACtB,KAAK;gCACL,OAAO;6BACR;yBACO;qBACX;iBACF;gBACD,GAAG,EAAE;oBACH;wBACE,EAAE,EAAE,QAAQ;wBACZ,KAAK,EAAE;4BACL,oBAAoB,EAAE,KAAK;yBACnB;qBACX;iBACF;aACF;SACF;QACD,UAAU,EAAE,EAAE;KACf;CACF,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { Input } from "../interface/index.js";
2
2
  import type * as Model from "./model";
3
- export declare class Factory<Plugin extends string, Parser extends string, Scope extends string> {
3
+ export declare class Factory<RequiredPlugin extends string, RequiredParser extends string, OptionalScope extends string, Scope extends string> {
4
4
  private readonly registry;
5
- parsers: Record<Parser, unknown>;
5
+ parsers: Record<RequiredParser, unknown> & Partial<Record<OptionalScope, unknown>>;
6
6
  global: {
7
7
  settings: {
8
8
  name: "linted/*/settings/";
@@ -28,7 +28,7 @@ export declare class Factory<Plugin extends string, Parser extends string, Scope
28
28
  rules: import("../interface/index.js").Config["rules"];
29
29
  }[]>;
30
30
  };
31
- constructor(tree: Model.ITree<Scope>, registry: Record<Scope, Model.IManifest<Parser>>, parsers: Record<Parser, unknown>, defaults: Input<Plugin, Parser, Scope>["configuration"]["defaults"], { "*": globalExtension, ...scopeExtensions }?: Input<Plugin, Parser, Scope>["configuration"]["extensions"]);
31
+ constructor(optionalScopes: readonly Scope[], tree: Model.ITree<Scope>, registry: Record<Scope, Model.IManifest<RequiredParser | OptionalScope>>, parsers: Record<RequiredParser, unknown> & Partial<Record<OptionalScope, unknown>>, defaults: Input<RequiredPlugin, RequiredParser, OptionalScope, Scope>["configuration"]["defaults"], { "*": globalExtension, ...scopeExtensions }?: Input<RequiredPlugin, RequiredParser, OptionalScope, Scope>["configuration"]["extensions"]);
32
32
  get globals(): readonly [
33
33
  {
34
34
  name: "linted/*/settings/";
@@ -56,9 +56,9 @@ export declare class Factory<Plugin extends string, Parser extends string, Scope
56
56
  processor?: string;
57
57
  languageOptions?: {
58
58
  parserOptions?: {
59
- parser?: Record<Parser, unknown>[Parser];
59
+ parser?: (Record<RequiredParser, unknown> & Partial<Record<OptionalScope, unknown>>)[RequiredParser | OptionalScope];
60
60
  };
61
- parser?: Record<Parser, unknown>[Parser];
61
+ parser?: (Record<RequiredParser, unknown> & Partial<Record<OptionalScope, unknown>>)[RequiredParser | OptionalScope];
62
62
  globals?: {
63
63
  readonly define: false;
64
64
  readonly require: false;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AAEtC,qBAAa,OAAO,CAClB,MAAM,SAAS,MAAM,EACrB,MAAM,SAAS,MAAM,EACrB,KAAK,SAAS,MAAM;IAOlB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IANlC,MAAM;;;;;;;;;;;;;;;;MAAC;IACP,MAAM;;;;;;;MAAC;gBAGZ,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EACP,QAAQ,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAC1D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC,UAAU,CAAC,EACnE,EACE,GAAG,EAAE,eAAoB,EACzB,GAAG,eAAe,EACnB,GAAE,KAAK,CAAC,MAAM,EAAE,MA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmI1B"}
@@ -4,7 +4,7 @@ export class Factory {
4
4
  parsers;
5
5
  global;
6
6
  scopes;
7
- constructor(tree, registry, parsers, defaults, { "*": globalExtension = {}, ...scopeExtensions } = {}) {
7
+ constructor(optionalScopes, tree, registry, parsers, defaults, { "*": globalExtension = {}, ...scopeExtensions } = {}) {
8
8
  this.registry = registry;
9
9
  this.parsers = parsers;
10
10
  const { noInlineConfig = defaults
@@ -66,21 +66,24 @@ export class Factory {
66
66
  rules: userRules,
67
67
  });
68
68
  }
69
+ const OptionalScopes = new Set(optionalScopes);
69
70
  for (const [scope, parents] of tree)
70
- for (const parent of parents) {
71
- this
72
- .scopes
73
- .files[parent]
74
- .push(...this
75
- .scopes
76
- .files[scope]);
77
- this
78
- .scopes
79
- .ignores[parent]
80
- .push(...this
81
- .scopes
82
- .ignores[scope]);
83
- }
71
+ if (!OptionalScopes.has(scope)
72
+ || scope in parsers)
73
+ for (const parent of parents) {
74
+ this
75
+ .scopes
76
+ .files[parent]
77
+ .push(...this
78
+ .scopes
79
+ .files[scope]);
80
+ this
81
+ .scopes
82
+ .ignores[parent]
83
+ .push(...this
84
+ .scopes
85
+ .ignores[scope]);
86
+ }
84
87
  }
85
88
  get globals() {
86
89
  return [
@@ -110,62 +113,66 @@ export class Factory {
110
113
  ? []
111
114
  : ruleset.length === 0
112
115
  ? []
113
- : [
114
- {
115
- name: `linted/${scope}/`,
116
- files,
117
- ignores,
118
- ...parser === null
119
- && global === null
120
- && subparser === null
121
- && [...Object.keys(extraLanguageOptions)].length === 0
122
- && [...Object.keys(extraParserOptions)].length === 0
123
- ? {}
124
- : {
125
- languageOptions: {
126
- ...extraLanguageOptions,
127
- ...global === null
128
- ? {}
129
- : {
130
- globals: globals[global],
131
- },
132
- ...parser === null
133
- ? {}
134
- : {
135
- parser: this.parsers[parser],
136
- },
137
- ...subparser === null
138
- && [...Object.keys(extraParserOptions)].length === 0
139
- ? {}
140
- : {
141
- parserOptions: {
142
- ...extraParserOptions,
143
- ...subparser === null
144
- ? {}
145
- : {
146
- parser: this
147
- .parsers[subparser],
148
- },
149
- },
150
- },
151
- },
152
- },
153
- ...processor === null
154
- ? {}
155
- : { processor },
156
- ...language === null
157
- ? {}
158
- : { language },
159
- },
160
- ...ruleset.map(({ id, rules, }) => {
161
- return {
162
- name: `linted/${id}/`,
116
+ : parser !== null
117
+ && !(parser in this.parsers)
118
+ || subparser !== null
119
+ && !(subparser in this.parsers)
120
+ ? []
121
+ : [
122
+ {
123
+ name: `linted/${scope}/`,
163
124
  files,
164
125
  ignores,
165
- rules,
166
- };
167
- }),
168
- ];
126
+ ...parser === null
127
+ && global === null
128
+ && subparser === null
129
+ && [...Object.keys(extraLanguageOptions)].length === 0
130
+ && [...Object.keys(extraParserOptions)].length === 0
131
+ ? {}
132
+ : {
133
+ languageOptions: {
134
+ ...extraLanguageOptions,
135
+ ...global === null
136
+ ? {}
137
+ : {
138
+ globals: globals[global],
139
+ },
140
+ ...parser === null
141
+ ? {}
142
+ : {
143
+ parser: this.parsers[parser],
144
+ },
145
+ ...subparser === null
146
+ && [...Object.keys(extraParserOptions)].length === 0
147
+ ? {}
148
+ : {
149
+ parserOptions: {
150
+ ...extraParserOptions,
151
+ ...subparser === null
152
+ ? {}
153
+ : {
154
+ parser: this.parsers[subparser],
155
+ },
156
+ },
157
+ },
158
+ },
159
+ },
160
+ ...processor === null
161
+ ? {}
162
+ : { processor },
163
+ ...language === null
164
+ ? {}
165
+ : { language },
166
+ },
167
+ ...ruleset.map(({ id, rules, }) => {
168
+ return {
169
+ name: `linted/${id}/`,
170
+ files,
171
+ ignores,
172
+ rules,
173
+ };
174
+ }),
175
+ ];
169
176
  }
170
177
  }
171
178
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,MAAM,OAAO,OAAO;IAUC;IACV;IANF,MAAM,CAAC;IACP,MAAM,CAAC;IAEd,YACE,IAAwB,EACP,QAAgD,EAC1D,OAAgC,EACvC,QAAmE,EACnE,EACE,GAAG,EAAE,eAAe,GAAG,EAAE,EACzB,GAAG,eAAe,KAC6C,EAAE;QANlD,aAAQ,GAAR,QAAQ,CAAwC;QAC1D,YAAO,GAAP,OAAO,CAAyB;QAOvC,MAAM,EACJ,cAAc,GAAG,QAAQ;aACtB,QAAQ;aACR,cAAc,EACjB,6BAA6B,GAAG,QAAQ;aACrC,QAAQ;aACR,6BAA6B,EAChC,UAAU,GAAG,QAAQ;aAClB,QAAQ;aACR,UAAU,EACb,WAAW,GAAG,QAAQ;aACnB,QAAQ;aACR,WAAW,GACf,GAAG,eAAe,EACnB,EACE,OAAO,GAAG,EAAE,EACZ,QAAQ,GAAG,KAAK,GACjB,GAAG,eAAe,CAAC;QAEpB,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE;gBACR,IAAI,EAAE,oBAA6B;gBACnC,aAAa,EAAE;oBACb,cAAc;oBACd,6BAA6B;iBAC9B;gBACD,eAAe,EAAE;oBACf,UAAU;oBACV,WAAW;iBACZ;aACF;YACD,OAAO,EAAE;g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C,MAAM,CAAC;6CAC7B;wCACL,GAAG,SAAS,KAAK,IAAI;+CAClB,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC;4CAClD,CAAC,CAAC,EAAE;4CACJ,CAAC,CAAC;gDACE,aAAa,EAAE;oDACb,GAAG,kBAAkB;oDACrB,GAAG,SAAS,KAAK,IAAI;wDACnB,CAAC,CAAC,EAAE;wDACJ,CAAC,CAAC;4DACE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;yDAChC;iDACN;6CACF;qCACN;iCACF;4BACL,GAAG,SAAS,KAAK,IAAI;gCACnB,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC,EAAE,SAAS,EAAE;4BACjB,GAAG,QAAQ,KAAK,IAAI;gCAClB,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC,EAAE,QAAQ,EAAE;yBACjB;wBACD,GAAG,OAAO,CAAC,GAAG,CACZ,CACE,EACE,EAAE,EACF,KAAK,GACN,EACD,EAAE;4BACF,OAAO;gCACL,IAAI,EAAE,UAAU,EAAE,GAAY;gCAC9B,KAAK;gCACL,OAAO;gCACP,KAAK;6BACN,CAAC;wBACJ,CAAC,CACF;qBACF,CAAC;IACZ,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import { scopes } from "./scope/index.js";
2
- import type { IPlugin, IParser } from "./scope/index.js";
3
1
  import type { Input } from "./interface/index.js";
4
- type Scope = typeof scopes[number];
5
- export default function ({ imports: { plugins, parsers, }, configuration: { defaults, extensions, }, }: Input<IPlugin, IParser, Scope>): unknown[];
6
- export {};
2
+ import type { RequiredPlugin, RequiredParser } from "./scope/index.js";
3
+ import { scopes, optionalScopes } from "./scope/index.js";
4
+ export default function ({ imports: { required: { plugins, parsers, }, optional, }, configuration: { defaults, extensions, }, }: Input<RequiredPlugin, RequiredParser, (typeof optionalScopes[number]), (typeof scopes[number])>): unknown[];
7
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAGP,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACR,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,KAAK,EAEN,MAAM,aAAa,CAAC;AAErB,KAAK,KAAK,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AAEnC,MAAM,CAAC,OAAO,WACZ,EACE,OAAO,EAAE,EACP,OAAO,EACP,OAAO,GACR,EACD,aAAa,EAAE,EACb,QAAQ,EACR,UAAU,GACX,GACF,EAAE,KAAK,CACN,OAAO,EACP,OAAO,EACP,KAAK,CACN,aAiCF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EAEN,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,MAAM,EACN,cAAc,EAGf,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,WACZ,EACE,OAAO,EAAE,EACP,QAAQ,EAAE,EACR,OAAO,EACP,OAAO,GACR,EACD,QAAa,GACd,EACD,aAAa,EAAE,EACb,QAAQ,EACR,UAAU,GACX,GACF,EAAE,KAAK,CACN,cAAc,EACd,cAAc,EACd,CAAC,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,EAC/B,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CACxB,aAiDF"}
package/dist/index.js CHANGED
@@ -1,12 +1,26 @@
1
+ import { scopes, optionalScopes, tree, registry, } from "./scope/index.js";
1
2
  import { Factory } from "./factory/index.js";
2
- import { scopes, tree, registry, } from "./scope/index.js";
3
- export default function ({ imports: { plugins, parsers, }, configuration: { defaults, extensions, }, }) {
3
+ export default function ({ imports: { required: { plugins, parsers, }, optional = {}, }, configuration: { defaults, extensions, }, }) {
4
4
  try {
5
- const factory = new Factory(tree, registry, parsers, defaults, extensions);
5
+ const factory = new Factory(optionalScopes, tree, registry, {
6
+ ...parsers,
7
+ ..."svelte" in optional
8
+ ? {
9
+ svelte: optional.svelte.parser,
10
+ }
11
+ : {},
12
+ }, defaults, extensions);
6
13
  return [
7
14
  {
8
15
  name: "linted/*/plugins/",
9
- plugins,
16
+ plugins: {
17
+ ...plugins,
18
+ ..."svelte" in optional
19
+ ? {
20
+ svelte: optional.svelte.plugin,
21
+ }
22
+ : {},
23
+ },
10
24
  },
11
25
  ...factory.globals,
12
26
  ...scopes
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,QAAQ,GACT,MAAM,SAAS,CAAC;AAYjB,MAAM,CAAC,OAAO,WACZ,EACE,OAAO,EAAE,EACP,OAAO,EACP,OAAO,GACR,EACD,aAAa,EAAE,EACb,QAAQ,EACR,UAAU,GACX,GAKF;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,OAAO,CAKzB,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,CACX,CAAC;QAEF,OAAO;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO;aACR;YACD,GAAG,OAAO,CAAC,OAAO;YAClB,GAAG,MAAM;iBACN,OAAO,CACN,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAC9B;SAC0B,CAAC;IAClC,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,eAAe,EACf,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,MAAM,EACN,cAAc,EACd,IAAI,EACJ,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,WACZ,EACE,OAAO,EAAE,EACP,QAAQ,EAAE,EACR,OAAO,EACP,OAAO,GACR,EACD,QAAQ,GAAG,EAAE,GACd,EACD,aAAa,EAAE,EACb,QAAQ,EACR,UAAU,GACX,GAMF;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,OAAO,CAMvB,cAAc,EACd,IAAI,EACJ,QAAQ,EACR;YACE,GAAG,OAAO;YACV,GAAG,QAAQ,IAAI,QAAQ;gBACrB,CAAC,CAAC;oBACE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM;iBAC/B;gBACH,CAAC,CAAC,EAAE;SACP,EACD,QAAQ,EACR,UAAU,CACT,CAAC;QAEN,OAAO;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACP,GAAG,OAAO;oBACV,GAAG,QAAQ,IAAI,QAAQ;wBACrB,CAAC,CAAC;4BACE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM;yBAC/B;wBACH,CAAC,CAAC,EAAE;iBACP;aACF;YACD,GAAG,OAAO,CAAC,OAAO;YAClB,GAAG,MAAM;iBACN,OAAO,CACN,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAC9B;SAC0B,CAAC;IAClC,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,eAAe,EACf,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { RequiredImports } from "./required.js";
2
+ import type { OptionalImports } from "./optional.js";
3
+ export interface Imports<RequiredPlugin extends string, RequiredParser extends string, OptionalImport extends string> {
4
+ required: RequiredImports<RequiredPlugin, RequiredParser>;
5
+ optional?: OptionalImports<OptionalImport>;
6
+ }
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/imports/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,OAAO,CACtB,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,MAAM;IAE7B,QAAQ,EAAE,eAAe,CACvB,cAAc,EACd,cAAc,CACf,CAAC;IACF,QAAQ,CAAC,EAAE,eAAe,CACxB,cAAc,CACf,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/interface/input/imports/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export type OptionalImports<OptionalImport extends string> = Partial<Record<OptionalImport, {
2
+ plugin: unknown;
3
+ parser: unknown;
4
+ }>>;
5
+ //# sourceMappingURL=optional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/imports/optional.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,CACzB,cAAc,SAAS,MAAM,IAC3B,OAAO,CACT,MAAM,CACJ,cAAc,EACd;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB,CACF,CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=optional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../../src/interface/input/imports/optional.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export interface RequiredImports<RequiredPlugin extends string, RequiredParser extends string> {
2
+ plugins: Record<RequiredPlugin, unknown>;
3
+ parsers: Record<RequiredParser, unknown>;
4
+ }
5
+ //# sourceMappingURL=required.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/imports/required.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe,CAC9B,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,MAAM;IAE7B,OAAO,EAAE,MAAM,CACb,cAAc,EACd,OAAO,CACR,CAAC;IACF,OAAO,EAAE,MAAM,CACb,cAAc,EACd,OAAO,CACR,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=required.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required.js","sourceRoot":"","sources":["../../../../src/interface/input/imports/required.ts"],"names":[],"mappings":""}
@@ -1,9 +1,7 @@
1
+ import type { Imports } from "./imports/index.js";
1
2
  import type { Configuration } from "./configuration/index.js";
2
- export interface Input<Plugin extends string, Parser extends string, Scope extends string> {
3
- imports: {
4
- plugins: Record<Plugin, unknown>;
5
- parsers: Record<Parser, unknown>;
6
- };
3
+ export interface Input<RequiredPlugin extends string, RequiredParser extends string, OptionalImport extends string, Scope extends string> {
4
+ imports: Imports<RequiredPlugin, RequiredParser, OptionalImport>;
7
5
  configuration: Configuration<Scope>;
8
6
  }
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,KAAK,CACpB,MAAM,SAAS,MAAM,EACrB,MAAM,SAAS,MAAM,EACrB,KAAK,SAAS,MAAM;IAEpB,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CACb,MAAM,EACN,OAAO,CACR,CAAC;QACF,OAAO,EAAE,MAAM,CACb,MAAM,EACN,OAAO,CACR,CAAC;KACH,CAAC;IACF,aAAa,EAAE,aAAa,CAC1B,KAAK,CACN,CAAC;CACH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,KAAK,CACpB,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,MAAM,EAC7B,KAAK,SAAS,MAAM;IAEpB,OAAO,EAAE,OAAO,CACd,cAAc,EACd,cAAc,EACd,cAAc,CACf,CAAC;IACF,aAAa,EAAE,aAAa,CAC1B,KAAK,CACN,CAAC;CACH"}
@@ -1,3 +1,3 @@
1
- export type { IPlugin } from "./plugins.js";
2
- export type { IParser } from "./parsers.js";
1
+ export type { RequiredPlugin } from "./plugins.js";
2
+ export type { RequiredParser } from "./parsers.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scope/dependencies/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scope/dependencies/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
@@ -1,2 +1,2 @@
1
- export type IParser = ("ts" | "svelte" | "html" | "yml");
1
+ export type RequiredParser = ("ts" | "html" | "yml");
2
2
  //# sourceMappingURL=parsers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../../src/scope/dependencies/parsers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAClB,IAAI,GACJ,QAAQ,GACR,MAAM,GACN,KAAK,CACR,CAAC"}
1
+ {"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../../src/scope/dependencies/parsers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,CACzB,IAAI,GACJ,MAAM,GACN,KAAK,CACR,CAAC"}
@@ -1,2 +1,2 @@
1
- export type IPlugin = ("@stylistic" | "@typescript-eslint" | "mocha" | "chai-friendly" | "chai-expect" | "svelte" | "@html-eslint" | "css" | "json" | "jsonc" | "yml");
1
+ export type RequiredPlugin = ("@stylistic" | "@typescript-eslint" | "mocha" | "chai-friendly" | "chai-expect" | "@html-eslint" | "css" | "json" | "jsonc" | "yml");
2
2
  //# sourceMappingURL=plugins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/scope/dependencies/plugins.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAClB,YAAY,GACZ,oBAAoB,GACpB,OAAO,GACP,eAAe,GACf,aAAa,GACb,QAAQ,GACR,cAAc,GACd,KAAK,GACL,MAAM,GACN,OAAO,GACP,KAAK,CACR,CAAC"}
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/scope/dependencies/plugins.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,CACzB,YAAY,GACZ,oBAAoB,GACpB,OAAO,GACP,eAAe,GACf,aAAa,GACb,cAAc,GACd,KAAK,GACL,MAAM,GACN,OAAO,GACP,KAAK,CACR,CAAC"}
@@ -10,7 +10,10 @@ export declare const scopes: readonly [
10
10
  "jsoncc",
11
11
  "yml"
12
12
  ];
13
+ export declare const optionalScopes: readonly [
14
+ "svelte"
15
+ ];
13
16
  export { tree } from "./tree/index.js";
14
17
  export { registry } from "./registry/index.js";
15
- export type { IPlugin, IParser, } from "./dependencies/index.js";
18
+ export type { RequiredPlugin, RequiredParser, } from "./dependencies/index.js";
16
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,2FAWT,CAAC;AACX,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,OAAO,EACP,OAAO,GACR,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,2FAWT,CAAC;AACX,eAAO,MAAM,cAAc,qBAAsB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC"}
@@ -10,6 +10,7 @@ export const scopes = [
10
10
  "jsoncc",
11
11
  "yml",
12
12
  ];
13
+ export const optionalScopes = ["svelte"];
13
14
  export { tree } from "./tree/index.js";
14
15
  export { registry } from "./registry/index.js";
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;CACG,CAAC;AACX,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;CACG,CAAC;AACX,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAQ,CAAU,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
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": "19.0.3",
6
+ "version": "20.0.0-rc.1",
7
7
  "repository": "github:jimmy-zhening-luo/linted-core",
8
8
  "private": false,
9
9
  "engineStrict": true,
@@ -6,24 +6,24 @@ Parser = (scope: string) => `MOCK_PARSER:${scope}`;
6
6
 
7
7
  export const TEST_INPUT = {
8
8
  imports: {
9
- plugins: {
10
- "@stylistic": Plugin,
11
- "@typescript-eslint": Plugin,
12
- mocha: Plugin,
13
- "chai-friendly": Plugin,
14
- "chai-expect": Plugin,
15
- svelte: Plugin,
16
- "@html-eslint": Plugin,
17
- css: Plugin,
18
- json: Plugin,
19
- jsonc: Plugin,
20
- yml: Plugin,
21
- },
22
- parsers: {
23
- ts: Parser("TS"),
24
- svelte: Parser("SVELTE"),
25
- html: Parser("HTML"),
26
- yml: Parser("YML"),
9
+ required: {
10
+ plugins: {
11
+ "@stylistic": Plugin,
12
+ "@typescript-eslint": Plugin,
13
+ mocha: Plugin,
14
+ "chai-friendly": Plugin,
15
+ "chai-expect": Plugin,
16
+ "@html-eslint": Plugin,
17
+ css: Plugin,
18
+ json: Plugin,
19
+ jsonc: Plugin,
20
+ yml: Plugin,
21
+ },
22
+ parsers: {
23
+ ts: Parser("TS"),
24
+ html: Parser("HTML"),
25
+ yml: Parser("YML"),
26
+ },
27
27
  },
28
28
  },
29
29
  configuration: {
@@ -3,22 +3,48 @@ import type { Input } from "../interface";
3
3
  import type * as Model from "./model";
4
4
 
5
5
  export class Factory<
6
- Plugin extends string,
7
- Parser extends string,
6
+ RequiredPlugin extends string,
7
+ RequiredParser extends string,
8
+ OptionalScope extends string,
8
9
  Scope extends string,
9
10
  > {
10
11
  public global;
11
12
  public scopes;
12
13
 
13
14
  constructor(
15
+ optionalScopes: readonly Scope[],
14
16
  tree: Model.ITree<Scope>,
15
- private readonly registry: Record<Scope, Model.IManifest<Parser>>,
16
- public parsers: Record<Parser, unknown>,
17
- defaults: Input<Plugin, Parser, Scope>["configuration"]["defaults"],
17
+ private readonly registry: Record<
18
+ Scope,
19
+ Model.IManifest<
20
+ | RequiredParser
21
+ | OptionalScope
22
+ >
23
+ >,
24
+ public parsers: Record<
25
+ RequiredParser,
26
+ unknown
27
+ > & Partial<
28
+ Record<
29
+ OptionalScope,
30
+ unknown
31
+ >
32
+ >,
33
+ defaults: Input<
34
+ RequiredPlugin,
35
+ RequiredParser,
36
+ OptionalScope,
37
+ Scope
38
+ >["configuration"]["defaults"],
18
39
  {
19
40
  "*": globalExtension = {},
20
41
  ...scopeExtensions
21
- }: Input<Plugin, Parser, Scope>["configuration"]["extensions"] = {},
42
+ }: Input<
43
+ RequiredPlugin,
44
+ RequiredParser,
45
+ OptionalScope,
46
+ Scope
47
+ >["configuration"]["extensions"] = {},
22
48
  ) {
23
49
  const {
24
50
  noInlineConfig = defaults
@@ -101,25 +127,33 @@ export class Factory<
101
127
  );
102
128
  }
103
129
 
130
+ const OptionalScopes = new Set<Scope>(
131
+ optionalScopes,
132
+ );
133
+
104
134
  for (const [scope, parents] of tree)
105
- for (const parent of parents) {
106
- this
107
- .scopes
108
- .files[parent]
109
- .push(
110
- ...this
111
- .scopes
112
- .files[scope],
113
- );
114
- this
115
- .scopes
116
- .ignores[parent]
117
- .push(
118
- ...this
119
- .scopes
120
- .ignores[scope],
121
- );
122
- }
135
+ if (
136
+ !OptionalScopes.has(scope)
137
+ || scope in parsers
138
+ )
139
+ for (const parent of parents) {
140
+ this
141
+ .scopes
142
+ .files[parent]
143
+ .push(
144
+ ...this
145
+ .scopes
146
+ .files[scope],
147
+ );
148
+ this
149
+ .scopes
150
+ .ignores[parent]
151
+ .push(
152
+ ...this
153
+ .scopes
154
+ .ignores[scope],
155
+ );
156
+ }
123
157
  }
124
158
 
125
159
  public get globals() {
@@ -192,68 +226,72 @@ export class Factory<
192
226
  ? []
193
227
  : ruleset.length === 0
194
228
  ? []
195
- : [
196
- {
197
- name: `linted/${scope as string}/` as const,
198
- files,
199
- ignores,
200
- ...parser === null
201
- && global === null
202
- && subparser === null
203
- && [...Object.keys(extraLanguageOptions)].length === 0
204
- && [...Object.keys(extraParserOptions)].length === 0
205
- ? {}
206
- : {
207
- languageOptions: {
208
- ...extraLanguageOptions,
209
- ...global === null
210
- ? {}
211
- : {
212
- globals: globals[global],
213
- },
214
- ...parser === null
215
- ? {}
216
- : {
217
- parser: this.parsers[parser],
218
- },
219
- ...subparser === null
220
- && [...Object.keys(extraParserOptions)].length === 0
221
- ? {}
222
- : {
223
- parserOptions: {
224
- ...extraParserOptions,
225
- ...subparser === null
226
- ? {}
227
- : {
228
- parser: this
229
- .parsers[subparser],
230
- },
229
+ : parser !== null
230
+ && !(parser in this.parsers)
231
+ || subparser !== null
232
+ && !(subparser in this.parsers)
233
+ ? []
234
+ : [
235
+ {
236
+ name: `linted/${scope as string}/` as const,
237
+ files,
238
+ ignores,
239
+ ...parser === null
240
+ && global === null
241
+ && subparser === null
242
+ && [...Object.keys(extraLanguageOptions)].length === 0
243
+ && [...Object.keys(extraParserOptions)].length === 0
244
+ ? {}
245
+ : {
246
+ languageOptions: {
247
+ ...extraLanguageOptions,
248
+ ...global === null
249
+ ? {}
250
+ : {
251
+ globals: globals[global],
252
+ },
253
+ ...parser === null
254
+ ? {}
255
+ : {
256
+ parser: this.parsers[parser],
257
+ },
258
+ ...subparser === null
259
+ && [...Object.keys(extraParserOptions)].length === 0
260
+ ? {}
261
+ : {
262
+ parserOptions: {
263
+ ...extraParserOptions,
264
+ ...subparser === null
265
+ ? {}
266
+ : {
267
+ parser: this.parsers[subparser],
268
+ },
269
+ },
231
270
  },
232
- },
271
+ },
233
272
  },
273
+ ...processor === null
274
+ ? {}
275
+ : { processor },
276
+ ...language === null
277
+ ? {}
278
+ : { language },
279
+ },
280
+ ...ruleset.map(
281
+ (
282
+ {
283
+ id,
284
+ rules,
234
285
  },
235
- ...processor === null
236
- ? {}
237
- : { processor },
238
- ...language === null
239
- ? {}
240
- : { language },
241
- },
242
- ...ruleset.map(
243
- (
244
- {
245
- id,
246
- rules,
286
+ ) => {
287
+ return {
288
+ name: `linted/${id}/` as const,
289
+ files,
290
+ ignores,
291
+ rules,
292
+ };
247
293
  },
248
- ) => {
249
- return {
250
- name: `linted/${id}/` as const,
251
- files,
252
- ignores,
253
- rules,
254
- };
255
- },
256
- ),
257
- ];
294
+ ),
295
+ ];
258
296
  }
259
297
  }
@@ -1,4 +1,6 @@
1
- export interface IManifest<Parser> {
1
+ export interface IManifest<
2
+ Parser,
3
+ > {
2
4
  languageOptions: {
3
5
  [property: string]: unknown;
4
6
  parser?: Parser;
package/src/index.ts CHANGED
@@ -1,53 +1,72 @@
1
- import { Factory } from "./factory";
1
+ import type {
2
+ Input,
3
+ Output,
4
+ } from "./interface";
5
+ import type {
6
+ RequiredPlugin,
7
+ RequiredParser,
8
+ } from "./scope";
2
9
  import {
3
10
  scopes,
11
+ optionalScopes,
4
12
  tree,
5
13
  registry,
6
14
  } from "./scope";
7
- import type {
8
- IPlugin,
9
- IParser,
10
- } from "./scope";
11
- import type {
12
- Input,
13
- Output,
14
- } from "./interface";
15
-
16
- type Scope = typeof scopes[number];
15
+ import { Factory } from "./factory";
17
16
 
18
17
  export default function (
19
18
  {
20
19
  imports: {
21
- plugins,
22
- parsers,
20
+ required: {
21
+ plugins,
22
+ parsers,
23
+ },
24
+ optional = {},
23
25
  },
24
26
  configuration: {
25
27
  defaults,
26
28
  extensions,
27
29
  },
28
30
  }: Input<
29
- IPlugin,
30
- IParser,
31
- Scope
31
+ RequiredPlugin,
32
+ RequiredParser,
33
+ (typeof optionalScopes[number]),
34
+ (typeof scopes[number])
32
35
  >,
33
36
  ) {
34
37
  try {
35
38
  const factory = new Factory<
36
- IPlugin,
37
- IParser,
38
- Scope
39
+ RequiredPlugin,
40
+ RequiredParser,
41
+ (typeof optionalScopes[number]),
42
+ (typeof scopes[number])
39
43
  >(
40
- tree,
41
- registry,
42
- parsers,
43
- defaults,
44
- extensions,
45
- );
44
+ optionalScopes,
45
+ tree,
46
+ registry,
47
+ {
48
+ ...parsers,
49
+ ..."svelte" in optional
50
+ ? {
51
+ svelte: optional.svelte.parser,
52
+ }
53
+ : {},
54
+ },
55
+ defaults,
56
+ extensions,
57
+ );
46
58
 
47
59
  return [
48
60
  {
49
61
  name: "linted/*/plugins/",
50
- plugins,
62
+ plugins: {
63
+ ...plugins,
64
+ ..."svelte" in optional
65
+ ? {
66
+ svelte: optional.svelte.plugin,
67
+ }
68
+ : {},
69
+ },
51
70
  },
52
71
  ...factory.globals,
53
72
  ...scopes
@@ -0,0 +1,16 @@
1
+ import type { RequiredImports } from "./required";
2
+ import type { OptionalImports } from "./optional";
3
+
4
+ export interface Imports<
5
+ RequiredPlugin extends string,
6
+ RequiredParser extends string,
7
+ OptionalImport extends string,
8
+ > {
9
+ required: RequiredImports<
10
+ RequiredPlugin,
11
+ RequiredParser
12
+ >;
13
+ optional?: OptionalImports<
14
+ OptionalImport
15
+ >;
16
+ }
@@ -0,0 +1,11 @@
1
+ export type OptionalImports<
2
+ OptionalImport extends string,
3
+ > = Partial<
4
+ Record<
5
+ OptionalImport,
6
+ {
7
+ plugin: unknown;
8
+ parser: unknown;
9
+ }
10
+ >
11
+ >;
@@ -0,0 +1,13 @@
1
+ export interface RequiredImports<
2
+ RequiredPlugin extends string,
3
+ RequiredParser extends string,
4
+ > {
5
+ plugins: Record<
6
+ RequiredPlugin,
7
+ unknown
8
+ >;
9
+ parsers: Record<
10
+ RequiredParser,
11
+ unknown
12
+ >;
13
+ }
@@ -1,20 +1,17 @@
1
+ import type { Imports } from "./imports";
1
2
  import type { Configuration } from "./configuration";
2
3
 
3
4
  export interface Input<
4
- Plugin extends string,
5
- Parser extends string,
5
+ RequiredPlugin extends string,
6
+ RequiredParser extends string,
7
+ OptionalImport extends string,
6
8
  Scope extends string,
7
9
  > {
8
- imports: {
9
- plugins: Record<
10
- Plugin,
11
- unknown
12
- >;
13
- parsers: Record<
14
- Parser,
15
- unknown
16
- >;
17
- };
10
+ imports: Imports<
11
+ RequiredPlugin,
12
+ RequiredParser,
13
+ OptionalImport
14
+ >;
18
15
  configuration: Configuration<
19
16
  Scope
20
17
  >;
@@ -1,2 +1,2 @@
1
- export type { IPlugin } from "./plugins";
2
- export type { IParser } from "./parsers";
1
+ export type { RequiredPlugin } from "./plugins";
2
+ export type { RequiredParser } from "./parsers";
@@ -1,6 +1,5 @@
1
- export type IParser = (
1
+ export type RequiredParser = (
2
2
  | "ts"
3
- | "svelte"
4
3
  | "html"
5
4
  | "yml"
6
5
  );
@@ -1,10 +1,9 @@
1
- export type IPlugin = (
1
+ export type RequiredPlugin = (
2
2
  | "@stylistic"
3
3
  | "@typescript-eslint"
4
4
  | "mocha"
5
5
  | "chai-friendly"
6
6
  | "chai-expect"
7
- | "svelte"
8
7
  | "@html-eslint"
9
8
  | "css"
10
9
  | "json"
@@ -10,9 +10,10 @@ export const scopes = [
10
10
  "jsoncc",
11
11
  "yml",
12
12
  ] as const;
13
+ export const optionalScopes = ["svelte"] as const;
13
14
  export { tree } from "./tree";
14
15
  export { registry } from "./registry";
15
16
  export type {
16
- IPlugin,
17
- IParser,
17
+ RequiredPlugin,
18
+ RequiredParser,
18
19
  } from "./dependencies";