@eslinted/core 0.8.0-rc.1 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. package/dist/boundary/boundary.d.ts +10 -5
  2. package/dist/boundary/boundary.d.ts.map +1 -1
  3. package/dist/boundary/boundary.js +1 -2
  4. package/dist/boundary/boundary.js.map +1 -1
  5. package/dist/boundary/input/input.d.ts +7 -4
  6. package/dist/boundary/input/input.d.ts.map +1 -1
  7. package/dist/boundary/input/parsers/parsers.d.ts +2 -2
  8. package/dist/boundary/input/parsers/parsers.d.ts.map +1 -1
  9. package/dist/boundary/input/parsers.d.ts +7 -0
  10. package/dist/boundary/input/parsers.d.ts.map +1 -0
  11. package/dist/boundary/input/parsers.js +2 -0
  12. package/dist/boundary/input/parsers.js.map +1 -0
  13. package/dist/boundary/input/plugins/plugins.d.ts +2 -1
  14. package/dist/boundary/input/plugins/plugins.d.ts.map +1 -1
  15. package/dist/boundary/input/plugins.d.ts +7 -0
  16. package/dist/boundary/input/plugins.d.ts.map +1 -0
  17. package/dist/boundary/input/plugins.js +2 -0
  18. package/dist/boundary/input/plugins.js.map +1 -0
  19. package/dist/boundary/input.d.ts +8 -0
  20. package/dist/boundary/input.d.ts.map +1 -0
  21. package/dist/boundary/input.js +2 -0
  22. package/dist/boundary/input.js.map +1 -0
  23. package/dist/boundary/output/IConfig.d.ts +19 -0
  24. package/dist/boundary/output/IConfig.d.ts.map +1 -0
  25. package/dist/boundary/output/IConfig.js +2 -0
  26. package/dist/boundary/output/IConfig.js.map +1 -0
  27. package/dist/boundary/output/output.d.ts +2 -2
  28. package/dist/boundary/output/output.d.ts.map +1 -1
  29. package/dist/boundary/output.d.ts +3 -0
  30. package/dist/boundary/output.d.ts.map +1 -0
  31. package/dist/boundary/output.js +2 -0
  32. package/dist/boundary/output.js.map +1 -0
  33. package/dist/factory/factory.d.ts +5 -0
  34. package/dist/factory/factory.d.ts.map +1 -0
  35. package/dist/factory/{Factory.js → factory.js} +3 -3
  36. package/dist/factory/factory.js.map +1 -0
  37. package/dist/factory/files/Files.d.ts +1 -1
  38. package/dist/factory/files/Files.d.ts.map +1 -1
  39. package/dist/factory/files/Files.js +9 -4
  40. package/dist/factory/files/Files.js.map +1 -1
  41. package/dist/factory/options/Options.d.ts +1 -3
  42. package/dist/factory/options/Options.d.ts.map +1 -1
  43. package/dist/factory/options/Options.js +1 -1
  44. package/dist/factory/options/Options.js.map +1 -1
  45. package/dist/factory/options/option/Option.d.ts +8 -22
  46. package/dist/factory/options/option/Option.d.ts.map +1 -1
  47. package/dist/factory/options/option/Option.js +33 -23
  48. package/dist/factory/options/option/Option.js.map +1 -1
  49. package/dist/factory/options/option/html/index.d.ts.map +1 -1
  50. package/dist/factory/options/option/html/index.js +7 -2
  51. package/dist/factory/options/option/html/index.js.map +1 -1
  52. package/dist/factory/options/option/js/index.d.ts.map +1 -1
  53. package/dist/factory/options/option/js/index.js +9 -4
  54. package/dist/factory/options/option/js/index.js.map +1 -1
  55. package/dist/factory/options/option/json/index.d.ts.map +1 -1
  56. package/dist/factory/options/option/json/index.js +7 -2
  57. package/dist/factory/options/option/json/index.js.map +1 -1
  58. package/dist/factory/options/option/jsonc/index.d.ts.map +1 -1
  59. package/dist/factory/options/option/jsonc/index.js +7 -2
  60. package/dist/factory/options/option/jsonc/index.js.map +1 -1
  61. package/dist/factory/options/option/svelte/index.d.ts.map +1 -1
  62. package/dist/factory/options/option/svelte/index.js +16 -11
  63. package/dist/factory/options/option/svelte/index.js.map +1 -1
  64. package/dist/factory/options/option/ts/index.d.ts.map +1 -1
  65. package/dist/factory/options/option/ts/index.js +14 -9
  66. package/dist/factory/options/option/ts/index.js.map +1 -1
  67. package/dist/factory/options/option/yml/index.d.ts.map +1 -1
  68. package/dist/factory/options/option/yml/index.js +7 -2
  69. package/dist/factory/options/option/yml/index.js.map +1 -1
  70. package/dist/factory/ruleset/Ruleset.d.ts +1 -1
  71. package/dist/factory/ruleset/Ruleset.d.ts.map +1 -1
  72. package/dist/factory/ruleset/Ruleset.js +31 -11
  73. package/dist/factory/ruleset/Ruleset.js.map +1 -1
  74. package/dist/index.d.ts +7 -5
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +3 -3
  77. package/dist/index.js.map +1 -1
  78. package/dist/scopes/scopes.d.ts.map +1 -0
  79. package/dist/scopes/scopes.js.map +1 -0
  80. package/package.json +14 -22
  81. package/src/boundary/input/{parsers/parsers.ts → parsers.ts} +2 -2
  82. package/src/boundary/input/{plugins/plugins.ts → plugins.ts} +2 -1
  83. package/src/boundary/input.ts +9 -0
  84. package/src/boundary/output.ts +3 -0
  85. package/src/factory/factory.ts +10 -0
  86. package/src/factory/files/Files.ts +13 -5
  87. package/src/factory/options/option/Option.ts +71 -51
  88. package/src/factory/options/option/html/index.ts +10 -2
  89. package/src/factory/options/option/js/index.ts +12 -4
  90. package/src/factory/options/option/json/index.ts +10 -2
  91. package/src/factory/options/option/jsonc/index.ts +10 -2
  92. package/src/factory/options/option/svelte/index.ts +19 -11
  93. package/src/factory/options/option/ts/index.ts +17 -9
  94. package/src/factory/options/option/yml/index.ts +10 -2
  95. package/src/factory/options/{Options.ts → options.ts} +0 -2
  96. package/src/factory/ruleset/Ruleset.ts +47 -15
  97. package/src/index.ts +9 -13
  98. package/dist/boundary/scopes/scopes.d.ts.map +0 -1
  99. package/dist/boundary/scopes/scopes.js.map +0 -1
  100. package/dist/factory/Factory.d.ts +0 -7
  101. package/dist/factory/Factory.d.ts.map +0 -1
  102. package/dist/factory/Factory.js.map +0 -1
  103. package/src/boundary/boundary.ts +0 -11
  104. package/src/boundary/input/input.ts +0 -5
  105. package/src/boundary/output/output.ts +0 -3
  106. package/src/factory/Factory.ts +0 -13
  107. /package/dist/{boundary/scopes → scopes}/scopes.d.ts +0 -0
  108. /package/dist/{boundary/scopes → scopes}/scopes.js +0 -0
  109. /package/src/boundary/output/{config/IConfig.ts → IConfig.ts} +0 -0
  110. /package/src/boundary/output/{config/interface → interface}/option/IOption.d.ts +0 -0
  111. /package/src/boundary/output/{config/interface → interface}/option/language/IOLanguage.d.ts +0 -0
  112. /package/src/boundary/output/{config/interface → interface}/option/language/ecma/IOLanguageEcma.d.ts +0 -0
  113. /package/src/boundary/output/{config/interface → interface}/option/language/globals/IOLanguageGlobals.d.ts +0 -0
  114. /package/src/boundary/output/{config/interface → interface}/option/language/source/IOLanguageSource.d.ts +0 -0
  115. /package/src/boundary/output/{config/interface → interface}/option/linter/IOLinter.d.ts +0 -0
  116. /package/src/boundary/output/{config/interface → interface}/option/plugins/IOPlugins.d.ts +0 -0
  117. /package/src/boundary/output/{config/interface → interface}/option/processor/IOProcessor.d.ts +0 -0
  118. /package/src/boundary/output/{config/interface → interface}/rules/IRule.d.ts +0 -0
  119. /package/src/boundary/output/{config/interface → interface}/rules/state/RuleSeverity.d.ts +0 -0
  120. /package/src/{boundary/scopes → scopes}/scopes.ts +0 -0
