@eslinted/core 13.3.0-rc.1 → 13.3.0-rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/factory/factory.d.ts +183 -81
  2. package/dist/factory/factory.d.ts.map +1 -1
  3. package/dist/factory/factory.js +22 -3
  4. package/dist/factory/factory.js.map +1 -1
  5. package/dist/factory/settings/scopes/html.d.ts +4 -3
  6. package/dist/factory/settings/scopes/html.d.ts.map +1 -1
  7. package/dist/factory/settings/scopes/html.js +2 -4
  8. package/dist/factory/settings/scopes/html.js.map +1 -1
  9. package/dist/factory/settings/scopes/js.d.ts +3 -2
  10. package/dist/factory/settings/scopes/js.d.ts.map +1 -1
  11. package/dist/factory/settings/scopes/js.js +2 -3
  12. package/dist/factory/settings/scopes/js.js.map +1 -1
  13. package/dist/factory/settings/scopes/json.d.ts +4 -3
  14. package/dist/factory/settings/scopes/json.d.ts.map +1 -1
  15. package/dist/factory/settings/scopes/json.js +2 -4
  16. package/dist/factory/settings/scopes/json.js.map +1 -1
  17. package/dist/factory/settings/scopes/jsonc.d.ts +4 -3
  18. package/dist/factory/settings/scopes/jsonc.d.ts.map +1 -1
  19. package/dist/factory/settings/scopes/jsonc.js +2 -4
  20. package/dist/factory/settings/scopes/jsonc.js.map +1 -1
  21. package/dist/factory/settings/scopes/mocha.d.ts +5 -3
  22. package/dist/factory/settings/scopes/mocha.d.ts.map +1 -1
  23. package/dist/factory/settings/scopes/mocha.js +11 -12
  24. package/dist/factory/settings/scopes/mocha.js.map +1 -1
  25. package/dist/factory/settings/scopes/svelte.d.ts +16 -12
  26. package/dist/factory/settings/scopes/svelte.d.ts.map +1 -1
  27. package/dist/factory/settings/scopes/svelte.js +12 -13
  28. package/dist/factory/settings/scopes/svelte.js.map +1 -1
  29. package/dist/factory/settings/scopes/ts.d.ts +10 -6
  30. package/dist/factory/settings/scopes/ts.d.ts.map +1 -1
  31. package/dist/factory/settings/scopes/ts.js +10 -11
  32. package/dist/factory/settings/scopes/ts.js.map +1 -1
  33. package/dist/factory/settings/scopes/yml.d.ts +4 -3
  34. package/dist/factory/settings/scopes/yml.d.ts.map +1 -1
  35. package/dist/factory/settings/scopes/yml.js +2 -4
  36. package/dist/factory/settings/scopes/yml.js.map +1 -1
  37. package/dist/factory/settings/setting.d.ts +50 -37
  38. package/dist/factory/settings/setting.d.ts.map +1 -1
  39. package/dist/factory/settings/setting.js +5 -6
  40. package/dist/factory/settings/setting.js.map +1 -1
  41. package/dist/index.js +9 -9
  42. package/dist/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/factory/factory.ts +22 -2
  45. package/src/factory/settings/scopes/html.ts +3 -8
  46. package/src/factory/settings/scopes/js.ts +3 -5
  47. package/src/factory/settings/scopes/json.ts +3 -8
  48. package/src/factory/settings/scopes/jsonc.ts +3 -8
  49. package/src/factory/settings/scopes/mocha.ts +13 -17
  50. package/src/factory/settings/scopes/svelte.ts +19 -21
  51. package/src/factory/settings/scopes/ts.ts +16 -17
  52. package/src/factory/settings/scopes/yml.ts +3 -9
  53. package/src/factory/settings/setting.ts +39 -43
  54. package/src/index.ts +9 -9
@@ -2,31 +2,29 @@ import { ScopeSetting } from "../setting";
2
2
  import type TsSetting from "./ts";
3
3
 
4
4
  export default class SvelteSetting extends ScopeSetting<
5
- "svelte",
6
- {
7
- readonly parser: unknown;
8
- readonly extraFileExtensions: readonly [".svelte"];
9
- } & TsSetting["option"]["languageOptions"]["parserOptions"],
10
- 2,
5
+ "svelte" | "ts",
6
+ TsSetting["parserOptions"] & {
7
+ parserOptions: {
8
+ readonly parser: "ts";
9
+ readonly extraFileExtensions: readonly [".svelte"];
10
+ };
11
+ },
11
12
  false,
