@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
@@ -3,19 +3,24 @@ export default class SvelteOption extends Option {
3
3
  scope = "svelte";
4
4
  processor = { processor: "svelte/svelte" };
5
5
  get languageOptions() {
6
- const [parser, tsParser] = this.parser;
7
- return {
8
- ecmaVersion: "latest",
9
- sourceType: "module",
10
- parser,
11
- parserOptions: {
6
+ try {
7
+ const [parser, tsParser] = this.parser;
8
+ return {
12
9
  ecmaVersion: "latest",
13
10
  sourceType: "module",
14
- project: "tsconfig.json",
15
- extraFileExtensions: [".svelte"],
16
- parser: tsParser,
17
- },
18
- };
11
+ parser,
12
+ parserOptions: {
13
+ ecmaVersion: "latest",
14
+ sourceType: "module",
15
+ project: "tsconfig.json",
16
+ extraFileExtensions: [".svelte"],
17
+ parser: tsParser,
18
+ },
19
+ };
20
+ }
21
+ catch (e) {
22
+ throw new Error(`linted.factory.options.svelte: languageOptions`, { cause: e });
23
+ }
19
24
  }
20
25
  }
21
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/factory/options/option/svelte/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MA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E,CAAC,EAAE,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/factory/options/option/ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAAM,CAC1C,IAAI,EACJ,oBAAoB,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAC1D,IAAI,EACF,QAAQ,CAAC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,GACrC;IAAE,OAAO,EAAE,eAAe,CAAA;CAAE,EAC9B,CAAC,CACF;IACC,SAAgB,KAAK,QAAQ;IAC7B,SAAgB,SAAS,KAAe;IAExC,IAAW,eAAe;;;;;;;;;MAazB;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/factory/options/option/ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAAM,CAC1C,IAAI,EACJ,oBAAoB,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAC1D,IAAI,EACF,QAAQ,CAAC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,GACrC;IAAE,OAAO,EAAE,eAAe,CAAA;CAAE,EAC9B,CAAC,CACF;IACC,SAAgB,KAAK,QAAQ;IAC7B,SAAgB,SAAS,KAAe;IAExC,IAAW,eAAe;;;;;;;;;MAqBzB;CACF"}
@@ -3,17 +3,22 @@ export default class TsOption extends Option {
3
3
  scope = "ts";
4
4
  processor = {};
5
5
  get languageOptions() {
6
- const [parser] = this.parser;
7
- return {
8
- ecmaVersion: "latest",
9
- sourceType: "module",
10
- parser,
11
- parserOptions: {
6
+ try {
7
+ const [parser] = this.parser;
8
+ return {
12
9
  ecmaVersion: "latest",
13
10
  sourceType: "module",
14
- project: "tsconfig.json",
15
- },
16
- };
11
+ parser,
12
+ parserOptions: {
13
+ ecmaVersion: "latest",
14
+ sourceType: "module",
15
+ project: "tsconfig.json",
16
+ },
17
+ };
18
+ }
19
+ catch (e) {
20
+ throw new Error(`linted.factory.options.ts: languageOptions`, { cause: e });
21
+ }
17
22
  }
18
23
  }