@@ -16,19 +16,27 @@ export default class SvelteOption extends Option<
16
16
  public readonly processor = { processor: "svelte/svelte" } as const;
17
17
 
18
18
  public get languageOptions() {
19
- const [parser, tsParser] = this.parser;
19
+ try {
20
+ const [parser, tsParser] = this.parser;
20
21
 
21
- return {
22
- ecmaVersion: "latest",
23
- sourceType: "module",
24
- parser,
25
- parserOptions: {
22
+ return {
26
23
  ecmaVersion: "latest",
27
24
  sourceType: "module",
28
- project: "tsconfig.json",
29
- extraFileExtensions: [".svelte"] as const,
30
- parser: tsParser,
31
- },
32
- } as const;
25
+ parser,
26
+ parserOptions: {
27
+ ecmaVersion: "latest",
28
+ sourceType: "module",
29
+ project: "tsconfig.json",
30
+ extraFileExtensions: [".svelte"] as const,
31
+ parser: tsParser,
32
+ },
33
+ } as const;
34
+ }
35
+ catch (e) {
36
+ throw new Error(
37
+ `linted.factory.options.svelte: languageOptions`,
38
+ { cause: e },
39
+ );
40
+ }
33
41
  }
34
42
  }
@@ -13,17 +13,25 @@ export default class TsOption extends Option<
13
13
  public readonly processor = {} as const;