12
13
  { readonly processor: "svelte/svelte" }
13
14
  > {
14
15
  public readonly scope = "svelte";
15
16
  public readonly processor = { processor: "svelte/svelte" } as const;
16
17
  public readonly language = {} as const;
17
-
18
- public get languageOptions() {
19
- const [parser, tsParser] = this.parser;
20
-
21
- return {
22
- parser,
23
- parserOptions: {
24
- parser: tsParser,
25
- extraFileExtensions: [".svelte"] as const,
26
- project: "tsconfig.json",
27
- sourceType: "module",
28
- ecmaVersion: 2023,
29
- } as const,
30
- } as const;
31
- }
18
+ public readonly parserOptions = {
19
+ parserOptions: {
20
+ project: "tsconfig.json",
21
+ sourceType: "module",
22
+ ecmaVersion: 2023,
23
+ parser: "ts",
24
+ extraFileExtensions: [".svelte"] as const,
25
+ } as const,
26
+ } as const;
27
+ public readonly languageOptions = {
28
+ parser: "svelte",
29
+ } as const;
32
30
  }
@@ -3,26 +3,25 @@ import { ScopeSetting } from "../setting";
3
3
  export default class TsSetting extends ScopeSetting<
4
4
  "ts",
5
5
  {
6
- readonly project: "tsconfig.json";
7
- readonly sourceType: "module";
8
- readonly ecmaVersion: 2023;
9
- },
10
- 1
6
+ parserOptions: {
7
+ readonly project: "tsconfig.json";
8
+ readonly sourceType: "module";
9
+ readonly ecmaVersion: 2023;
10
+ };
11
+ }
11
12
  > {
12
13
  public readonly scope = "ts";
13
14
  public readonly processor = {} as const;
14
15
  public readonly language = {} as const;
16
+ public readonly parserOptions = {
17
+ parserOptions: {
18
+ project: "tsconfig.json",
19
+ sourceType: "module",
20
+ ecmaVersion: 2023,
21
+ } as const,
22
+ } as const;
23
+ public readonly languageOptions = {
24
+ parser: "ts",
15
25
 
16
- public get languageOptions() {
17
- const [parser] = this.parser;
18
-
19
- return {
20
- parser,
21
- parserOptions: {
22
- project: "tsconfig.json",
23
- sourceType: "module",
24
- ecmaVersion: 2023,
25
- } as const,
26
- } as const;
27
- }
26
+ } as const;
28
27
  }
@@ -1,17 +1,11 @@
1
1
  import { ScopeSetting } from "../setting";
2
2
 
3
3
  export default class YmlSetting extends ScopeSetting<
4
- "yml",
5
- true,
6
- 1
4
+ "yml"
7
5
  > {
8
6
  public readonly scope = "yml";
9
7
  public readonly processor = {} as const;
10
8
  public readonly language = {} as const;
11
-
12
- public get languageOptions() {
13
- const [parser] = this.parser;
14
-
15
- return { parser } as const;
16
- }
9
+ public readonly parserOptions = {} as const;
10
+ public readonly languageOptions = { parser: "yml" } as const;
17
11
  }
@@ -2,61 +2,57 @@ import globals from "globals";
2
2
  import type { Scopes } from "../..";
3
3
 
4
4
  export abstract class ScopeSetting<
5
- S extends Scopes,
6
- ParserOptions extends
7
- | object
8
- | boolean = false,
9
- ParserCount extends 0 | 1 | 2 = ParserOptions extends false ? 0 : 1,
10
- G extends keyof typeof globals | false = false,
5
+ Parser extends Scopes | false = false,
6
+ ParserOptions extends object = object,
7
+ Global extends keyof typeof globals | false = false,
11
8
  Processor extends object = object,
12
9
  Language extends object = object,
