@eslinted/core 0.6.0 → 0.7.0-rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. package/dist/boundary/boundary.d.ts +6 -0
  2. package/dist/boundary/boundary.d.ts.map +1 -0
  3. package/dist/boundary/boundary.js +3 -0
  4. package/dist/boundary/boundary.js.map +1 -0
  5. package/dist/boundary/input/input.d.ts +5 -0
  6. package/dist/boundary/input/input.d.ts.map +1 -0
  7. package/dist/boundary/input/input.js +2 -0
  8. package/dist/boundary/input/input.js.map +1 -0
  9. package/dist/boundary/input/parsers/index.d.ts +5 -0
  10. package/dist/boundary/input/parsers/index.d.ts.map +1 -0
  11. package/dist/boundary/input/parsers/index.js +2 -0
  12. package/dist/boundary/input/parsers/index.js.map +1 -0
  13. package/dist/boundary/input/parsers/parsers.d.ts +7 -0
  14. package/dist/boundary/input/parsers/parsers.d.ts.map +1 -0
  15. package/dist/boundary/input/parsers/parsers.js +2 -0
  16. package/dist/boundary/input/parsers/parsers.js.map +1 -0
  17. package/dist/boundary/input/plugins/index.d.ts +32 -0
  18. package/dist/boundary/input/plugins/index.d.ts.map +1 -0
  19. package/dist/boundary/input/plugins/index.js +2 -0
  20. package/dist/boundary/input/plugins/index.js.map +1 -0
  21. package/dist/boundary/input/plugins/plugins.d.ts +6 -0
  22. package/dist/boundary/input/plugins/plugins.d.ts.map +1 -0
  23. package/dist/boundary/input/plugins/plugins.js +2 -0
  24. package/dist/boundary/input/plugins/plugins.js.map +1 -0
  25. package/dist/boundary/output/config/IConfig.d.ts +19 -0
  26. package/dist/boundary/output/config/IConfig.d.ts.map +1 -0
  27. package/dist/boundary/output/config/IConfig.js +2 -0
  28. package/dist/boundary/output/config/IConfig.js.map +1 -0
  29. package/dist/boundary/output/config/index.d.ts +19 -0
  30. package/dist/boundary/output/config/index.d.ts.map +1 -0
  31. package/dist/boundary/output/config/index.js +2 -0
  32. package/dist/boundary/output/config/index.js.map +1 -0
  33. package/dist/boundary/output/output.d.ts +3 -0
  34. package/dist/boundary/output/output.d.ts.map +1 -0
  35. package/dist/boundary/output/output.js +2 -0
  36. package/dist/boundary/output/output.js.map +1 -0
  37. package/dist/boundary/scopes/scopes.d.ts +4 -0
  38. package/dist/boundary/scopes/scopes.d.ts.map +1 -0
  39. package/dist/boundary/scopes/scopes.js +11 -0
  40. package/dist/boundary/scopes/scopes.js.map +1 -0
  41. package/dist/factory/Factory.d.ts +7 -0
  42. package/dist/factory/Factory.d.ts.map +1 -0
  43. package/dist/factory/Factory.js +5 -0
  44. package/dist/factory/Factory.js.map +1 -0
  45. package/dist/factory/files/Files.d.ts +8 -0
  46. package/dist/factory/files/Files.d.ts.map +1 -0
  47. package/dist/factory/files/Files.js +15 -0
  48. package/dist/factory/files/Files.js.map +1 -0
  49. package/dist/factory/options/Options.d.ts +20 -0
  50. package/dist/factory/options/Options.d.ts.map +1 -0
  51. package/dist/factory/options/Options.js +17 -0
  52. package/dist/factory/options/Options.js.map +1 -0
  53. package/dist/factory/options/option/Option.d.ts +29 -0
  54. package/dist/factory/options/option/Option.d.ts.map +1 -0
  55. package/dist/factory/options/option/Option.js +26 -0
  56. package/dist/factory/options/option/Option.js.map +1 -0
  57. package/dist/factory/options/option/html/index.d.ts +7 -3
  58. package/dist/factory/options/option/html/index.d.ts.map +1 -1
  59. package/dist/factory/options/option/html/index.js +6 -12
  60. package/dist/factory/options/option/html/index.js.map +1 -1
  61. package/dist/factory/options/option/js/index.d.ts +7 -2
  62. package/dist/factory/options/option/js/index.d.ts.map +1 -1
  63. package/dist/factory/options/option/js/index.js +8 -15
  64. package/dist/factory/options/option/js/index.js.map +1 -1
  65. package/dist/factory/options/option/json/index.d.ts +7 -3
  66. package/dist/factory/options/option/json/index.d.ts.map +1 -1
  67. package/dist/factory/options/option/json/index.js +6 -12
  68. package/dist/factory/options/option/json/index.js.map +1 -1
  69. package/dist/factory/options/option/jsonc/index.d.ts +7 -3
  70. package/dist/factory/options/option/jsonc/index.d.ts.map +1 -1
  71. package/dist/factory/options/option/jsonc/index.js +6 -12
  72. package/dist/factory/options/option/jsonc/index.js.map +1 -1
  73. package/dist/factory/options/option/svelte/index.d.ts +22 -5
  74. package/dist/factory/options/option/svelte/index.d.ts.map +1 -1
  75. package/dist/factory/options/option/svelte/index.js +14 -21
  76. package/dist/factory/options/option/svelte/index.js.map +1 -1
  77. package/dist/factory/options/option/ts/index.d.ts +15 -4
  78. package/dist/factory/options/option/ts/index.d.ts.map +1 -1
  79. package/dist/factory/options/option/ts/index.js +12 -18
  80. package/dist/factory/options/option/ts/index.js.map +1 -1
  81. package/dist/factory/options/option/yml/index.d.ts +7 -3
  82. package/dist/factory/options/option/yml/index.d.ts.map +1 -1
  83. package/dist/factory/options/option/yml/index.js +6 -12
  84. package/dist/factory/options/option/yml/index.js.map +1 -1
  85. package/dist/factory/ruleset/Ruleset.d.ts +12 -0
  86. package/dist/factory/ruleset/Ruleset.d.ts.map +1 -0
  87. package/dist/factory/ruleset/Ruleset.js +27 -0
  88. package/dist/factory/ruleset/Ruleset.js.map +1 -0
  89. package/dist/factory/ruleset/rule/Rule.d.ts +6 -0
  90. package/dist/factory/ruleset/rule/Rule.d.ts.map +1 -0
  91. package/dist/factory/ruleset/rule/Rule.js +9 -0
  92. package/dist/factory/ruleset/rule/Rule.js.map +1 -0
  93. package/dist/index.d.ts +3 -4
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +38 -26
  96. package/dist/index.js.map +1 -1
  97. package/package.json +2 -2
  98. package/src/boundary/boundary.ts +11 -0
  99. package/src/boundary/input/input.ts +5 -0
  100. package/src/boundary/input/parsers/parsers.ts +6 -0
  101. package/src/boundary/input/plugins/plugins.ts +7 -0
  102. package/src/{config/index.ts → boundary/output/config/IConfig.ts} +3 -4
  103. package/src/boundary/output/config/interface/option/IOption.d.ts +20 -0
  104. package/src/boundary/output/config/interface/option/language/IOLanguage.d.ts +18 -0
  105. package/src/boundary/output/config/interface/option/language/ecma/IOLanguageEcma.d.ts +1 -0
  106. package/src/boundary/output/config/interface/option/language/globals/IOLanguageGlobals.d.ts +1 -0
  107. package/src/boundary/output/config/interface/option/language/source/IOLanguageSource.d.ts +3 -0
  108. package/src/boundary/output/config/interface/option/linter/IOLinter.d.ts +4 -0
  109. package/src/boundary/output/config/interface/option/name/IOName.d.ts +1 -0
  110. package/src/boundary/output/config/interface/option/plugins/IOPlugins.d.ts +1 -0
  111. package/src/boundary/output/config/interface/option/processor/IOProcessor.d.ts +1 -0
  112. package/src/boundary/output/output.ts +3 -0
  113. package/src/factory/Factory.ts +13 -0
  114. package/src/factory/files/Files.ts +15 -0
  115. package/src/factory/options/{index.ts → Options.ts} +2 -2
  116. package/src/factory/options/option/Option.ts +58 -0
  117. package/src/factory/options/option/html/index.ts +10 -23
  118. package/src/factory/options/option/js/index.ts +9 -20
  119. package/src/factory/options/option/json/index.ts +10 -23
  120. package/src/factory/options/option/jsonc/index.ts +10 -23
  121. package/src/factory/options/option/svelte/index.ts +23 -34
  122. package/src/factory/options/option/ts/index.ts +20 -29
  123. package/src/factory/options/option/yml/index.ts +10 -23
  124. package/src/factory/ruleset/{index.ts → Ruleset.ts} +1 -1
  125. package/src/index.ts +62 -72
  126. package/types/project/OmitLast.d.ts +1 -0
  127. package/src/config/files/IFiles.d.ts +0 -1
  128. package/src/config/option/IOption.d.ts +0 -25
  129. package/src/config/option/language/IOLanguage.d.ts +0 -15
  130. package/src/config/option/language/ecma/IOLanguageEcma.d.ts +0 -19
  131. package/src/config/option/language/globals/IOLanguageGlobals.d.ts +0 -3
  132. package/src/config/option/language/parser/IOLanguageParser.d.ts +0 -3
  133. package/src/config/option/language/parserOptions/IOLanguageParserOptions.d.ts +0 -5
  134. package/src/config/option/language/source/IOLanguageSource.d.ts +0 -12
  135. package/src/config/option/linter/IOLinter.d.ts +0 -30
  136. package/src/config/option/name/IOName.d.ts +0 -3
  137. package/src/config/option/plugins/IOPlugins.d.ts +0 -3
  138. package/src/config/option/processor/IOProcessor.d.ts +0 -3
  139. package/src/config/rules/IRules.d.ts +0 -1
  140. package/src/factory/files/index.ts +0 -20
  141. package/src/factory/index.ts +0 -12
  142. package/src/factory/options/option/index.ts +0 -27
  143. package/src/module/boundary/index.ts +0 -3
  144. package/src/module/boundary/parsers/index.ts +0 -12
  145. package/src/module/boundary/plugins/index.ts +0 -20
  146. package/src/module/index.ts +0 -9
  147. /package/src/{config/rules/rule → boundary/output/config/interface/rules}/IRule.d.ts +0 -0
  148. /package/src/{config/rules/rule → boundary/output/config/interface/rules}/state/RuleSeverity.d.ts +0 -0
  149. /package/src/{module/scopes/index.ts → boundary/scopes/scopes.ts} +0 -0
  150. /package/src/factory/ruleset/rule/{index.ts → Rule.ts} +0 -0
  151. /package/types/{literal → typioca/literal}/number/base32.d.ts +0 -0
  152. /package/types/{literal → typioca/literal}/number/base64.d.ts +0 -0
  153. /package/types/{literal → typioca/literal}/number/binary.d.ts +0 -0
  154. /package/types/{literal → typioca/literal}/number/decimal.d.ts +0 -0
  155. /package/types/{literal → typioca/literal}/number/hex.d.ts +0 -0
  156. /package/types/{literal → typioca/literal}/number/octal.d.ts +0 -0
  157. /package/types/{literal → typioca/literal}/number/quatral.d.ts +0 -0
  158. /package/types/{literal → typioca/literal}/number/ternary.d.ts +0 -0
  159. /package/types/{literal → typioca/literal}/string/base64char.d.ts +0 -0
  160. /package/types/{literal → typioca/literal}/string/digit.d.ts +0 -0
  161. /package/types/{literal → typioca/literal}/string/hexchar.d.ts +0 -0
  162. /package/types/{literal → typioca/literal}/string/letter.d.ts +0 -0
  163. /package/types/{safe → typioca/safe}/Safe.d.ts +0 -0
  164. /package/types/{safe → typioca/safe}/numbers/finite/Finite.d.ts +0 -0
  165. /package/types/{safe → typioca/safe}/numbers/finite.d.ts +0 -0
  166. /package/types/{safe → typioca/safe}/numbers/fint.d.ts +0 -0
  167. /package/types/{safe → typioca/safe}/numbers/int/Int.d.ts +0 -0
  168. /package/types/{safe → typioca/safe}/numbers/int.d.ts +0 -0
  169. /package/types/{safe → typioca/safe}/numbers/numberful.d.ts +0 -0
  170. /package/types/{safe → typioca/safe}/numbers/polarity/Negative.d.ts +0 -0
  171. /package/types/{safe → typioca/safe}/numbers/polarity/Positive.d.ts +0 -0
  172. /package/types/{safe → typioca/safe}/numbers/polarity/pole/Pole.d.ts +0 -0
  173. /package/types/{safe → typioca/safe}/primitive.d.ts +0 -0
  174. /package/types/{safe → typioca/safe}/strings/char.d.ts +0 -0
  175. /package/types/{safe → typioca/safe}/strings/length/PropLength.d.ts +0 -0
  176. /package/types/{safe → typioca/safe}/strings/stringful.d.ts +0 -0
  177. /package/types/{utility → typioca/utility}/interface/construct/Particord.d.ts +0 -0
  178. /package/types/{utility → typioca/utility}/interface/construct/Property.d.ts +0 -0
  179. /package/types/{utility → typioca/utility}/interface/construct/Recordful.d.ts +0 -0
  180. /package/types/{utility → typioca/utility}/interface/construct/Table.d.ts +0 -0
  181. /package/types/{utility → typioca/utility}/interface/construct/properties/Field.d.ts +0 -0
  182. /package/types/{utility → typioca/utility}/interface/construct/properties/Flag.d.ts +0 -0
  183. /package/types/{utility → typioca/utility}/interface/construct/properties/Limit.d.ts +0 -0
  184. /package/types/{utility → typioca/utility}/interface/construct/properties/List.d.ts +0 -0
  185. /package/types/{utility → typioca/utility}/interface/construct/properties/Listish.d.ts +0 -0
  186. /package/types/{utility → typioca/utility}/interface/construct/properties/Scalar.d.ts +0 -0
  187. /package/types/{utility → typioca/utility}/interface/construct/tables/FieldTable.d.ts +0 -0
  188. /package/types/{utility → typioca/utility}/interface/construct/tables/FlagTable.d.ts +0 -0
  189. /package/types/{utility → typioca/utility}/interface/construct/tables/ListTable.d.ts +0 -0
  190. /package/types/{utility → typioca/utility}/interface/construct/tables/ListishTable.d.ts +0 -0
  191. /package/types/{utility → typioca/utility}/interface/construct/tables/ScalarTable.d.ts +0 -0
  192. /package/types/{utility → typioca/utility}/interface/identity/Interface.d.ts +0 -0
  193. /package/types/{utility → typioca/utility}/interface/identity/Keys.d.ts +0 -0
  194. /package/types/{utility → typioca/utility}/interface/transform/Unrequire.d.ts +0 -0
  195. /package/types/{utility → typioca/utility}/iterable/construct/ArrayN.d.ts +0 -0
  196. /package/types/{utility → typioca/utility}/iterable/construct/Tuple.d.ts +0 -0
  197. /package/types/{utility → typioca/utility}/iterable/construct/arrays/Arrays.d.ts +0 -0
  198. /package/types/{utility → typioca/utility}/iterable/construct/tuples/Tuples.d.ts +0 -0
  199. /package/types/{utility → typioca/utility}/iterable/identity/DyadType.d.ts +0 -0
  200. /package/types/{utility → typioca/utility}/iterable/identity/MonadType.d.ts +0 -0
  201. /package/types/{utility → typioca/utility}/iterable/identity/TriadType.d.ts +0 -0
  202. /package/types/{utility → typioca/utility}/iterable/identity/array/ArrayType.d.ts +0 -0
  203. /package/types/{utility → typioca/utility}/iterable/identity/array/length/ArrayLength.d.ts +0 -0
  204. /package/types/{utility → typioca/utility}/iterable/transform/Join.d.ts +0 -0
  205. /package/types/{utility → typioca/utility}/iterable/transform/Unflat.d.ts +0 -0
  206. /package/types/{utility → typioca/utility}/iterable/transform/stringarray/Chain.d.ts +0 -0
  207. /package/types/{utility → typioca/utility}/iterable/transform/stringarray/PathN.d.ts +0 -0
  208. /package/types/{utility → typioca/utility}/iterable/transform/stringarray/stringify/Stringify.d.ts +0 -0
  209. /package/types/{utility → typioca/utility}/length/Length.d.ts +0 -0
  210. /package/types/{utility → typioca/utility}/null/null.d.ts +0 -0
  211. /package/types/{utility → typioca/utility}/null/nullable.d.ts +0 -0
  212. /package/types/{utility → typioca/utility}/primitive/Primeval.d.ts +0 -0
  213. /package/types/{utility → typioca/utility}/primitive/boolean/True.d.ts +0 -0
  214. /package/types/{utility → typioca/utility}/primitive/number/Numbered.d.ts +0 -0
  215. /package/types/{utility → typioca/utility}/primitive/string/literal.d.ts +0 -0
  216. /package/types/{utility → typioca/utility}/primitive/string/literalful.d.ts +0 -0
