@eslinted/core 4.0.4 → 4.0.5-rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. package/package.json +8 -4
  2. package/src/factory/{files/index.ts → files.ts} +4 -4
  3. package/src/factory/index.ts +3 -6
  4. package/src/factory/options/{option/html/index.ts → html.ts} +1 -1
  5. package/src/factory/options/index.ts +9 -9
  6. package/src/factory/options/{option/js/index.ts → js.ts} +1 -1
  7. package/src/factory/options/{option/json/index.ts → json.ts} +1 -1
  8. package/src/factory/options/{option/jsonc/index.ts → jsonc.ts} +1 -1
  9. package/src/factory/options/{option/md/index.ts → md.ts} +1 -1
  10. package/src/factory/options/{option/mocha/index.ts → mocha.ts} +2 -2
  11. package/src/factory/options/option/index.ts +19 -13
  12. package/src/factory/options/option/params/globals.ts +3 -0
  13. package/src/{boundary/output/config/option/language/index.ts → factory/options/option/params/language.ts} +3 -5
  14. package/src/factory/options/option/params/languageOptions/ecma.ts +1 -0
  15. package/src/factory/options/option/params/languageOptions/source.ts +1 -0
  16. package/src/{boundary/output/config/option/linter/index.ts → factory/options/option/params/linter.ts} +1 -1
  17. package/src/factory/options/option/params/plugins.ts +1 -0
  18. package/src/factory/options/option/template.ts +24 -0
  19. package/src/factory/options/{option/svelte/index.ts → svelte.ts} +2 -2
  20. package/src/factory/options/{option/ts/index.ts → ts.ts} +2 -2
  21. package/src/factory/options/{option/yml/index.ts → yml.ts} +1 -1
  22. package/src/factory/{rulesets/ruleset → ruleset}/index.ts +5 -4
  23. package/src/factory/ruleset/rule.ts +8 -0
  24. package/src/factory/{rulesets/index.ts → rulesets.ts} +5 -5
  25. package/src/index.ts +23 -19
  26. package/src/input.ts +11 -0
  27. package/src/inputs/files/base.ts +3 -0
  28. package/src/inputs/files/includes.ts +3 -0
  29. package/src/inputs/files.ts +7 -0
  30. package/src/inputs/imports/parsers.ts +11 -0
  31. package/src/{dependency/plugins/index.ts → inputs/imports/plugins.ts} +2 -5
  32. package/src/inputs/imports.ts +2 -0
  33. package/src/inputs/parsers.ts +3 -0
  34. package/src/inputs/plugins.ts +3 -0
  35. package/src/inputs/rules/entry/index.ts +3 -0
  36. package/src/inputs/rules/entry/object/index.ts +7 -0
  37. package/src/inputs/rules/entry/object/state/index.ts +4 -0
  38. package/src/inputs/rules/overrides.ts +4 -0
  39. package/src/inputs/rules/preset.ts +4 -0
  40. package/src/inputs/rules.ts +7 -0
  41. package/src/{boundary/output/config/index.ts → output.ts} +3 -4
  42. package/src/{scopes/index.ts → scopes.ts} +1 -3
  43. package/dist/boundary/index.d.ts +0 -9
  44. package/dist/boundary/index.d.ts.map +0 -1
  45. package/dist/boundary/index.js +0 -2
  46. package/dist/boundary/index.js.map +0 -1
  47. package/dist/boundary/input/files/default/index.d.ts +0 -4
  48. package/dist/boundary/input/files/default/index.d.ts.map +0 -1
  49. package/dist/boundary/input/files/default/index.js +0 -2
  50. package/dist/boundary/input/files/default/index.js.map +0 -1
  51. package/dist/boundary/input/files/includes/index.d.ts +0 -4
  52. package/dist/boundary/input/files/includes/index.d.ts.map +0 -1
  53. package/dist/boundary/input/files/includes/index.js +0 -2
  54. package/dist/boundary/input/files/includes/index.js.map +0 -1
  55. package/dist/boundary/input/files/index.d.ts +0 -8
  56. package/dist/boundary/input/files/index.d.ts.map +0 -1
  57. package/dist/boundary/input/files/index.js +0 -2
  58. package/dist/boundary/input/files/index.js.map +0 -1
  59. package/dist/boundary/input/index.d.ts +0 -14
  60. package/dist/boundary/input/index.d.ts.map +0 -1
  61. package/dist/boundary/input/index.js +0 -2
  62. package/dist/boundary/input/index.js.map +0 -1
  63. package/dist/boundary/input/parsers/index.d.ts +0 -4
  64. package/dist/boundary/input/parsers/index.d.ts.map +0 -1
  65. package/dist/boundary/input/parsers/index.js +0 -2
  66. package/dist/boundary/input/parsers/index.js.map +0 -1
  67. package/dist/boundary/input/plugins/index.d.ts +0 -6
  68. package/dist/boundary/input/plugins/index.d.ts.map +0 -1
  69. package/dist/boundary/input/plugins/index.js +0 -2
  70. package/dist/boundary/input/plugins/index.js.map +0 -1
  71. package/dist/boundary/input/rules/index.d.ts +0 -8
  72. package/dist/boundary/input/rules/index.d.ts.map +0 -1
  73. package/dist/boundary/input/rules/index.js +0 -2
  74. package/dist/boundary/input/rules/index.js.map +0 -1
  75. package/dist/boundary/input/rules/overrides/index.d.ts +0 -5
  76. package/dist/boundary/input/rules/overrides/index.d.ts.map +0 -1
  77. package/dist/boundary/input/rules/overrides/index.js +0 -2
  78. package/dist/boundary/input/rules/overrides/index.js.map +0 -1
  79. package/dist/boundary/input/rules/preset/entry/index.d.ts +0 -4
  80. package/dist/boundary/input/rules/preset/entry/index.d.ts.map +0 -1
  81. package/dist/boundary/input/rules/preset/entry/index.js +0 -2
  82. package/dist/boundary/input/rules/preset/entry/index.js.map +0 -1
  83. package/dist/boundary/input/rules/preset/entry/object/index.d.ts +0 -4
  84. package/dist/boundary/input/rules/preset/entry/object/index.d.ts.map +0 -1
  85. package/dist/boundary/input/rules/preset/entry/object/index.js +0 -2
  86. package/dist/boundary/input/rules/preset/entry/object/index.js.map +0 -1
  87. package/dist/boundary/input/rules/preset/entry/object/state/index.d.ts +0 -3
  88. package/dist/boundary/input/rules/preset/entry/object/state/index.d.ts.map +0 -1
  89. package/dist/boundary/input/rules/preset/entry/object/state/index.js +0 -2
  90. package/dist/boundary/input/rules/preset/entry/object/state/index.js.map +0 -1
  91. package/dist/boundary/input/rules/preset/index.d.ts +0 -5
  92. package/dist/boundary/input/rules/preset/index.d.ts.map +0 -1
  93. package/dist/boundary/input/rules/preset/index.js +0 -2
  94. package/dist/boundary/input/rules/preset/index.js.map +0 -1
  95. package/dist/boundary/output/config/index.d.ts +0 -22
  96. package/dist/boundary/output/config/index.d.ts.map +0 -1
  97. package/dist/boundary/output/config/index.js +0 -2
  98. package/dist/boundary/output/config/index.js.map +0 -1
  99. package/dist/boundary/output/config/option/index.d.ts +0 -14
  100. package/dist/boundary/output/config/option/index.d.ts.map +0 -1
  101. package/dist/boundary/output/config/option/index.js +0 -2
  102. package/dist/boundary/output/config/option/index.js.map +0 -1
  103. package/dist/boundary/output/config/option/language/ecma/index.d.ts +0 -3
  104. package/dist/boundary/output/config/option/language/ecma/index.d.ts.map +0 -1
  105. package/dist/boundary/output/config/option/language/ecma/index.js +0 -2
  106. package/dist/boundary/output/config/option/language/ecma/index.js.map +0 -1
  107. package/dist/boundary/output/config/option/language/index.d.ts +0 -15
  108. package/dist/boundary/output/config/option/language/index.d.ts.map +0 -1
  109. package/dist/boundary/output/config/option/language/index.js +0 -2
  110. package/dist/boundary/output/config/option/language/index.js.map +0 -1
  111. package/dist/boundary/output/config/option/language/source/index.d.ts +0 -3
  112. package/dist/boundary/output/config/option/language/source/index.d.ts.map +0 -1
  113. package/dist/boundary/output/config/option/language/source/index.js +0 -2
  114. package/dist/boundary/output/config/option/language/source/index.js.map +0 -1
  115. package/dist/boundary/output/config/option/linter/index.d.ts +0 -5
  116. package/dist/boundary/output/config/option/linter/index.d.ts.map +0 -1
  117. package/dist/boundary/output/config/option/linter/index.js +0 -2
  118. package/dist/boundary/output/config/option/linter/index.js.map +0 -1
  119. package/dist/boundary/output/config/option/plugins/index.d.ts +0 -5
  120. package/dist/boundary/output/config/option/plugins/index.d.ts.map +0 -1
  121. package/dist/boundary/output/config/option/plugins/index.js +0 -2
  122. package/dist/boundary/output/config/option/plugins/index.js.map +0 -1
  123. package/dist/boundary/output/index.d.ts +0 -3
  124. package/dist/boundary/output/index.d.ts.map +0 -1
  125. package/dist/boundary/output/index.js +0 -2
  126. package/dist/boundary/output/index.js.map +0 -1
  127. package/dist/dependency/globals/index.d.ts +0 -4
  128. package/dist/dependency/globals/index.d.ts.map +0 -1
  129. package/dist/dependency/globals/index.js +0 -2
  130. package/dist/dependency/globals/index.js.map +0 -1
  131. package/dist/dependency/index.d.ts +0 -5
  132. package/dist/dependency/index.d.ts.map +0 -1
  133. package/dist/dependency/index.js +0 -2
  134. package/dist/dependency/index.js.map +0 -1
  135. package/dist/dependency/parsers/index.d.ts +0 -4
  136. package/dist/dependency/parsers/index.d.ts.map +0 -1
  137. package/dist/dependency/parsers/index.js +0 -2
  138. package/dist/dependency/parsers/index.js.map +0 -1
  139. package/dist/dependency/plugins/index.d.ts +0 -3
  140. package/dist/dependency/plugins/index.d.ts.map +0 -1
  141. package/dist/dependency/plugins/index.js +0 -2
  142. package/dist/dependency/plugins/index.js.map +0 -1
  143. package/dist/factory/files/index.d.ts +0 -8
  144. package/dist/factory/files/index.d.ts.map +0 -1
  145. package/dist/factory/files/index.js +0 -16
  146. package/dist/factory/files/index.js.map +0 -1
  147. package/dist/factory/index.d.ts +0 -7
  148. package/dist/factory/index.d.ts.map +0 -1
  149. package/dist/factory/index.js +0 -7
  150. package/dist/factory/index.js.map +0 -1
  151. package/dist/factory/options/index.d.ts +0 -22
  152. package/dist/factory/options/index.d.ts.map +0 -1
  153. package/dist/factory/options/index.js +0 -21
  154. package/dist/factory/options/index.js.map +0 -1
  155. package/dist/factory/options/option/html/index.d.ts +0 -9
  156. package/dist/factory/options/option/html/index.d.ts.map +0 -1
  157. package/dist/factory/options/option/html/index.js +0 -10
  158. package/dist/factory/options/option/html/index.js.map +0 -1
  159. package/dist/factory/options/option/index.d.ts +0 -2989
  160. package/dist/factory/options/option/index.d.ts.map +0 -1
  161. package/dist/factory/options/option/index.js +0 -56
  162. package/dist/factory/options/option/index.js.map +0 -1
  163. package/dist/factory/options/option/js/index.d.ts +0 -10
  164. package/dist/factory/options/option/js/index.d.ts.map +0 -1
  165. package/dist/factory/options/option/js/index.js +0 -12
  166. package/dist/factory/options/option/js/index.js.map +0 -1
  167. package/dist/factory/options/option/json/index.d.ts +0 -9
  168. package/dist/factory/options/option/json/index.d.ts.map +0 -1
  169. package/dist/factory/options/option/json/index.js +0 -10
  170. package/dist/factory/options/option/json/index.js.map +0 -1
  171. package/dist/factory/options/option/jsonc/index.d.ts +0 -9
  172. package/dist/factory/options/option/jsonc/index.d.ts.map +0 -1
  173. package/dist/factory/options/option/jsonc/index.js +0 -10
  174. package/dist/factory/options/option/jsonc/index.js.map +0 -1
  175. package/dist/factory/options/option/md/index.d.ts +0 -9
  176. package/dist/factory/options/option/md/index.d.ts.map +0 -1
  177. package/dist/factory/options/option/md/index.js +0 -10
  178. package/dist/factory/options/option/md/index.js.map +0 -1
  179. package/dist/factory/options/option/mocha/index.d.ts +0 -40
  180. package/dist/factory/options/option/mocha/index.d.ts.map +0 -1
  181. package/dist/factory/options/option/mocha/index.js +0 -17
  182. package/dist/factory/options/option/mocha/index.js.map +0 -1
  183. package/dist/factory/options/option/svelte/index.d.ts +0 -27
  184. package/dist/factory/options/option/svelte/index.d.ts.map +0 -1
  185. package/dist/factory/options/option/svelte/index.js +0 -21
  186. package/dist/factory/options/option/svelte/index.js.map +0 -1
  187. package/dist/factory/options/option/ts/index.d.ts +0 -19
  188. package/dist/factory/options/option/ts/index.d.ts.map +0 -1
  189. package/dist/factory/options/option/ts/index.js +0 -15
  190. package/dist/factory/options/option/ts/index.js.map +0 -1
  191. package/dist/factory/options/option/yml/index.d.ts +0 -9
  192. package/dist/factory/options/option/yml/index.d.ts.map +0 -1
  193. package/dist/factory/options/option/yml/index.js +0 -10
  194. package/dist/factory/options/option/yml/index.js.map +0 -1
  195. package/dist/factory/rulesets/index.d.ts +0 -9
  196. package/dist/factory/rulesets/index.d.ts.map +0 -1
  197. package/dist/factory/rulesets/index.js +0 -17
  198. package/dist/factory/rulesets/index.js.map +0 -1
  199. package/dist/factory/rulesets/ruleset/index.d.ts +0 -13
  200. package/dist/factory/rulesets/ruleset/index.d.ts.map +0 -1
  201. package/dist/factory/rulesets/ruleset/index.js +0 -38
  202. package/dist/factory/rulesets/ruleset/index.js.map +0 -1
  203. package/dist/factory/rulesets/ruleset/rule/index.d.ts +0 -7
  204. package/dist/factory/rulesets/ruleset/rule/index.d.ts.map +0 -1
  205. package/dist/factory/rulesets/ruleset/rule/index.js +0 -9
  206. package/dist/factory/rulesets/ruleset/rule/index.js.map +0 -1
  207. package/dist/index.d.ts +0 -23
  208. package/dist/index.d.ts.map +0 -1
  209. package/dist/index.js +0 -31
  210. package/dist/index.js.map +0 -1
  211. package/dist/scopes/index.d.ts +0 -4
  212. package/dist/scopes/index.d.ts.map +0 -1
  213. package/dist/scopes/index.js +0 -13
  214. package/dist/scopes/index.js.map +0 -1
  215. package/src/boundary/index.ts +0 -15
  216. package/src/boundary/input/files/default/index.ts +0 -8
  217. package/src/boundary/input/files/includes/index.ts +0 -5
  218. package/src/boundary/input/files/index.ts +0 -11
  219. package/src/boundary/input/index.ts +0 -23
  220. package/src/boundary/input/parsers/index.ts +0 -5
  221. package/src/boundary/input/plugins/index.ts +0 -5
  222. package/src/boundary/input/rules/index.ts +0 -14
  223. package/src/boundary/input/rules/overrides/index.ts +0 -6
  224. package/src/boundary/input/rules/preset/entry/index.ts +0 -9
  225. package/src/boundary/input/rules/preset/entry/object/index.ts +0 -13
  226. package/src/boundary/input/rules/preset/entry/object/state/index.ts +0 -10
  227. package/src/boundary/input/rules/preset/index.ts +0 -10
  228. package/src/boundary/output/config/option/index.ts +0 -24
  229. package/src/boundary/output/config/option/language/ecma/index.ts +0 -3
  230. package/src/boundary/output/config/option/language/source/index.ts +0 -3
  231. package/src/boundary/output/config/option/plugins/index.ts +0 -3
  232. package/src/boundary/output/index.ts +0 -3
  233. package/src/dependency/globals/index.ts +0 -8
  234. package/src/dependency/index.ts +0 -5
  235. package/src/dependency/parsers/index.ts +0 -13
  236. package/src/factory/rulesets/ruleset/rule/index.ts +0 -8
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "_schemaVersion": "20.18.0",
2
+ "_schemaVersion": "20.18.0-core.0",
3
3
  "name": "@eslinted/core",