19
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/factory/options/option/ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAGlC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAOrC;IACiB,KAAK,GAAG,IAAI,CAAC;IACb,SAAS,GAAG,EAAW,CAAC;IAExC,IAAW,eAAe;QACxB,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAE7B,OAAO;YACL,WAAW,EAAE,QAAQ;YACrB,UAAU,EAAE,QAAQ;YACpB,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,QAAQ;gBACrB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,eAAe;aACzB;SACO,CAAC;IACb,CAAC;CACF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/factory/options/option/ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAGlC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAOrC;IACiB,KAAK,GAAG,IAAI,CAAC;IACb,SAAS,GAAG,EAAW,CAAC;IAExC,IAAW,eAAe;QACxB,IAAI,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;YAE7B,OAAO;gBACL,WAAW,EAAE,QAAQ;gBACrB,UAAU,EAAE,QAAQ;gBACpB,MAAM;gBACN,aAAa,EAAE;oBACb,WAAW,EAAE,QAAQ;oBACrB,UAAU,EAAE,QAAQ;oBACpB,OAAO,EAAE,eAAe;iBACzB;aACO,CAAC;QACb,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,4CAA4C,EAC5C,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/factory/options/option/yml/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAAM,CAC3C,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,CAAC,CACF;IACC,SAAgB,KAAK,SAAS;IAC9B,SAAgB,SAAS,KAAe;IAExC,IAAW,eAAe;;MAIzB;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/factory/options/option/yml/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAAM,CAC3C,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,CAAC,CACF;IACC,SAAgB,KAAK,SAAS;IAC9B,SAAgB,SAAS,KAAe;IAExC,IAAW,eAAe;;MAYzB;CACF"}
@@ -3,8 +3,13 @@ export default class YmlOption extends Option {
3
3
  scope = "yml";
4
4
  processor = {};
5
5
  get languageOptions() {
6
- const [parser] = this.parser;
7
- return { parser };
6
+ try {
7
+ const [parser] = this.parser;
8
+ return { parser };
9
+ }
10
+ catch (e) {
11
+ throw new Error(`linted.factory.options.yml: languageOptions`, { cause: e });
12
+ }
8
13
  }
9
14
  }
10
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/factory/options/option/yml/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAMtC;IACiB,KAAK,GAAG,KAAK,CAAC;IACd,SAAS,GAAG,EAAW,CAAC;IAExC,IAAW,eAAe;QACxB,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAE7B,OAAO,EAAE,MAAM,EAAW,CAAC;IAC7B,CAAC;CACF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/factory/options/option/yml/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAMtC;IACiB,KAAK,GAAG,KAAK,CAAC;IACd,SAAS,GAAG,EAAW,CAAC;IAExC,IAAW,eAAe;QACxB,IAAI,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;YAE7B,OAAO,EAAE,MAAM,EAAW,CAAC;QAC7B,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,6CAA6C,EAC7C,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -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
  export { Rule };