@@ -0,0 +1,13 @@
1
+ import Options from "./options/Options.js";
2
+ import Files from "./files/Files.js";
3
+ import Ruleset, { Rule } from "./ruleset/Ruleset.js";
4
+ import type { Scope } from "../index.js";
5
+
6
+ export type Blanka = ConstructorParameters<typeof Options["js"]>;
7
+ export {
8
+ Options,
9
+ Files,
10
+ Ruleset,
11
+ Rule,
12
+ type Scope,
13
+ };
@@ -0,0 +1,15 @@
1
+ import type { Scope } from "../Factory.js";
2
+
3
+ export default class Files {
4
+ constructor(
5
+ private readonly base: Record<Scope, string[]>,
6
+ private readonly includes: Particord<Scope, string[]>,
7
+ ) {}
8
+
9
+ public files(scope: Scope): readonly string[] {
10
+ return [
11
+ ...this.base[scope],
12
+ ...this.includes[scope] ?? [],
13
+ ];
14
+ }
15
+ }
@@ -1,4 +1,4 @@
1
- import type { Scope } from "../index.js";
1
+ import type { Scope } from "../Factory.js";
2
2
  import JsOption from "./option/js/index.js";
3
3
  import TsOption from "./option/ts/index.js";
4
4
  import SvelteOption from "./option/svelte/index.js";