13
10
  > {
14
- public abstract readonly scope: S;
15
- public abstract readonly processor: (Processor extends never
16
- ? object
17
- : Processor extends { readonly processor: infer P }
18
- ? string extends P
19
- ? object
20
- : { readonly processor: P }
21
- : object);
22
- public abstract readonly language: (Language extends never
23
- ? object
24
- : Language extends { readonly language: infer L }
25
- ? string extends L
26
- ? object
27
- : { readonly language: L }
28
- : object);
29
- constructor(public readonly parser: readonly unknown[] & { length: ParserCount }) {}
11
+ public abstract readonly scope: Scopes;
12
+ public abstract readonly processor: (Processor extends { readonly processor: infer P }
13
+ ? string extends P
14
+ ? Record<string, never>
15
+ : { readonly processor: P }
16
+ : Record<string, never>);
17
+ public abstract readonly language: (Language extends { readonly language: infer L }
18
+ ? string extends L
19
+ ? Record<string, never>
20
+ : { readonly language: L }
21
+ : Record<string, never>);
22
+ public abstract readonly parserOptions: (ParserOptions extends { readonly parserOptions: infer PO }
23
+ ? PO extends { readonly parser: infer P }
24
+ ? P extends Parser
25
+ ? ParserOptions
26
+ : Record<string, never>
27
+ : ParserOptions
28
+ : Record<string, never>);
29
+ public abstract readonly languageOptions: (
30
+ [Parser] extends [boolean]
31
+ ? { readonly parser?: never }
32
+ : { parser: Parser }
33
+
34
+ ) & (
35
+ Global extends boolean
36
+ ? { readonly globals?: never }
37
+ : { readonly globals: Readonly<Record<string, unknown>> }
38
+ );
30
39
 
31
40
  public get option() {
32
- const { languageOptions, processor, language } = this;
41
+ const {
42
+ languageOptions, parserOptions, processor, language,
43
+ } = this;
33
44
 
34
45
  return {
35
- languageOptions,
46
+ languageOptions: {
47
+ ...languageOptions,
48
+ ...parserOptions,
49
+ },
36
50
  ...processor,
37
51
  ...language,
38
52
  } as const;
39
53
  }
40
54
 
41
- protected abstract get languageOptions():
42
- (G extends never
43
- ? object
44
- : G extends boolean
45
- ? object
46
- : G extends string
47
- ? string extends G
48
- ? object
49
- : { readonly globals: Readonly<Record<string, unknown>> }
50
- : object
51
- ) & ParserOptions extends never
52
- ? object
53
- : ParserOptions extends boolean
54
- ? ParserOptions extends true
55
- ? { readonly parser: unknown }
56
- : object
57
- : { readonly parser: unknown; readonly parserOptions: ParserOptions };
58
-
59
- protected globals(global: G & keyof typeof globals) {
55
+ protected globals(global: Global & keyof typeof globals) {
60
56
  if (typeof global === "boolean")
61
57
  throw new TypeError("`global` must be a string key of `globals` package");
62
58
 
package/src/index.ts CHANGED
@@ -10,16 +10,16 @@ export default function ({
10
10
  extensions,
11
11
  }: Input): Output {
12
12
  try {
13
- const factory = new Factory(defaults, extensions),
13
+ const factory = new Factory(parsers, defaults, extensions),
14
14
  options: { readonly [S in typeof scopes[number]]: InstanceType<typeof ScopeSettings[S]> } = {
15
- js: new ScopeSettings.js([] as const),
16
- ts: new ScopeSettings.ts([parsers.ts] as const),
17
- svelte: new ScopeSettings.svelte([parsers.svelte, parsers.ts] as const),
18
- mocha: new ScopeSettings.mocha([parsers.ts] as const),
19
- html: new ScopeSettings.html([parsers.html] as const),
20
- json: new ScopeSettings.json([parsers.jsonc] as const),
21
- jsonc: new ScopeSettings.jsonc([parsers.jsonc] as const),
22
- yml: new ScopeSettings.yml([parsers.yml] as const),
15
+ js: new ScopeSettings.js(),
16
+ ts: new ScopeSettings.ts(),
17
+ svelte: new ScopeSettings.svelte(),
18
+ mocha: new ScopeSettings.mocha(),
19
+ html: new ScopeSettings.html(),
20
+ json: new ScopeSettings.json(),
21
+ jsonc: new ScopeSettings.jsonc(),
22
+ yml: new ScopeSettings.yml(),
23
23
  } as const;
24
24
 
25
25
  return [