4
4
  export default class Ruleset<S extends Scope> {
5
5
  private readonly scope;
@@ -1 +1 @@
1
- {"version":3,"file":"Ruleset.d.ts","sourceRoot":"","sources":["../../../src/factory/ruleset/Ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,MAAM,CAAC,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,KAAK;IAKxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,SAAgB,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC;IAClC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAQ;gBAGjB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACrC,GAAG,OAAO,EAAE,SAAS,IAAI,EAAE;IAK7B,IAAW,EAAE,kBAIZ;IAED,IAAW,OAAO,iCAOjB;IAEM,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK;CAS7C"}
1
+ {"version":3,"file":"Ruleset.d.ts","sourceRoot":"","sources":["../../../src/factory/ruleset/Ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,MAAM,CAAC,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,KAAK;IAKxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,SAAgB,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC;IAClC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAQ;gBAGjB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACrC,GAAG,OAAO,EAAE,SAAS,IAAI,EAAE;IAa7B,IAAW,EAAE,kBAYZ;IAED,IAAW,OAAO,iCAejB;IAEM,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK;CAiB7C"}
@@ -6,23 +6,43 @@ export default class Ruleset {
6
6
  overrides = null;
7
7
  constructor(scope, ...ruleset) {
8
8
  this.scope = scope;
9
- this.ruleset = [...ruleset];
9
+ try {
10
+ this.ruleset = [...ruleset];
11
+ }
12
+ catch (e) {
13
+ throw new Error(`linted.factory.Ruleset`, { cause: e });
14
+ }
10
15
  }
11
16
  get id() {
12
- const { scope } = this;
13
- return scope;
17
+ try {
18
+ const { scope } = this;
19
+ return scope;
20
+ }
21
+ catch (e) {
22
+ throw new Error(`linted.factory.Ruleset: id`, { cause: e });
23
+ }
14
24
  }
15
25
  get records() {
16
- const { ruleset, overrides } = this;
17
- return [
18
- ...ruleset.map(rules => [rules.id, rules.rules]),
19
- ...overrides === null ? [] : [[overrides.id, overrides.rules]],
20
- ];
26
+ try {
27
+ const { ruleset, overrides } = this;
28
+ return [
29
+ ...ruleset.map(rules => [rules.id, rules.rules]),
30
+ ...overrides === null ? [] : [[overrides.id, overrides.rules]],
31
+ ];
32
+ }
33
+ catch (e) {
34
+ throw new Error(`linted.factory.Ruleset: records`, { cause: e });
35
+ }
21
36
  }
22
37
  override(overrides) {
23
- if (typeof overrides !== "undefined")
24
- this.overrides = new Rule("override", overrides);
25
- return this;
38
+ try {
39
+ if (typeof overrides !== "undefined")
40
+ this.overrides = new Rule("override", overrides);
41
+ return this;
42
+ }
43
+ catch (e) {
44
+ throw new Error(`linted.factory.Ruleset: override`, { cause: e });
45
+ }
26
46
  }
27
47
  }
28
48
  //# sourceMappingURL=Ruleset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Ruleset.js","sourceRoot":"","sources":["../../../src/factory/ruleset/Ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,MAAM,CAAC,OAAO,OAAO,OAAO;IAKP;IAJH,OAAO,CAAkB;IAClC,SAAS,GAAe,IAAI,CAAC;IAEpC,YACmB,KAAoB,EACrC,GAAG,OAAwB;QADV,UAAK,GAAL,KAAK,CAAe;QAGrC,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,IAAW,EAAE;QACX,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAEvB,OAAO,KAAK,CAAC;IACf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CAAC,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,4BAA4B,EAC5B,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAW,OAAO;QAChB,IAAI,CAAC;YACH,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;YAEpC,OAAO;gBACL,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAU,CAAC;gBACzD,GAAG,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,KAAK,CAAU,CAAU;aACjF,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,iCAAiC,EACjC,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,QAAQ,CAAC,SAA4B;QAC1C,IAAI,CAAC;YACH,IAAI,OAAO,SAAS,KAAK,WAAW;gBAClC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CACvB,UAAU,EACV,SAAS,CACV,CAAC;YAEJ,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,kCAAkC,EAClC,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import type { Scope, Plugins, Parsers, IConfig } from "./boundary/boundary.js";
2
- import { Ruleset, Rule } from "./factory/Factory.js";
3
- export type { Scope };
1
+ import { type Scope } from "./scopes/scopes.js";
2
+ import type Output from "./boundary/output.js";
3
+ import type Input from "./boundary/input.js";
4
+ import { Ruleset, Rule } from "./factory/factory.js";
5
+ export type { Scope, Output };
4
6
  export { Ruleset, Rule };
5
- export default function (plugins: Plugins, parsers: Parsers, base: Record<Scope, string[]>, includes: Particord<Scope, string[]>, rulesets: {
7
+ export default function (plugins: Input.Plugins, parsers: Input.Parsers, base: Record<Scope, string[]>, includes: Particord<Scope, string[]>, rulesets: {
6
8
  [S in Scope]: Ruleset<S>;
7
- }, overrides: Particord<Scope, IRule>): IConfig[];
9
+ }, overrides: Particord<Scope, IRule>): Output[];
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,OAAO,EACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,OAAO,EACP,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,KAAK,EAAE,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzB,MAAM,CAAC,OAAO,WACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAC7B,QAAQ,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EACpC,QAAQ,EAAE;KAAG,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;CAAE,EACtC,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,GACjC,OAAO,EAAE,CA0FX"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAe,EAAE,KAAK,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAGL,OAAO,EACP,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzB,MAAM,CAAC,OAAO,WACZ,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAC7B,QAAQ,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EACpC,QAAQ,EAAE;KAAG,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;CAAE,EACtC,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,GACjC,MAAM,EAAE,CA0FV"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import scopes from "./boundary/boundary.js";
2
- import { Options, Files, Ruleset, Rule, } from "./factory/Factory.js";
1
+ import scopes, {} from "./scopes/scopes.js";
2
+ import { Options, Files, Ruleset, Rule, } from "./factory/factory.js";
3
3
  export { Ruleset, Rule };
4
4
  export default function (plugins, parsers, base, includes, rulesets, overrides) {
5
5
  try {
@@ -45,7 +45,7 @@ export default function (plugins, parsers, base, includes, rulesets, overrides)
45
45
  .flat();
46
46
  }
47
47
  catch (e) {
48
- throw new Error(`linted(): Caught exception.`, { cause: e });
48
+ throw new Error(`linted.main`, { cause: e });
49
49
  }
50
50
  }
51
51
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAO5C,OAAO,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,GACL,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzB,MAAM,CAAC,O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],"mappings":"AAAA,QAAA,MAAM,MAAM,iEAQF,CAAC;AAEX,eAAe,MAAM,CAAC;AACtB,MAAM,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../src/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"}
package/package.json CHANGED
@@ -1,31 +1,19 @@
1
1
  {
2
2
  "name": "@eslinted/core",
3
- "version": "0.8.0-rc.1",
4
- "description": "",
3
+ "version": "0.8.1",
4
+ "description": "Core ESLint flat config factory npm package `linted`.",
5
5
  "keywords": [],
6
6
  "license": "MIT",
7
- "type": "module",
8
7
  "private": false,
9
- "config": {
10
- "PACKAGE_JSON_VERSION": "20.10.0"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/jimmy-zhening-luo/linted-core.git"
15
- },
8
+ "repository": "github:jimmy-zhening-luo/linted-core",
16
9
  "homepage": "https://github.com/jimmy-zhening-luo/linted-core#readme",
17
- "bugs": {
18
- "url": "https://github.com/jimmy-zhening-luo/linted-core/issues"
19
- },
20
- "author": {
21
- "name": "Jimmy Zhening Luo",
22
- "email": "1450044+jimmy-zhening-luo@users.noreply.github.com",
23
- "url": "https://jimm.my"
24
- },
10
+ "bugs": "https://github.com/jimmy-zhening-luo/linted-core/issues",
11
+ "type": "module",
25
12
  "main": "dist/index.js",
26
13
  "types": "dist/index.d.ts",
27
14
  "engines": {
28
- "node": ">=20.15.0"
15
+ "node": ">=20.15.0",
16
+ "npm": ">=10.7.0"
29
17
  },
30
18
  "peerDependencies": {},
31
19
  "peerDependenciesMeta": {},
@@ -33,9 +21,9 @@
33
21
  "dependencies": {},
34
22
  "devDependencies": {
35
23
  "eslint": "~8.57.0",
36
- "linted": "~15.4.4",
24
+ "linted": "~15.4.6",
37
25
  "npm-run-all": "^4.1.5",
38
- "typescript": "^5.5.3"
26
+ "typescript": "^5.5.4"
39
27
  },
40
28
  "scripts": {
41
29
  "build": "run-s \"build:{1}:*\" lint:built -- ts",
@@ -56,5 +44,9 @@
56
44
  "prepublishOnly": "npm test",
57
45
  "predeploy": "npm test",
58
46
  "deploy": ""
59
- }
47
+ },
48
+ "config": {
49
+ "PACKAGE_JSON": "20.12.0"
50
+ },
51
+ "author": "Jimmy Zhening Luo <1450044+jimmy-zhening-luo@users.noreply.github.com> (https://jimm.my/)"
60
52
  }