4
- "version": "4.0.4",
4
+ "version": "4.0.5-rc.1",
5
5
  "description": "Core ESLint flat config factory npm package `linted`.",
6
6
  "keywords": [],
7
7
  "repository": "github:jimmy-zhening-luo/linted-core",
@@ -13,8 +13,12 @@
13
13
  "access": "public"
14
14
  },
15
15
  "type": "module",
16
- "main": "dist/index.js",
17
- "types": "dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
21
+ },
18
22
  "config": {
19
23
  "language": "ts",
20
24
  "fix": "true",
@@ -1,8 +1,8 @@
1
- import type { Scope } from "../../scopes/index.js";
2
- import type { Input } from "../../boundary/index.js";
1
+ import type { Scope } from "@eslinted/core";
2
+ import type { Input } from "@eslinted/core";
3
3
 
4
- export default class Files {
5
- constructor(private readonly input: Input.Files.Files) {}
4
+ export class Files {
5
+ constructor(private readonly input: Input["files"]) {}
6
6
 
7
7
  public files(scope: Scope): readonly string[] {
8
8
  try {
@@ -1,8 +1,5 @@
1
- import Rulesets from "./rulesets/index.js";
2
- import Files from "./files/index.js";
3
- import Options from "./options/index.js";
1
+ import { Rulesets } from "./rulesets";
2
+ import { Files } from "./files";
3
+ import Options from "./options";
4
4
 
5
- export class Factory {
6
-
7
- }
8
5
  export { Options, Files, Rulesets };
@@ -1,4 +1,4 @@
1
- import Option from "../index.js";
1
+ import Option from "./option";
2
2
 
3
3
  export default class Html extends Option<
4
4
  "html",
@@ -1,12 +1,12 @@
1
- import js from "./option/js/index.js";
2
- import ts from "./option/ts/index.js";
3
- import svelte from "./option/svelte/index.js";
4
- import mocha from "./option/mocha/index.js";
5
- import html from "./option/html/index.js";
6
- import json from "./option/json/index.js";
7
- import jsonc from "./option/jsonc/index.js";
8
- import yml from "./option/yml/index.js";
9
- import md from "./option/md/index.js";
1
+ import js from "./js";
2
+ import ts from "./ts";
3
+ import svelte from "./svelte";
4
+ import mocha from "./mocha";
5
+ import html from "./html";
6
+ import json from "./json";
7
+ import jsonc from "./jsonc";
8
+ import yml from "./yml";
9
+ import md from "./md";
10
10
 
11
11
  export default {
12
12
  js,
@@ -1,4 +1,4 @@
1
- import Option from "../index.js";
1
+ import Option from "./option";
2
2
 
3
3
  export default class Js extends Option<"js", "@stylistic"> {
4
4
  public readonly scope = "js";
@@ -1,4 +1,4 @@
1
- import Option from "../index.js";
1
+ import Option from "./option";
2
2
 
3
3
  export default class Json extends Option<
4
4
  "json",
@@ -1,4 +1,4 @@
1
- import Option from "../index.js";
1
+ import Option from "./option";
2
2
 
3
3
  export default class Jsonc extends Option<
4
4
  "jsonc",
@@ -1,4 +1,4 @@
1
- import Option from "../index.js";
1
+ import Option from "./option";
2
2
 
3
3
  export default class Md extends Option<
4
4
  "md",
@@ -1,5 +1,5 @@
1
- import Option from "../index.js";
2
- import type Ts from "../ts/index.js";
1
+ import Option from "./option";
2
+ import type Ts from "./ts";
3
3
 
4
4
  export default class Mocha extends Option<
5
5
  "mocha",
@@ -1,16 +1,22 @@
1
+ import type { Input } from "@eslinted/core";
2
+ import type { Scope } from "@eslinted/core";
3
+ import type { Output } from "@eslinted/core";
4
+ import type { Ruleset } from "../../ruleset";
5
+ import type {
6
+ OptionTemplate,
7
+ LanguageOptions,
8
+ Plugins,
9
+ Globals,
10
+ } from "./template";
1
11
  import globals from "globals";
2
- import type { Scope } from "../../../scopes/index.js";
3
- import type Ruleset from "../../rulesets/ruleset/index.js";
4
- import type { Plugins } from "../../../dependency/index.js";
5
- import type { Output } from "../../../boundary/index.js";
6
12
 
7
13
  export default abstract class Option<
8
14
  S extends Scope,
9
- PluginId extends Plugins,
15
+ Plugin extends keyof Input["plugins"],
10
16
  IsEcma extends boolean = true,
11
17
  ParserOptions extends object | boolean = false,
12
18
  ParserCount extends 0 | 1 | 2 = 0,
13
- GlobalTypes extends keyof typeof globals = never,
19
+ Global extends Globals = never,
14
20
  Processor extends object = never,
15
21
  > {
16
22
  private readonly linterOptions = { noInlineConfig: true, reportUnusedDisableDirectives: "error" } as const;
@@ -25,11 +31,11 @@ export default abstract class Option<
25
31
  constructor(
26
32
  public readonly files: readonly string[],
27
33
  public readonly ruleset: Ruleset<S>,
28
- public readonly plugins: Output.Config.Plugins<PluginId>,
34
+ public readonly plugins: Plugins<Plugin>,
29
35
  public readonly parser: Tuple<unknown, ParserCount>,
30
36
  ) {}
31
37
 
32
- public get configs(): Output[] {
38
+ public get configs(): Output {
33
39
  try {
34
40
  const {
35
41
  scope,
@@ -74,20 +80,20 @@ export default abstract class Option<
74
80
  linterOptions,
75
81
  languageOptions,
76
82
  ...processor,
77
- } satisfies Output.Config.IOption<
78
- PluginId,
83
+ } satisfies OptionTemplate<
84
+ Plugin,
79
85
  IsEcma,
80
86
  ParserOptions,
81
- GlobalTypes,
87
+ Global,
82
88
  Processor
83
89
  >;
84
90
  }
85
91
  catch (e) { throw new Error(`linted.factory.Option/scope:${this.scope}: option`, { cause: e }); }
86
92
  }
87
93
 
88
- protected abstract get languageOptions(): Output.Config.Language<IsEcma, ParserOptions, GlobalTypes>;
94
+ protected abstract get languageOptions(): LanguageOptions<IsEcma, ParserOptions, Global>;
89
95
 
90
- protected globals(type: GlobalTypes) {
96
+ protected globals(type: Global) {
91
97
  return globals[type];
92
98
  }
93
99
  }
@@ -0,0 +1,3 @@
1
+ import type globals from "globals";
2
+
3
+ export type Globals = keyof typeof globals & "mocha";
@@ -1,7 +1,7 @@
1
- import type Ecma from "./ecma/index.js";
2
- import type Source from "./source/index.js";
1
+ import type { Ecma } from "./languageOptions/ecma";
2
+ import type { Source } from "./languageOptions/source";
3
3
 
4
- type Language<
4
+ export type LanguageOptions<
5
5
  IsEcma extends boolean,
6
6
  ParserOptions extends object | boolean,
7
7
  GlobalTypes extends string,
@@ -19,5 +19,3 @@ type Language<
19
19
  : { parser: unknown; parserOptions: ParserOptions }
20
20
  : object
21
21
  );
22
-
23
- export type { Language, Language as default };
@@ -0,0 +1 @@
1
+ export type Ecma = "latest";
@@ -0,0 +1 @@
1
+ export type Source = "module" | "script";
@@ -1,4 +1,4 @@
1
- export default interface Linter {
1
+ export interface Linter {
2
2
  noInlineConfig: true;
3
3
  reportUnusedDisableDirectives: "error";
4
4
  }
@@ -0,0 +1 @@
1
+ export type Plugins<PluginId extends string> = Record<literalful<PluginId>, { configs: unknown }>;
@@ -0,0 +1,24 @@
1
+ import type { LanguageOptions } from "./params/language";
2
+ import type { Linter } from "./params/linter";
3
+ import type { Plugins } from "./params/plugins";
4
+ import type { Globals } from "./params/globals";
5
+
6
+ export type {
7
+ LanguageOptions,
8
+ Linter,
9
+ Plugins,
10
+ Globals,
11
+ };
12
+ export type OptionTemplate<
13
+ PluginId extends string,
14
+ IsEcma extends boolean,
15
+ ParserOptions extends boolean | object,
16
+ GlobalTypes extends Globals,
17
+ Processor extends object,
18
+ > =
19
+ & {
20
+ linterOptions: Linter;
21
+ languageOptions: LanguageOptions<IsEcma, ParserOptions, GlobalTypes>;
22
+ }
23
+ & (Plugins<PluginId> extends never ? object : { plugins: Plugins<PluginId> })
24
+ & (Interface<Processor> extends never ? object : Interface<Processor> extends { processor: string } ? Interface<Processor> : object);
@@ -1,5 +1,5 @@
1
- import Option from "../index.js";
2
- import type Ts from "../ts/index.js";
1
+ import Option from "./option";
2
+ import type Ts from "./ts";
3
3
 
4
4
  export default class Svelte extends Option<
5
5
  "svelte",
@@ -1,5 +1,5 @@
1
- import Option from "../index.js";
2
- import type Js from "../js/index.js";
1
+ import Option from "./option";
2
+ import type Js from "./js";
3
3
 
4
4
  export default class Ts extends Option<
5
5
  "ts",
@@ -1,4 +1,4 @@
1
- import Option from "../index.js";
1
+ import Option from "./option";
2
2
 
3
3
  export default class Yml extends Option<
4
4
  "yml",
@@ -1,8 +1,9 @@
1
- import type { Scope } from "../../../scopes/index.js";
2
- import Rule from "./rule/index.js";
1
+ import type { Input } from "@eslinted/core";
2
+ import type { Scope } from "@eslinted/core";
3
+ import { Rule } from "./rule";
3
4
 
4
5
  export { Rule };
5
- export default class Ruleset<S extends Scope> {
6
+ export class Ruleset<S extends Scope> {
6
7
  public readonly ruleset: readonly Rule[];
7
8
  public overrides: Null<Rule> = null;
8
9
 
@@ -31,7 +32,7 @@ export default class Ruleset<S extends Scope> {
31
32
  catch (e) { throw new Error(`linted.factory.Ruleset: records`, { cause: e }); }
32
33
  }
33
34
 
34
- public override(overrides: undefined | Rule["rules"]) {
35
+ public override(overrides: undefined | Input["rules"]["rules"][Scope][number][1]) {
35
36
  if (typeof overrides !== "undefined")
36
37
  this.overrides = new Rule("override", overrides);
37
38
 
@@ -0,0 +1,8 @@
1
+ import type { Input } from "@eslinted/core";
2
+
3
+ export class Rule {
4
+ constructor(
5
+ public readonly id: string,
6
+ public readonly rules: Input["rules"]["rules"]["html"][number][1],
7
+ ) {}
8
+ }
@@ -1,9 +1,9 @@
1
- import Ruleset, { Rule } from "./ruleset/index.js";
2
- import type { Input } from "../../boundary/index.js";
3
- import type { Scope } from "../../scopes/index.js";
1
+ import type { Input } from "@eslinted/core";
2
+ import type { Scope } from "@eslinted/core";
3
+ import { Ruleset, Rule } from "./ruleset";
4
4
 
5
- export default class {
6
- constructor(private readonly input: Input.Rules.Rules) {}
5
+ export class Rulesets {
6
+ constructor(private readonly input: Input["rules"]) {}
7
7
 
8
8
  public ruleset<S extends Scope>(scope: literalful<S>): Ruleset<S> {
9
9
  try {
package/src/index.ts CHANGED
@@ -1,18 +1,22 @@
1
+ import type { Input } from "./input";
2
+ import type { Scope } from "./scopes";
3
+ import type { Output } from "./output";
4
+
5
+ export type { Input, Scope, Output };
6
+
7
+ import { scopes } from "./scopes";
1
8
  import {
2
- Options,
3
9
  Files,
4
10
  Rulesets,
5
- } from "./factory/index.js";
6
- import scopes from "./scopes/index.js";
7
- import type { Scope } from "./scopes/index.js";
8
- import type * as core from "./boundary/index.js";
11
+ Options,
12
+ } from "./factory";
9
13
 
10
14
  export default function (
11
- plugins: core.Input.Plugins,
12
- parsers: core.Input.Parsers,
13
- files: core.Input.Files,
14
- rules: core.Input.Rules,
15
- ): core.Output[] {
15
+ plugins: Input["plugins"],
16
+ parsers: Input["parsers"],
17
+ files: Input["files"],
18
+ rules: Input["rules"],
19
+ ): Output {
16
20
  try {
17
21
  const F = new Files(files),
18
22
  R = new Rulesets(rules),
@@ -90,20 +94,20 @@ export default function (
90
94
  namespace Core {
91
95
  export type Scopes = Scope;
92
96
  export namespace Input {
93
- export type Parsers = core.Input.Parsers;
94
- export type Plugins = core.Input.Plugins;
95
- export type Files = core.Input.Files;
97
+ export type Parsers = Input["parsers"];
98
+ export type Plugins = Input["plugins"];
99
+ export type Files = Input["files"];
96
100
  export namespace Files {
97
- export type Base = core.Input.Files.FileBase;
98
- export type Includes = core.Input.Files.Includes;
101
+ export type Base = Files["files"];
102
+ export type Includes = Files["includes"];
99
103
  }
100
- export type Rules = core.Input.Rules;
104
+ export type Rules = Input["rules"];
101
105
  export namespace Rules {
102
- export type Base = core.Input.Rules.RuleBase;
103
- export type Overrides = core.Input.Rules.Overrides;
106
+ export type Base = Rules["rules"];
107
+ export type Overrides = Rules["overrides"];
104
108
  }
105
109
  }
106
- export type Output = core.Output[];
110
+ export type Output = Output[];
107
111
  }
108
112
 
109
113
  export type { Core };
package/src/input.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { Plugins } from "./inputs/plugins";
2
+ import type { Parsers } from "./inputs/parsers";
3
+ import type { Files } from "./inputs/files";
4
+ import type { Rules } from "./inputs/rules";
5
+
6
+ export interface Input {
7
+ files: Files;
8
+ rules: Rules;
9
+ plugins: Plugins;
10
+ parsers: Parsers;
11
+ }
@@ -0,0 +1,3 @@
1
+ import type { Scope } from "@eslinted/core";
2
+
3
+ export type Base = Readonly<Record<Scope, readonly string[]>>;
@@ -0,0 +1,3 @@
1
+ import type { Base } from "./base";
2
+
3
+ export type Includes = Partial<Base>;
@@ -0,0 +1,7 @@
1
+ import type { Base } from "./files/base";
2
+ import type { Includes } from "./files/includes";
3
+
4
+ export interface Files {
5
+ files: Base;
6
+ includes: Includes;
7
+ }
@@ -0,0 +1,11 @@
1
+ import type { Scope } from "@eslinted/core";
2
+
3
+ export type Parsers = Scope
4
+ & (
5
+ | "ts"
6
+ | "svelte"
7
+ | "html"
8
+ | "jsonc"
9
+ | "yml"
10
+ | "md"
11
+ );
@@ -1,4 +1,4 @@
1
- type Plugins =
1
+ export type Plugins =
2
2
  | "@stylistic"
3
3
  | "@typescript-eslint"
4
4
  | "svelte"
@@ -6,7 +6,4 @@ type Plugins =
6
6
  | "@html-eslint"
7
7
  | "jsonc"
8
8
  | "yml"
9
- | "markdownlint"
10
- ;
11
-
12
- export type { Plugins as default };
9
+ | "markdownlint";
@@ -0,0 +1,2 @@
1
+ export type { Plugins } from "./imports/plugins";
2
+ export type { Parsers } from "./imports/parsers";
@@ -0,0 +1,3 @@
1
+ import type { Parsers as Imports } from "./imports/parsers";
2
+
3
+ export type Parsers = Readonly<Record<Imports, unknown>>;
@@ -0,0 +1,3 @@
1
+ import type { Plugins as Imports } from "./imports/plugins";
2
+
3
+ export type Plugins = Readonly<Record<Imports, { configs: unknown }>>;
@@ -0,0 +1,3 @@
1
+ import type { RuleRecord } from "./object";
2
+
3
+ export type RuleEntry = readonly [string, RuleRecord];
@@ -0,0 +1,7 @@
1
+ import type { State } from "./state";
2
+
3
+ export type RuleRecord = Readonly<Record<
4
+ string,
5
+ | State
6
+ | readonly [State, ...unknown[]]
7
+ >>;
@@ -0,0 +1,4 @@
1
+ export type State =
2
+ | "error"
3
+ | "warn"
4
+ | "off";
@@ -0,0 +1,4 @@
1
+ import type { Scope } from "@eslinted/core";
2
+ import type { Preset } from "./preset";
3
+
4
+ export type Overrides = Readonly<Partial<Record<Scope, Preset[Scope][number][1]>>>;
@@ -0,0 +1,4 @@
1
+ import type { Scope } from "@eslinted/core";
2
+ import type { RuleEntry } from "./entry";
3
+
4
+ export type Preset = Readonly<Record<Scope, readonly RuleEntry[]>>;
@@ -0,0 +1,7 @@
1
+ import type { Preset } from "./rules/preset";
2
+ import type { Overrides } from "./rules/overrides";
3
+
4
+ export interface Rules {
5
+ rules: Preset;
6
+ overrides: Overrides;
7
+ }
@@ -1,9 +1,8 @@
1
- import type { Rules } from "../../input/index.js";
2
- import type * as Config from "./option/index.js";
1
+ import type { Input } from "./input";
3
2
 
4
3
  interface Config {
5
4
  name: `linted/scope:${string}/rule:${string}+${string}`;
6
- rules: Rules.RuleBase.RuleEntry.RuleObject;
5
+ rules: Input["rules"]["rules"]["html"][number][1];
7
6
  files: readonly string[];
8
7
  linterOptions: {
9
8
  noInlineConfig: true;
@@ -22,4 +21,4 @@ interface Config {
22
21
  processor?: string;
23
22
  }
24
23
 
25
- export type { Config, Config as default };
24
+ export type Output = Config[];
@@ -1,4 +1,4 @@
1
- const scopes = [
1
+ export const scopes = [
2
2
  "js",
3
3
  "ts",
4
4
  "svelte",
@@ -9,6 +9,4 @@ const scopes = [
9
9
  "yml",
10
10
  "md",
11
11
  ] as const;
12
-
13
- export default scopes;
14
12
  export type Scope = (typeof scopes)[number];
@@ -1,9 +0,0 @@
1
- import type * as Input from "./input/index.js";
2
- import type * as Output from "./output/index.js";
3
- type Output = Output.Config;
4
- declare namespace Boundary {
5
- type Input = Input.Input;
6
- type Output = Output.Config;
7
- }
8
- export type { Input, Output, Boundary as default, };
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/boundary/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAEjD,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAE5B,kBAAU,QAAQ,CAAC;IACjB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAChC,KAAY,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;CACpC;AAED,YAAY,EACV,KAAK,EACL,MAAM,EACN,QAAQ,IAAI,OAAO,GACpB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/boundary/index.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import type { Scope } from "../../../../scopes/index.js";
2
- type FileBase = Readonly<Record<Scope, readonly string[]>>;
3
- export type { FileBase, FileBase as default, };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/boundary/input/files/default/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,KAAK,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAE3D,YAAY,EACV,QAAQ,EACR,QAAQ,IAAI,OAAO,GACpB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/boundary/input/files/default/index.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import type * as Includes from "../default/index.js";
2
- type Includes = Partial<Includes.FileBase>;
3
- export type { Includes, Includes as default };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/boundary/input/files/includes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAErD,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAE3C,YAAY,EAAE,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/boundary/input/files/includes/index.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import type FileBase from "./default/index.js";
2
- import type Includes from "./includes/index.js";
3
- type Files = {
4
- files: FileBase;
5
- includes: Includes;
6
- };
7
- export type { FileBase, Includes, Files, Files as default, };
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/boundary/input/files/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,KAAK,KAAK,GAAG;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAErD,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,KAAK,IAAI,OAAO,GACjB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/boundary/input/files/index.ts"],"names":[],"mappings":""}