14
14
 
15
15
  public get languageOptions() {
16
- const [parser] = this.parser;
16
+ try {
17
+ const [parser] = this.parser;
17
18
 
18
- return {
19
- ecmaVersion: "latest",
20
- sourceType: "module",
21
- parser,
22
- parserOptions: {
19
+ return {
23
20
  ecmaVersion: "latest",
24
21
  sourceType: "module",
25
- project: "tsconfig.json",
26
- },
27
- } as const;
22
+ parser,
23
+ parserOptions: {
24
+ ecmaVersion: "latest",
25
+ sourceType: "module",
26
+ project: "tsconfig.json",
27
+ },
28
+ } as const;
29
+ }
30
+ catch (e) {
31
+ throw new Error(
32
+ `linted.factory.options.ts: languageOptions`,
33
+ { cause: e },
34
+ );
35
+ }
28
36
  }
29
37
  }
@@ -11,8 +11,16 @@ export default class YmlOption extends Option<
11
11
  public readonly processor = {} as const;
12
12
 
13
13
  public get languageOptions() {
14
- const [parser] = this.parser;
14
+ try {
15
+ const [parser] = this.parser;
15
16
 
16
- return { parser } as const;
17
+ return { parser } as const;
18
+ }
19
+ catch (e) {
20
+ throw new Error(
21
+ `linted.factory.options.yml: languageOptions`,
22
+ { cause: e },
23
+ );
24
+ }
17
25
  }
18
26
  }
@@ -1,4 +1,3 @@
1
- import type { Scope } from "../Factory.js";
2
1
  import JsOption from "./option/js/index.js";
3
2
  import TsOption from "./option/ts/index.js";
4
3
  import SvelteOption from "./option/svelte/index.js";
@@ -7,7 +6,6 @@ import JsonOption from "./option/json/index.js";
7
6
  import JsoncOption from "./option/jsonc/index.js";
8
7
  import YmlOption from "./option/yml/index.js";
9
8
 
