@eslinted/core 4.0.5-rc.5 → 4.0.5-rc.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. package/dist/factory/files.d.ts +8 -0
  2. package/dist/factory/files.d.ts.map +1 -0
  3. package/dist/factory/files.js +19 -0
  4. package/dist/factory/files.js.map +1 -0
  5. package/dist/factory/index.d.ts +6 -0
  6. package/dist/factory/index.d.ts.map +1 -0
  7. package/dist/factory/index.js +5 -0
  8. package/dist/factory/index.js.map +1 -0
  9. package/dist/factory/options/html.d.ts +9 -0
  10. package/dist/factory/options/html.d.ts.map +1 -0
  11. package/dist/factory/options/html.js +10 -0
  12. package/dist/factory/options/html.js.map +1 -0
  13. package/dist/factory/options/index.d.ts +23 -0
  14. package/dist/factory/options/index.d.ts.map +1 -0
  15. package/dist/factory/options/index.js +21 -0
  16. package/dist/factory/options/index.js.map +1 -0
  17. package/dist/factory/options/js.d.ts +10 -0
  18. package/dist/factory/options/js.d.ts.map +1 -0
  19. package/dist/factory/options/js.js +12 -0
  20. package/dist/factory/options/js.js.map +1 -0
  21. package/dist/factory/options/json.d.ts +9 -0
  22. package/dist/factory/options/json.d.ts.map +1 -0
  23. package/dist/factory/options/json.js +10 -0
  24. package/dist/factory/options/json.js.map +1 -0
  25. package/dist/factory/options/jsonc.d.ts +9 -0
  26. package/dist/factory/options/jsonc.d.ts.map +1 -0
  27. package/dist/factory/options/jsonc.js +10 -0
  28. package/dist/factory/options/jsonc.js.map +1 -0
  29. package/dist/factory/options/md.d.ts +9 -0
  30. package/dist/factory/options/md.d.ts.map +1 -0
  31. package/dist/factory/options/md.js +10 -0
  32. package/dist/factory/options/md.js.map +1 -0
  33. package/dist/factory/options/mocha.d.ts +40 -0
  34. package/dist/factory/options/mocha.d.ts.map +1 -0
  35. package/dist/factory/options/mocha.js +17 -0
  36. package/dist/factory/options/mocha.js.map +1 -0
  37. package/dist/factory/options/option/index.d.ts +2986 -0
  38. package/dist/factory/options/option/index.d.ts.map +1 -0
  39. package/dist/factory/options/option/index.js +47 -0
  40. package/dist/factory/options/option/index.js.map +1 -0
  41. package/dist/factory/options/option/template/globals.d.ts +3 -0
  42. package/dist/factory/options/option/template/globals.d.ts.map +1 -0
  43. package/dist/factory/options/option/template/globals.js +1 -0
  44. package/dist/factory/options/option/template/globals.js.map +1 -0
  45. package/dist/factory/options/option/template/index.d.ts +15 -0
  46. package/dist/factory/options/option/template/index.d.ts.map +1 -0
  47. package/dist/factory/options/option/template/index.js +1 -0
  48. package/dist/factory/options/option/template/index.js.map +1 -0
  49. package/dist/factory/options/option/template/language/ecma.d.ts +2 -0
  50. package/dist/factory/options/option/template/language/ecma.d.ts.map +1 -0
  51. package/dist/factory/options/option/template/language/ecma.js +1 -0
  52. package/dist/factory/options/option/template/language/ecma.js.map +1 -0
  53. package/dist/factory/options/option/template/language/index.d.ts +14 -0
  54. package/dist/factory/options/option/template/language/index.d.ts.map +1 -0
  55. package/dist/factory/options/option/template/language/index.js +1 -0
  56. package/dist/factory/options/option/template/language/index.js.map +1 -0
  57. package/dist/factory/options/option/template/language/source.d.ts +2 -0
  58. package/dist/factory/options/option/template/language/source.d.ts.map +1 -0
  59. package/dist/factory/options/option/template/language/source.js +1 -0
  60. package/dist/factory/options/option/template/language/source.js.map +1 -0
  61. package/dist/factory/options/option/template/linter.d.ts +5 -0
  62. package/dist/factory/options/option/template/linter.d.ts.map +1 -0
  63. package/dist/factory/options/option/template/linter.js +1 -0
  64. package/dist/factory/options/option/template/linter.js.map +1 -0
  65. package/dist/factory/options/option/template/plugins.d.ts +6 -0
  66. package/dist/factory/options/option/template/plugins.d.ts.map +1 -0
  67. package/dist/factory/options/option/template/plugins.js +1 -0
  68. package/dist/factory/options/option/template/plugins.js.map +1 -0
  69. package/dist/factory/options/svelte.d.ts +27 -0
  70. package/dist/factory/options/svelte.d.ts.map +1 -0
  71. package/dist/factory/options/svelte.js +21 -0
  72. package/dist/factory/options/svelte.js.map +1 -0
  73. package/dist/factory/options/ts.d.ts +19 -0
  74. package/dist/factory/options/ts.d.ts.map +1 -0
  75. package/dist/factory/options/ts.js +15 -0
  76. package/dist/factory/options/ts.js.map +1 -0
  77. package/dist/factory/options/yml.d.ts +9 -0
  78. package/dist/factory/options/yml.d.ts.map +1 -0
  79. package/dist/factory/options/yml.js +10 -0
  80. package/dist/factory/options/yml.js.map +1 -0
  81. package/dist/factory/rulesets/index.d.ts +10 -0
  82. package/dist/factory/rulesets/index.d.ts.map +1 -0
  83. package/dist/factory/rulesets/index.js +17 -0
  84. package/dist/factory/rulesets/index.js.map +1 -0
  85. package/dist/factory/rulesets/ruleset.d.ts +10 -0
  86. package/dist/factory/rulesets/ruleset.d.ts.map +1 -0
  87. package/dist/factory/rulesets/ruleset.js +20 -0
  88. package/dist/factory/rulesets/ruleset.js.map +1 -0
  89. package/dist/index.d.ts +26 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +31 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/input/files.d.ts +6 -0
  94. package/dist/input/files.d.ts.map +1 -0
  95. package/dist/input/files.js +1 -0
  96. package/dist/input/files.js.map +1 -0
  97. package/dist/input/imports/parsers.d.ts +3 -0
  98. package/dist/input/imports/parsers.d.ts.map +1 -0
  99. package/dist/input/imports/parsers.js +1 -0
  100. package/dist/input/imports/parsers.js.map +1 -0
  101. package/dist/input/imports/plugins.d.ts +2 -0
  102. package/dist/input/imports/plugins.d.ts.map +1 -0
  103. package/dist/input/imports/plugins.js +1 -0
  104. package/dist/input/imports/plugins.js.map +1 -0
  105. package/dist/input/index.d.ts +22 -0
  106. package/dist/input/index.d.ts.map +1 -0
  107. package/dist/input/index.js +1 -0
  108. package/dist/input/index.js.map +1 -0
  109. package/dist/input/parsers.d.ts +3 -0
  110. package/dist/input/parsers.d.ts.map +1 -0
  111. package/dist/input/parsers.js +1 -0
  112. package/dist/input/parsers.js.map +1 -0
  113. package/dist/input/plugins.d.ts +5 -0
  114. package/dist/input/plugins.d.ts.map +1 -0
  115. package/dist/input/plugins.js +1 -0
  116. package/dist/input/plugins.js.map +1 -0
  117. package/dist/input/rules/entry/index.d.ts +7 -0
  118. package/dist/input/rules/entry/index.d.ts.map +1 -0
  119. package/dist/input/rules/entry/index.js +1 -0
  120. package/dist/input/rules/entry/index.js.map +1 -0
  121. package/dist/input/rules/entry/record/index.d.ts +3 -0
  122. package/dist/input/rules/entry/record/index.d.ts.map +1 -0
  123. package/dist/input/rules/entry/record/index.js +1 -0
  124. package/dist/input/rules/entry/record/index.js.map +1 -0
  125. package/dist/input/rules/entry/record/state.d.ts +2 -0
  126. package/dist/input/rules/entry/record/state.d.ts.map +1 -0
  127. package/dist/input/rules/entry/record/state.js +1 -0
  128. package/dist/input/rules/entry/record/state.js.map +1 -0
  129. package/dist/input/rules/index.d.ts +14 -0
  130. package/dist/input/rules/index.d.ts.map +1 -0
  131. package/dist/input/rules/index.js +1 -0
  132. package/dist/input/rules/index.js.map +1 -0
  133. package/dist/output.d.ts +20 -0
  134. package/dist/output.d.ts.map +1 -0
  135. package/dist/output.js +1 -0
  136. package/dist/output.js.map +1 -0
  137. package/dist/scopes.d.ts +3 -0
  138. package/dist/scopes.d.ts.map +1 -0
  139. package/dist/scopes.js +12 -0
  140. package/dist/scopes.js.map +1 -0
  141. package/package.json +4 -10
  142. package/src/factory/files.ts +20 -9
  143. package/src/factory/index.ts +4 -2
  144. package/src/factory/options/index.ts +2 -0
  145. package/src/factory/options/option/index.ts +25 -33
  146. package/src/factory/options/option/template/globals.ts +5 -0
  147. package/src/factory/options/option/{template.ts → template/index.ts} +6 -4
  148. package/src/factory/options/option/template/language/ecma.ts +3 -0
  149. package/src/factory/options/option/{params/language.ts → template/language/index.ts} +3 -3
  150. package/src/factory/options/option/template/language/source.ts +4 -0
  151. package/src/factory/options/option/template/linter.ts +8 -0
  152. package/src/factory/options/option/template/plugins.ts +1 -0
  153. package/src/factory/rulesets/index.ts +24 -0
  154. package/src/factory/rulesets/ruleset.ts +25 -0
  155. package/src/index.ts +25 -21
  156. package/src/input/files.ts +6 -0
  157. package/src/{inputs → input}/imports/parsers.ts +1 -1
  158. package/src/{inputs → input}/imports/plugins.ts +3 -2
  159. package/src/input/index.ts +23 -0
  160. package/src/input/parsers.ts +3 -0
  161. package/src/input/plugins.ts +3 -0
  162. package/src/input/rules/entry/index.ts +7 -0
  163. package/src/input/rules/entry/record/index.ts +3 -0
  164. package/src/input/rules/entry/record/state.ts +5 -0
  165. package/src/input/rules/index.ts +14 -0
  166. package/src/output.ts +23 -23
  167. package/src/scopes.ts +1 -1
  168. package/tsconfig.json +5 -6
  169. package/src/factory/options/option/params/globals.ts +0 -3
  170. package/src/factory/options/option/params/languageOptions/ecma.ts +0 -1
  171. package/src/factory/options/option/params/languageOptions/source.ts +0 -1
  172. package/src/factory/options/option/params/linter.ts +0 -4
  173. package/src/factory/options/option/params/plugins.ts +0 -1
  174. package/src/factory/ruleset/index.ts +0 -41
  175. package/src/factory/ruleset/rule.ts +0 -8
  176. package/src/factory/rulesets.ts +0 -16
  177. package/src/input.ts +0 -11
  178. package/src/inputs/files/base.ts +0 -3
  179. package/src/inputs/files/includes.ts +0 -3
  180. package/src/inputs/files.ts +0 -7
  181. package/src/inputs/imports.ts +0 -2
  182. package/src/inputs/parsers.ts +0 -3
  183. package/src/inputs/plugins.ts +0 -3
  184. package/src/inputs/rules/entry/index.ts +0 -3
  185. package/src/inputs/rules/entry/object/index.ts +0 -7
  186. package/src/inputs/rules/entry/object/state/index.ts +0 -4
  187. package/src/inputs/rules/overrides.ts +0 -4
  188. package/src/inputs/rules/preset.ts +0 -4
  189. package/src/inputs/rules.ts +0 -7