@@ -16,4 +16,4 @@ export default {
16
16
  json: JsonOption,
17
17
  jsonc: JsoncOption,
18
18
  yml: YmlOption,
19
- } satisfies Record<Scope, unknown>;
19
+ } as const;
@@ -0,0 +1,58 @@
1
+ import type { Scope } from "../Options.js";
2
+
3
+ export default abstract class Option<
4
+ S extends Scope,
5
+ PluginId extends string,
6
+ IsEcma extends boolean = true,
7
+ ParserOptions extends object | boolean = false,
8
+ ParserCount extends 0 | 1 | 2 = 0,
9
+ GlobalTypes extends string = never,
10
+ Processor extends object = never,
11
+ > {
12
+ public readonly linterOptions = {
13
+ noInlineConfig: true,
14
+ reportUnusedDisableDirectives: "error",
15
+ } as const;
16
+
17
+ public abstract readonly name: literalful<`scope:${S}`>;
18
+ public abstract readonly processor: (Interface<Processor> extends never ? object : Interface<Processor> extends { "interface": string } ? Interface<Processor> : object);
19
+
20
+ constructor(
21
+ public readonly files: readonly string[],
22
+ public readonly plugins: IOPlugins<PluginId>,
23
+ public readonly parser: Tuple<unknown, ParserCount>,
24
+ ) {}
25
+
26
+ public get option() {
27
+ const {
28
+ name,
29
+ files,
30
+ plugins,
31
+ linterOptions,
32
+ languageOptions,
33
+ processor,
34
+ } = this;
35
+
36
+ return {
37
+ name,
38
+ files,
39
+ linterOptions,
40
+ languageOptions,
41
+ plugins,
42
+ ...processor,
43
+ } satisfies IOption<
44
+ `scope:${S}`,
45
+ PluginId,
46
+ IsEcma,
47
+ ParserOptions,
48
+ GlobalTypes,
49
+ Processor
50
+ >;
51
+ }
52
+
53
+ public abstract get languageOptions(): IOLanguage<
54
+ IsEcma,
55
+ ParserOptions,
56
+ GlobalTypes
57
+ >;
58
+ }
@@ -1,31 +1,18 @@
1
- import Option from "../index.js";
1
+ import Option from "../Option.js";
2
2
 