@@ -1,5 +1,5 @@
1
- import type { Scope } from "../input.js";
2
- import type { Options } from "../../../factory/Factory.js";
1
+ import type { Scope } from "../../scopes/scopes.js";
2
+ import type { Options } from "../../factory/factory.js";
3
3
 
4
4
  type Parsers = {
5
5
  readonly [S in Scope]: ConstructorParameters<typeof Options[S]>[2] extends readonly [unknown, ...unknown[]]
@@ -1,4 +1,5 @@
1
- import type { Scope, Options } from "../../../factory/Factory.js";
1
+ import type { Scope } from "../../scopes/scopes.js";
2
+ import type { Options } from "../../factory/factory.js";
2
3
 
3
4
  type Plugins = {
4
5
  readonly [S in Scope]: InstanceType<typeof Options[S]>["plugins"];
@@ -0,0 +1,9 @@
1
+ import type plugins from "./input/plugins.js";
2
+ import type parsers from "./input/parsers.js";
3
+
4
+ namespace Input {
5
+ export type Plugins = plugins;
6
+ export type Parsers = parsers;
7
+ }
8
+
9
+ export type { Input as default };
@@ -0,0 +1,3 @@
1
+ import type Output from "./output/IConfig.js";
2
+
3
+ export type { Output as default };
@@ -0,0 +1,10 @@
1
+ import Ruleset, { Rule } from "./ruleset/Ruleset.js";
2
+ import Files from "./files/Files.js";
3
+ import Options from "./options/options.js";
4
+
5
+ export {
6
+ Options,
7
+ Files,
8
+ Ruleset,
9
+ Rule,
10
+ };
@@ -1,4 +1,4 @@
1
- import type { Scope } from "../Factory.js";
1
+ import type { Scope } from "../../scopes/scopes.js";
2
2
 
3
3
  export default class Files {
4
4
  constructor(
@@ -7,9 +7,17 @@ export default class Files {
7
7
  ) {}
8
8
 
9
9
  public files(scope: Scope): readonly string[] {
10
- return [
11
- ...this.base[scope],
12
- ...this.includes[scope] ?? [],
13
- ];
10
+ try {
11
+ return [
12
+ ...this.base[scope],
13
+ ...this.includes[scope] ?? [],
14
+ ];
15
+ }
16
+ catch (e) {
17
+ throw new Error(
18
+ `linted.factory.Files/scope:${scope}`,
19
+ { cause: e },
20
+ );
21
+ }
14
22
  }
15
23
  }
@@ -1,6 +1,6 @@
1
- import type { Scope } from "../Options.js";
2
- import type { Ruleset } from "../../Factory.js";
3
- import type { IConfig } from "../../../boundary/boundary.js";
1
+ import type { Scope } from "../../../scopes/scopes.js";
2
+ import type { Ruleset } from "../../factory.js";
3
+ import type Output from "../../../boundary/output.js";
4
4
 
5
5
  export default abstract class Option<
6
6
  S extends Scope,
@@ -11,13 +11,17 @@ export default abstract class Option<
11
11
  GlobalTypes extends string = never,
12
12
  Processor extends object = never,
13
13
  > {
14
- public readonly linterOptions = {
14
+ private readonly linterOptions = {
15
15
  noInlineConfig: true,
16
16
  reportUnusedDisableDirectives: "error",
17
17
  } as const;
18
18
 
19
19
  public abstract readonly scope: literalful<S>;
20
- public abstract readonly processor: (Interface<Processor> extends never ? object : Interface<Processor> extends { "interface": string } ? Interface<Processor> : object);
20
+ public abstract readonly processor: Interface<Processor> extends never
21
+ ? object
22
+ : Interface<Processor> extends Readonly<Record<"processor", string>>
23
+ ? Interface<Processor>
24
+ : object;
21
25
 
22
26
  constructor(
23
27
  public readonly files: readonly string[],
@@ -26,62 +30,78 @@ export default abstract class Option<
26
30
  public readonly parser: Tuple<unknown, ParserCount>,
27
31
  ) {}
28
32
 
29
- public get configs(): IConfig[] {
30
- const {
31
- scope,
32
- ruleset,
33
- files,
34
- option,
35
- } = this;
33
+ public get configs(): Output[] {
34
+ try {
35
+ const {
36
+ scope,
37
+ ruleset,
38
+ files,
39
+ option,
40
+ } = this;
36
41
 
37
- if (ruleset.id !== scope)
38
- throw new TypeError(
39
- `Option and Ruleset scope mismatch`,
40
- { cause: { option: scope, ruleset: ruleset.id } },
41
- );
42
- else if (files.length < 1)
43
- return [];
44
- else {
45
- const baseName = `scope:${scope}/rule:${ruleset.id}` as const;
42
+ if (ruleset.id !== scope)
43
+ throw new TypeError(
44
+ `Option and Ruleset scope mismatch`,
45
+ { cause: { option: scope, ruleset: ruleset.id } },
46
+ );
47
+ else if (files.length < 1)
48
+ return [];
49
+ else {
50
+ const baseName = `scope:${scope}/rule:${ruleset.id}` as const;
46
51
 
47
- return ruleset.records.map(
48
- ([ruleId, rules]) => {
49
- const name = `${baseName}+${ruleId}` as const;
52
+ return ruleset.records.map(
53
+ ([ruleId, rules]) => {
54
+ const name = `${baseName}+${ruleId}` as const;
50
55
 
51
- return {
52
- name,
53
- files,
54
- rules,
55
- ...option,
56
- };
57
- },
56
+ return {
57
+ name,
58
+ files,
59
+ rules,
60
+ ...option,
61
+ };
62
+ },
63
+ );
64
+ }
65
+ }
66
+ catch (e) {
67
+ throw new Error(
68
+ `linted.factory.Option/scope:${this.scope}: configs`,
69
+ { cause: e },
58
70
  );
59
71
  }
60
72
  }
61
73
 
62
- public get option() {
63
- const {
64
- plugins,
65
- linterOptions,
66
- languageOptions,
67
- processor,
68
- } = this;
74
+ private get option() {
75
+ try {
76
+ const {
77
+ plugins,
78
+ linterOptions,
79
+ languageOptions,
80
+ processor,
81
+ } = this;
69
82
 
70
- return {
71
- linterOptions,
72
- languageOptions,
73
- plugins,
74
- ...processor,
75
- } satisfies IOption<
76
- PluginId,
77
- IsEcma,
78
- ParserOptions,
79
- GlobalTypes,
80
- Processor
81
- >;
83
+ return {
84
+ linterOptions,
85
+ languageOptions,
86
+ plugins,
87
+ ...processor,
88
+ } satisfies IOption<
89
+ PluginId,
90
+ IsEcma,
91
+ ParserOptions,
92
+ GlobalTypes,
93
+ Processor
94
+ >;
95
+ }
96
+ catch (e) {
97
+ throw new Error(
98
+ `linted.factory.Option/scope:${this.scope}: option`,
99
+ { cause: e },
100
+ );
101
+ }
82
102
  }
83
103
 
84
- public abstract get languageOptions(): IOLanguage<
104
+ protected abstract get languageOptions(): IOLanguage<
85
105
  IsEcma,
86
106
  ParserOptions,
87
107
  GlobalTypes
@@ -11,8 +11,16 @@ export default class HtmlOption 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.html: languageOptions`,
22
+ { cause: e },
23
+ );
24
+ }
17
25
  }
18
26
  }
@@ -5,9 +5,17 @@ export default class JsOption extends Option<"js", "@stylistic"> {
5
5
  public readonly processor = {};
6
6
 
7
7
  public get languageOptions() {
8
- return {
9
- ecmaVersion: "latest",
10
- sourceType: "module",
11
- } as const;
8
+ try {
9
+ return {
10
+ ecmaVersion: "latest",
11
+ sourceType: "module",
12
+ } as const;
13
+ }
14
+ catch (e) {
15
+ throw new Error(
16
+ `linted.factory.options.js: languageOptions`,
17
+ { cause: e },
18
+ );
19
+ }
12
20
  }
13
21
  }
@@ -11,8 +11,16 @@ export default class JsonOption 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.json: languageOptions`,
22
+ { cause: e },
23
+ );
24
+ }
17
25
  }
18
26
  }
@@ -11,8 +11,16 @@ export default class JsoncOption 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.jsonc: languageOptions`,
22
+ { cause: e },
23
+ );
24
+ }
17
25
  }
18
26
  }