10
- export type { Scope };
11
9
  export default {
12
10
  js: JsOption,
13
11
  ts: TsOption,
@@ -1,5 +1,5 @@
1
+ import type { Scope } from "../../scopes/scopes.js";
1
2
  import Rule from "./rule/Rule.js";
2
- import type { Scope } from "../Factory.js";
3
3
 
4
4
  export { Rule };
5
5
  export default class Ruleset<S extends Scope> {
@@ -10,31 +10,63 @@ export default class Ruleset<S extends Scope> {
10
10
  private readonly scope: literalful<S>,
11
11
  ...ruleset: readonly Rule[]
12
12
  ) {
13
- this.ruleset = [...ruleset];
13
+ try {
14
+ this.ruleset = [...ruleset];
15
+ }
16
+ catch (e) {
17
+ throw new Error(
18
+ `linted.factory.Ruleset`,
19
+ { cause: e },
20
+ );
21
+ }
14
22
  }
15
23
 
16
24
  public get id() {
17
- const { scope } = this;
25
+ try {
26
+ const { scope } = this;
18
27
 
19
- return scope;
28
+ return scope;
29
+ }
30
+ catch (e) {
31
+ throw new Error(
32
+ `linted.factory.Ruleset: id`,
33
+ { cause: e },
34
+ );
35
+ }
20
36
  }
21
37
 
22
38
  public get records() {
23
- const { ruleset, overrides } = this;
39
+ try {
40
+ const { ruleset, overrides } = this;
24
41
 
25
- return [
26
- ...ruleset.map(rules => [rules.id, rules.rules] as const),
27
- ...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
28
- ];
42
+ return [
43
+ ...ruleset.map(rules => [rules.id, rules.rules] as const),
44
+ ...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
45
+ ];
46
+ }
47
+ catch (e) {
48
+ throw new Error(
49
+ `linted.factory.Ruleset: records`,
50
+ { cause: e },
51
+ );
52
+ }
29
53
  }
30
54
 
31
55
  public override(overrides: undefined | IRule) {
32
- if (typeof overrides !== "undefined")
33
- this.overrides = new Rule(
34
- "override",
35
- overrides,
36
- );
56
+ try {
57
+ if (typeof overrides !== "undefined")
58
+ this.overrides = new Rule(
59
+ "override",
60
+ overrides,
61
+ );
37
62
 
38
- return this;
63
+ return this;
64
+ }
65
+ catch (e) {
66
+ throw new Error(
67
+ `linted.factory.Ruleset: override`,
68
+ { cause: e },
69
+ );
70
+ }
39
71
  }
40
72
  }
package/src/index.ts CHANGED
@@ -1,27 +1,23 @@
1
- import scopes from "./boundary/boundary.js";
2
- import type {
3
- Scope,
4
- Plugins,
5
- Parsers,
6
- IConfig,
7
- } from "./boundary/boundary.js";
1
+ import scopes, { type Scope } from "./scopes/scopes.js";
2
+ import type Output from "./boundary/output.js";
3
+ import type Input from "./boundary/input.js";
8
4
  import {
9
5
  Options,
10
6
  Files,
11
7
  Ruleset,
12
8
  Rule,
13
- } from "./factory/Factory.js";
9
+ } from "./factory/factory.js";
14
10
 
15
- export type { Scope };
11
+ export type { Scope, Output };
16
12
  export { Ruleset, Rule };
17
13
  export default function (
18
- plugins: Plugins,
19
- parsers: Parsers,
14
+ plugins: Input.Plugins,
15
+ parsers: Input.Parsers,
20
16
  base: Record<Scope, string[]>,
21
17
  includes: Particord<Scope, string[]>,
22
18
  rulesets: { [S in Scope]: Ruleset<S> },
23
19
  overrides: Particord<Scope, IRule>,
24
- ): IConfig[] {
20
+ ): Output[] {
25
21
  try {
26
22
  const files = new Files(
27
23
  base,
@@ -107,7 +103,7 @@ export default function (
107
103
  }
108
104
  catch (e) {
109
105
  throw new Error(
110
- `linted(): Caught exception.`,
106
+ `linted.main`,
111
107
  { cause: e },
112
108
  );
113
109
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../src/boundary/scopes/scopes.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,iEAQF,CAAC;AAEX,eAAe,MAAM,CAAC;AACtB,MAAM,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../../src/boundary/scopes/scopes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,KAAK;CACG,CAAC;AAEX,eAAe,MAAM,CAAC"}
@@ -1,7 +0,0 @@
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
- export type Blanka = ConstructorParameters<typeof Options["js"]>;
6
- export { Options, Files, Ruleset, Rule, type Scope, };
7
- //# sourceMappingURL=Factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Factory.d.ts","sourceRoot":"","sources":["../../src/factory/Factory.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjE,OAAO,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,EACJ,KAAK,KAAK,GACX,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Factory.js","sourceRoot":"","sources":["../../src/factory/Factory.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,GAEL,CAAC"}
@@ -1,11 +0,0 @@
1
- import scopes, { type Scope } from "./scopes/scopes.js";
2
- import type { Plugins, Parsers } from "./input/input.js";
3
- import type IConfig from "./output/output.js";
4
-
5
- export default scopes;
6
- export type {
7
- Scope,
8
- Plugins,
9
- Parsers,
10
- IConfig,
11
- };
@@ -1,5 +0,0 @@
1
- import type Plugins from "./plugins/plugins.js";
2
- import type Parsers from "./parsers/parsers.js";
3
-
4
- export type { Plugins, Parsers };
5
- export type { Scope } from "../boundary.js";
@@ -1,3 +0,0 @@
1
- import type IConfig from "./config/IConfig.js";
2
-
3
- export type { IConfig as default };
@@ -1,13 +0,0 @@
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
- };
File without changes
File without changes
File without changes