3
3
  export default class HtmlOption extends Option<
4
4
  "html",
5
5
  "@html-eslint",
6
+ false,
6
7
  true,
7
- never,
8
- never,
9
- never,
10
- never,
11
- never
8
+ 1
12
9
  > {
13
- constructor(
14
- plugins: HtmlOption["body"]["plugins"],
15
- parser: HtmlOption["body"]["languageOptions"]["parser"],
16
- files: readonly string[],
17
- ) {
18
- super(
19
- {
20
- name: "linted/scope:html",
21
- files,
22
- plugins,
23
- linterOptions: {
24
- noInlineConfig: true,
25
- reportUnusedDisableDirectives: "error",
26
- },
27
- languageOptions: { parser },
28
- },
29
- );
10
+ public readonly name = "scope:html";
11
+ public readonly processor = {} as const;
12
+
13
+ public get languageOptions() {
14
+ const [parser] = this.parser;
15
+
16
+ return { parser } as const;
30
17
  }
31
18
  }
@@ -1,24 +1,13 @@
1
- import Option from "../index.js";
1
+ import Option from "../Option.js";
2
2
 
3
3
  export default class JsOption extends Option<"js", "@stylistic"> {
4
- constructor(
5
- plugins: JsOption["body"]["plugins"],
6
- files: readonly string[],
7
- ) {
8
- super(
9
- {
10
- name: "linted/scope:js",
11
- files,
12
- plugins,
13
- linterOptions: {
14
- noInlineConfig: true,
15
- reportUnusedDisableDirectives: "error",
16
- },
17
- languageOptions: {
18
- ecmaVersion: "latest",
19
- sourceType: "module",
20
- },
21
- },
22
- );
4
+ public readonly name = "scope:js";
5
+ public readonly processor = {};
6
+
7
+ public get languageOptions() {
8
+ return {
9
+ ecmaVersion: "latest",
10
+ sourceType: "module",
11
+ } as const;
23
12
  }
24
13
  }
@@ -1,31 +1,18 @@
1
- import Option from "../index.js";
1
+ import Option from "../Option.js";
2
2
 
3
3
  export default class JsonOption extends Option<
4
4
  "json",
5
5
  "jsonc",
6
+ false,
6
7
  true,
7
- never,
8
- never,
9
- never,
10
- never,
11
- never
8
+ 1
12
9
  > {
13
- constructor(
14
- plugins: JsonOption["body"]["plugins"],
15
- parser: JsonOption["body"]["languageOptions"]["parser"],
16
- files: readonly string[],
17
- ) {
18
- super(
19
- {
20
- name: "linted/scope:json",
21
- files,
22
- plugins,
23
- linterOptions: {
24
- noInlineConfig: true,
25
- reportUnusedDisableDirectives: "error",
26
- },
27
- languageOptions: { parser },
28
- },
29
- );
10
+ public readonly name = "scope:json";
11
+ public readonly processor = {} as const;
12
+
13
+ public get languageOptions() {
14
+ const [parser] = this.parser;
15
+
16
+ return { parser } as const;
30
17
  }
31
18
  }
@@ -1,31 +1,18 @@
1
- import Option from "../index.js";
1
+ import Option from "../Option.js";
2
2
 
3
3
  export default class JsoncOption extends Option<
4
4
  "jsonc",
5
5
  "jsonc",
6
+ false,
6
7
  true,
7
- never,
8
- never,
9
- never,
10
- never,
11
- never
8
+ 1
12
9
  > {
13
- constructor(
14
- plugins: JsoncOption["body"]["plugins"],
15
- parser: JsoncOption["body"]["languageOptions"]["parser"],
16
- files: readonly string[],
17
- ) {
18
- super(
19
- {
20
- name: "linted/scope:jsonc",
21
- files,
22
- plugins,
23
- linterOptions: {
24
- noInlineConfig: true,
25
- reportUnusedDisableDirectives: "error",
26
- },
27
- languageOptions: { parser },
28
- },
29
- );
10
+ public readonly name = "scope:jsonc";
11
+ public readonly processor = {} as const;
12
+
13
+ public get languageOptions() {
14
+ const [parser] = this.parser;
15
+
16
+ return { parser } as const;
30
17
  }
31
18
  }
@@ -1,45 +1,34 @@
1
- import Option from "../index.js";
1
+ import Option from "../Option.js";
2
2
  import type TsOption from "../ts/index.js";
3
3
 
4
4
  export default class SvelteOption extends Option<
5
5
  "svelte",
6
- "svelte" | keyof TsOption["body"]["plugins"],
6
+ "svelte" | keyof TsOption["option"]["plugins"],
7
7
  true,
8
- & TsOption["body"]["languageOptions"]["parserOptions"]
8
+ & TsOption["option"]["languageOptions"]["parserOptions"]
9
9
  & { parser: unknown }
10
- & { extraFileExtensions: [".svelte"] },
10
+ & { extraFileExtensions: readonly [".svelte"] },
11
+ 2,
11
12
  never,
12
- "svelte/svelte"
13
+ { processor: "svelte/svelte" }
13
14
  > {
14
- constructor(
15
- plugins: SvelteOption["body"]["plugins"],
16
- svelteParser: SvelteOption["body"]["languageOptions"]["parser"],
17
- tsParser: SvelteOption["body"]["languageOptions"]["parserOptions"]["parser"],
18
- files: readonly string[],
19
- ) {
20
- super(
21
- {
22
- name: "linted/scope:svelte",
23
- processor: "svelte/svelte",
24
- files,
25
- plugins,
26
- linterOptions: {
27
- noInlineConfig: true,
28
- reportUnusedDisableDirectives: "error",
29
- },
30
- languageOptions: {
31
- ecmaVersion: "latest",
32
- sourceType: "module",
33
- parser: svelteParser,
34
- parserOptions: {
35
- ecmaVersion: "latest",
36
- sourceType: "module",
37
- project: "tsconfig.json",
38
- extraFileExtensions: [".svelte"],
39
- parser: tsParser,
40
- },
41
- },
15
+ public readonly name = "scope:svelte";
16
+ public readonly processor = { processor: "svelte/svelte" } as const;
17
+
18
+ public get languageOptions() {
19
+ const [parser, tsParser] = this.parser;
20
+
21
+ return {
22
+ ecmaVersion: "latest",
23
+ sourceType: "module",
24
+ parser,
25
+ parserOptions: {
26
+ ecmaVersion: "latest",
27
+ sourceType: "module",
28
+ project: "tsconfig.json",
29
+ extraFileExtensions: [".svelte"] as const,
30
+ parser: tsParser,
42
31
  },
43
- );
32
+ } as const;
44
33
  }
45
34
  }
@@ -1,38 +1,29 @@
1
- import Option from "../index.js";
1
+ import Option from "../Option.js";
2
2
  import type JsOption from "../js/index.js";
3
3
 
4
4
  export default class TsOption extends Option<
5
5
  "ts",
6
- "@typescript-eslint" | keyof JsOption["body"]["plugins"],
6
+ "@typescript-eslint" | keyof JsOption["option"]["plugins"],
7
7
  true,
8
- & JsOption["body"]["languageOptions"]
9
- & { project: "tsconfig.json" }
8
+ & JsOption["option"]["languageOptions"]
9
+ & { project: "tsconfig.json" },
10
+ 1
10
11
  > {
11
- constructor(
12
- plugins: TsOption["body"]["plugins"],
13
- parser: unknown,
14
- files: readonly string[],
15
- ) {
16
- super(
17
- {
18
- name: "linted/scope:ts",
19
- files,
20
- plugins,
21
- linterOptions: {
22
- noInlineConfig: true,
23
- reportUnusedDisableDirectives: "error",
24
- },
25
- languageOptions: {
26
- ecmaVersion: "latest",
27
- sourceType: "module",
28
- parser,
29
- parserOptions: {
30
- ecmaVersion: "latest",
31
- sourceType: "module",
32
- project: "tsconfig.json",
33
- },
34
- },
12
+ public readonly name = "scope:ts";
13
+ public readonly processor = {} as const;
14
+
15
+ public get languageOptions() {
16
+ const [parser] = this.parser;
17
+
18
+ return {
19
+ ecmaVersion: "latest",
20
+ sourceType: "module",
21
+ parser,
22
+ parserOptions: {
23
+ ecmaVersion: "latest",
24
+ sourceType: "module",
25
+ project: "tsconfig.json",
35
26
  },
36
- );
27
+ } as const;
37
28
  }
38
29
  }
@@ -1,31 +1,18 @@
1
- import Option from "../index.js";
1
+ import Option from "../Option.js";
2
2
 
3
3
  export default class YmlOption extends Option<
4
4
  "yml",
5
5
  "yml",
6
+ false,
6
7
  true,
7
- never,
8
- never,
9
- never,
10
- never,
11
- never
8
+ 1
12
9
  > {
13
- constructor(
14
- plugins: YmlOption["body"]["plugins"],
15
- parser: YmlOption["body"]["languageOptions"]["parser"],
16
- files: readonly string[],
17
- ) {
18
- super(
19
- {
20
- name: "linted/scope:yml",
21
- files,
22
- plugins,
23
- linterOptions: {
24
- noInlineConfig: true,
25
- reportUnusedDisableDirectives: "error",
26
- },
27
- languageOptions: { parser },
28
- },
29
- );
10
+ public readonly name = "scope:yml";
11
+ public readonly processor = {} as const;
12
+
13
+ public get languageOptions() {
14
+ const [parser] = this.parser;
15
+
16
+ return { parser } as const;
30
17
  }
31
18
  }
@@ -1,4 +1,4 @@
1
- import Rule from "./rule/index.js";
1
+ import Rule from "./rule/Rule.js";
2
2
 
3
3
  export { Rule };
4
4
  export default class Ruleset<Language extends string> {
package/src/index.ts CHANGED
@@ -1,19 +1,19 @@
1
- import scopes from "./module/index.js";
2
- import {
3
- options,
4
- Files,
5
- Ruleset,
6
- Rule,
7
- } from "./factory/index.js";
1
+ import scopes from "./boundary/boundary.js";
8
2
  import type {
9
3
  Scope,
10
4
  Plugins,
11
5
  Parsers,
12
- } from "./module/index.js";
13
- import type Config from "./config/index.js";
6
+ Config,
7
+ } from "./boundary/boundary.js";
8
+ import {
9
+ Options,
10
+ Files,
11
+ Ruleset,
12
+ Rule,
13
+ } from "./factory/Factory.js";
14
14
 
15
- export { Ruleset, Rule };
16
15
  export type { Scope };
16
+ export { Ruleset, Rule };
17
17
  export default function (
18
18
  plugins: Plugins,
19
19
  parsers: Parsers,
@@ -23,97 +23,87 @@ export default function (
23
23
  overrides: Particord<Scope, IRule>,
24
24
  ): Config[] {
25
25
  try {
26
+ const files = new Files(
27
+ base,
28
+ includes,
29
+ ),
30
+ imports: {
31
+ [S in Scope]: OmitFirst<ConstructorParameters<typeof Options[S]>>;
32
+ } = {
33
+ js: [plugins.js, []] as const,
34
+ ts: [plugins.ts, [parsers.ts]] as const,
35
+ svelte: [
36
+ plugins.svelte,
37
+ [parsers.svelte, parsers.ts],
38
+ ] as const,
39
+ html: [plugins.html, [parsers.html]] as const,
40
+ json: [plugins.json, [parsers.json]] as const,
41
+ jsonc: [plugins.jsonc, [parsers.jsonc]] as const,
42
+ yml: [plugins.yml, [parsers.yml]] as const,
43
+ } as const;
44
+
26
45
  for (const scope of scopes)
27
46
  rulesets[scope].override(overrides[scope]);
28
47
 
29
- const instantiatedOptions: {
48
+ const options: {
30
49
  [S in Scope]: InstanceType<
31
- typeof options[S]
32
- >["body"]
50
+ typeof Options[S]
51
+ >["option"]
33
52
  } = {
34
- js: new options
53
+ js: new Options
35
54
  .js(
36
- plugins.js,
37
- new Files(
38
- "js",
39
- { base, includes },
40
- ).files,
41
-
55
+ files.files("js"),
56
+ ...imports.js,
42
57
  )
43
- .body,
44
- ts: new options
58
+ .option,
59
+ ts: new Options
45
60
  .ts(
46
- plugins.ts,
47
- parsers.ts,
48
- new Files(
49
- "ts",
50
- { base, includes },
51
- ).files,
61
+ files.files("ts"),
62
+ ...imports.ts,
52
63
  )
53
- .body,
54
- svelte: new options
64
+ .option,
65
+ svelte: new Options
55
66
  .svelte(
56
- plugins.svelte,
57
- parsers.svelte,
58
- parsers.ts,
59
- new Files(
60
- "svelte",
61
- { base, includes },
62
- ).files,
67
+ files.files("svelte"),
68
+ ...imports.svelte,
63
69
  )
64
- .body,
65
- html: new options
70
+ .option,
71
+ html: new Options
66
72
  .html(
67
- plugins.html,
68
- parsers.html,
69
- new Files(
70
- "html",
71
- { base, includes },
72
- ).files,
73
+ files.files("html"),
74
+ ...imports.html,
73
75
  )
74
- .body,
75
- json: new options
76
+ .option,
77
+ json: new Options
76
78
  .json(
77
- plugins.json,
78
- parsers.json,
79
- new Files(
80
- "json",
81
- { base, includes },
82
- ).files,
79
+ files.files("json"),
80
+ ...imports.json,
83
81
  )
84
- .body,
85
- jsonc: new options
82
+ .option,
83
+ jsonc: new Options
86
84
  .jsonc(
87
- plugins.jsonc,
88
- parsers.jsonc,
89
- new Files(
90
- "jsonc",
91
- { base, includes },
92
- ).files,
85
+ files.files("jsonc"),
86
+ ...imports.jsonc,
93
87
  )
94
- .body,
95
- yml: new options
88
+ .option,
89
+ yml: new Options
96
90
  .yml(
97
- plugins.yml,
98
- parsers.yml,
99
- new Files(
100
- "yml",
101
- { base, includes },
102
- ).files,
91
+ files.files("yml"),
92
+ ...imports.yml,
103
93
  )
104
- .body,
94
+ .option,
105
95
  };
106
96
 
107
97
  return scopes
108
98
  .map(
109
- scope => instantiatedOptions[scope].files.length > 0
99
+ scope => options[scope].files.length > 0
110
100
  ? rulesets[scope]
111
101
  .flat
112
102
  .map(
113
103
  rules => {
114
104
  return {
115
105
  rules,
116
- ...instantiatedOptions[scope],
106
+ ...options[scope],
117
107
  };
118
108
  },
119
109
  )
@@ -0,0 +1 @@
1
+ declare type OmitFirst<A> = A extends readonly [unknown, ...infer An_1] ? An_1 : never;
@@ -1 +0,0 @@
1
- declare interface IFiles { files: readonly string[] }
@@ -1,25 +0,0 @@
1
- declare type IOption<
2
- Name extends string,
3
- NoInline extends boolean,
4
- ReportUnused extends boolean | IOLinter.States,
5
- PluginId extends string,
6
- Ecma extends number | IOLanguageEcma.Ecma,
7
- Source extends IOLanguageSource.Source,
8
- UseParser extends boolean,
9
- ParserOptions extends object,
10
- GlobalTypes extends string,
11
- ProcessorId extends string,
12
- > =
13
- & IFiles
14
- & IOName<Name>
15
- & IOLinter<NoInline, ReportUnused>
16
- & IOPlugins<PluginId>
17
- & IOLanguage<
18
- Ecma,
19
- Source,
20
- UseParser,
21
- ParserOptions,
22
- GlobalTypes
23
- >
24
- & IOProcessor<ProcessorId>
25
- ;
@@ -1,15 +0,0 @@
1
- declare type IOLanguage<
2
- Ecma extends number | IOLanguageEcma.Ecma,
3
- Source extends IOLanguageSource.Source,
4
- UseParser extends boolean,
5
- ParserOptions extends object,
6
- GlobalTypes extends string,
7
- > = {
8
- languageOptions:
9
- & IOLanguageEcma<Ecma>
10
- & IOLanguageSource<Source>
11
- & IOLanguageGlobals<GlobalTypes>
12
- & IOLanguageParser<UseParser>
13
- & IOLanguageParserOptions<ParserOptions>
14
- ;
15
- };