package/src/output.ts CHANGED
@@ -1,24 +1,24 @@
1
- import type { Input } from "./input";
1
+ import type { Input } from ".";
2
2
 
3
- interface Config {
4
- name: `linted/scope:${string}/rule:${string}+${string}`;
5
- rules: Input["rules"]["rules"]["html"][number][1];
6
- files: readonly string[];
7
- linterOptions: {
8
- noInlineConfig: true;
9
- reportUnusedDisableDirectives: "error";
10
- };
11
- languageOptions: {
12
- sourceType?:
13
- | "module"
14
- | "script";
15
- ecmaVersion?: "latest";
16
- globals?: Record<string, true>;
17
- parser?: unknown;
18
- parserOptions?: Record<string, unknown>;
19
- };
20
- plugins: Record<string, Record<"configs", unknown>>;
21
- processor?: string;
22
- }
23
-
24
- export type Output = Config[];
3
+ export type Output = (
4
+ {
5
+ name: `linted/${string}`;
6
+ rules: Input["rules"]["rules"]["html"][number][1];
7
+ files: string[];
8
+ linterOptions: {
9
+ noInlineConfig: true;
10
+ reportUnusedDisableDirectives: "error";
11
+ };
12
+ languageOptions: {
13
+ sourceType?:
14
+ | "module"
15
+ | "script";
16
+ ecmaVersion?: "latest";
17
+ globals?: Table<true>;
18
+ parser?: unknown;
19
+ parserOptions?: Record<string, unknown>; // TODO: Change to Table<unknown> after lib update
20
+ };
21
+ plugins: Table<Record<"configs", unknown>>;
22
+ processor?: string;
23
+ }
24
+ )[];
package/src/scopes.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type Scope = typeof scopes[number];
1
2
  export const scopes = [
2
3
  "js",
3
4
  "ts",
@@ -9,4 +10,3 @@ export const scopes = [
9
10
  "yml",
10
11
  "md",
11
12
  ] as const;
12
- export type Scope = (typeof scopes)[number];
package/tsconfig.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
- "display": "@jimbojet/tsc",
2
+ "display": "jimmy/tsc",
3
+ "version": "5.6.2",
4
+ "help": "https://www.typescriptlang.org/tsconfig/#quick-nav-Top%20Level",
3
5
  "$schema": "https://json.schemastore.org/tsconfig",
4
- "_version": "5.6.1-core.0",
5
6
  "include": [
6
7
  "*.config.ts",
7
8
  "src/**/*.ts",
@@ -10,8 +11,6 @@
10
11
  ],
11
12
  "exclude": [],
12
13
  "compilerOptions": {
13
- /* http://aka.ms/tsconfig#quick-nav-Top%20Level */
14
-
15
14
  // #region TYPE CHECKING
16
15
  "allowUnreachableCode": false,
17
16
  "allowUnusedLabels": false,
@@ -118,11 +117,11 @@
118
117
  "es2023",
119
118
  /* {CONFIGURE} */
120
119
  ],
121
- "moduleDetection": "force",
120
+ // "moduleDetection": "auto",
122
121
  // "noLib": true,
123
122
  // "reactNamespace": "",
124
123
  "target": "es2022",
125
- "useDefineForClassFields": true,
124
+ // "useDefineForClassFields": true /* @default: target > es2022 : true; else : false*/,
126
125
  // #endregion
127
126
 
128
127
 
@@ -1,3 +0,0 @@
1
- import type globals from "globals";
2
-
3
- export type Globals = keyof typeof globals & "mocha";
@@ -1 +0,0 @@
1
- export type Ecma = "latest";
@@ -1 +0,0 @@
1
- export type Source = "module" | "script";
@@ -1,4 +0,0 @@
1
- export interface Linter {
2
- noInlineConfig: true;
3
- reportUnusedDisableDirectives: "error";
4
- }
@@ -1 +0,0 @@
1
- export type Plugins<PluginId extends string> = Record<literalful<PluginId>, { configs: unknown }>;
@@ -1,41 +0,0 @@
1
- import type { Input } from "@eslinted/core";
2
- import type { Scope } from "@eslinted/core";
3
- import { Rule } from "./rule";
4
-
5
- export { Rule };
6
- export class Ruleset<S extends Scope> {
7
- public readonly ruleset: readonly Rule[];
8
- public overrides: Null<Rule> = null;
9
-
10
- constructor(private readonly scope: literalful<S>, ...rules: readonly Rule[]) {
11
- try {
12
- this.ruleset = [...rules];
13
- }
14
- catch (e) { throw new Error(`linted.factory.Ruleset`, { cause: e }); }
15
- }
16
-
17
- public get id() {
18
- const { scope } = this;
19
-
20
- return scope;
21
- }
22
-
23
- public get records() {
24
- try {
25
- const { ruleset, overrides } = this;
26
-
27
- return [
28
- ...ruleset.map(rules => [rules.id, rules.rules] as const),
29
- ...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
30
- ];
31
- }
32
- catch (e) { throw new Error(`linted.factory.Ruleset: records`, { cause: e }); }
33
- }
34
-
35
- public override(overrides: undefined | Input["rules"]["rules"][Scope][number][1]) {
36
- if (typeof overrides !== "undefined")
37
- this.overrides = new Rule("override", overrides);
38
-
39
- return this;
40
- }
41
- }
@@ -1,8 +0,0 @@
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,16 +0,0 @@
1
- import type { Input } from "@eslinted/core";
2
- import type { Scope } from "@eslinted/core";
3
- import { Ruleset, Rule } from "./ruleset";
4
-
5
- export class Rulesets {
6
- constructor(private readonly input: Input["rules"]) {}
7
-
8
- public ruleset<S extends Scope>(scope: literalful<S>): Ruleset<S> {
9
- try {
10
- const { rules, overrides } = this.input;
11
-
12
- return new Ruleset<S>(scope, ...rules[scope].map(args => new Rule(...args))).override(overrides[scope]);
13
- }
14
- catch (e) { throw new Error(`linted.factory.Rulesets/ruleset/scope:${scope}`, { cause: e }); }
15
- }
16
- }
package/src/input.ts DELETED
@@ -1,11 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- import type { Scope } from "@eslinted/core";
2
-
3
- export type Base = Readonly<Record<Scope, readonly string[]>>;
@@ -1,3 +0,0 @@
1
- import type { Base } from "./base";
2
-
3
- export type Includes = Partial<Base>;
@@ -1,7 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export type { Plugins } from "./imports/plugins";
2
- export type { Parsers } from "./imports/parsers";
@@ -1,3 +0,0 @@
1
- import type { Parsers as Imports } from "./imports/parsers";
2
-
3
- export type Parsers = Readonly<Record<Imports, unknown>>;
@@ -1,3 +0,0 @@
1
- import type { Plugins as Imports } from "./imports/plugins";
2
-
3
- export type Plugins = Readonly<Record<Imports, { configs: unknown }>>;
@@ -1,3 +0,0 @@
1
- import type { RuleRecord } from "./object";
2
-
3
- export type RuleEntry = readonly [string, RuleRecord];
@@ -1,7 +0,0 @@
1
- import type { State } from "./state";
2
-
3
- export type RuleRecord = Readonly<Record<
4
- string,
5
- | State
6
- | readonly [State, ...unknown[]]
7
- >>;
@@ -1,4 +0,0 @@
1
- export type State =
2
- | "error"
3
- | "warn"
4
- | "off";
@@ -1,4 +0,0 @@
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]>>>;
@@ -1,4 +0,0 @@
1
- import type { Scope } from "@eslinted/core";
2
- import type { RuleEntry } from "./entry";
3
-
4
- export type Preset = Readonly<Record<Scope, readonly RuleEntry[]>>;
@@ -1,7 +0,0 @@
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
- }