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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. package/dist/factory/index.d.ts +230 -2
  2. package/dist/factory/index.d.ts.map +1 -1
  3. package/dist/factory/index.js +65 -2
  4. package/dist/factory/index.js.map +1 -1
  5. package/dist/factory/{settings/scopes → scopes}/html.d.ts +1 -1
  6. package/dist/factory/scopes/html.d.ts.map +1 -0
  7. package/dist/factory/{settings/scopes → scopes}/html.js +1 -1
  8. package/dist/factory/scopes/html.js.map +1 -0
  9. package/dist/factory/{settings/scopes → scopes}/js.d.ts +1 -1
  10. package/dist/factory/scopes/js.d.ts.map +1 -0
  11. package/dist/factory/{settings/scopes → scopes}/js.js +1 -1
  12. package/dist/factory/scopes/js.js.map +1 -0
  13. package/dist/factory/{settings/scopes → scopes}/json.d.ts +1 -1
  14. package/dist/factory/scopes/json.d.ts.map +1 -0
  15. package/dist/factory/{settings/scopes → scopes}/json.js +1 -1
  16. package/dist/factory/scopes/json.js.map +1 -0
  17. package/dist/factory/{settings/scopes → scopes}/jsonc.d.ts +1 -1
  18. package/dist/factory/scopes/jsonc.d.ts.map +1 -0
  19. package/dist/factory/{settings/scopes → scopes}/jsonc.js +1 -1
  20. package/dist/factory/scopes/jsonc.js.map +1 -0
  21. package/dist/factory/{settings/scopes → scopes}/mocha.d.ts +1 -1
  22. package/dist/factory/scopes/mocha.d.ts.map +1 -0
  23. package/dist/factory/{settings/scopes → scopes}/mocha.js +1 -1
  24. package/dist/factory/scopes/mocha.js.map +1 -0
  25. package/dist/factory/{settings/setting.d.ts → scopes/setting/index.d.ts} +2 -2
  26. package/dist/factory/{settings/setting.d.ts.map → scopes/setting/index.d.ts.map} +1 -1
  27. package/dist/factory/{settings/setting.js → scopes/setting/index.js} +1 -1
  28. package/dist/factory/scopes/setting/index.js.map +1 -0
  29. package/dist/factory/{settings/scopes → scopes}/svelte.d.ts +1 -1
  30. package/dist/factory/scopes/svelte.d.ts.map +1 -0
  31. package/dist/factory/{settings/scopes → scopes}/svelte.js +1 -1
  32. package/dist/factory/scopes/svelte.js.map +1 -0
  33. package/dist/factory/{settings/scopes → scopes}/ts.d.ts +1 -1
  34. package/dist/factory/scopes/ts.d.ts.map +1 -0
  35. package/dist/factory/{settings/scopes → scopes}/ts.js +1 -1
  36. package/dist/factory/scopes/ts.js.map +1 -0
  37. package/dist/factory/{settings/scopes → scopes}/yml.d.ts +1 -1
  38. package/dist/factory/scopes/yml.d.ts.map +1 -0
  39. package/dist/factory/{settings/scopes → scopes}/yml.js +1 -1
  40. package/dist/factory/scopes/yml.js.map +1 -0
  41. package/dist/factory/{settings/index.d.ts → settings.d.ts} +1 -2
  42. package/dist/factory/settings.d.ts.map +1 -0
  43. package/dist/factory/{settings/index.js → settings.js} +1 -1
  44. package/dist/factory/settings.js.map +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +3 -12
  47. package/dist/index.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/factory/index.ts +104 -2
  50. package/src/factory/{settings/scopes → scopes}/html.ts +1 -1
  51. package/src/factory/{settings/scopes → scopes}/js.ts +1 -1
  52. package/src/factory/{settings/scopes → scopes}/json.ts +1 -1
  53. package/src/factory/{settings/scopes → scopes}/jsonc.ts +1 -1
  54. package/src/factory/{settings/scopes → scopes}/mocha.ts +1 -1
  55. package/src/factory/{settings/setting.ts → scopes/setting/index.ts} +1 -1
  56. package/src/factory/{settings/scopes → scopes}/svelte.ts +1 -1
  57. package/src/factory/{settings/scopes → scopes}/ts.ts +1 -1
  58. package/src/factory/{settings/scopes → scopes}/yml.ts +1 -1
  59. package/src/factory/{settings/index.ts → settings.ts} +0 -1
  60. package/src/index.ts +3 -13
  61. package/dist/factory/factory.d.ts +0 -231
  62. package/dist/factory/factory.d.ts.map +0 -1
  63. package/dist/factory/factory.js +0 -65
  64. package/dist/factory/factory.js.map +0 -1
  65. package/dist/factory/settings/index.d.ts.map +0 -1
  66. package/dist/factory/settings/index.js.map +0 -1
  67. package/dist/factory/settings/scopes/html.d.ts.map +0 -1
  68. package/dist/factory/settings/scopes/html.js.map +0 -1
  69. package/dist/factory/settings/scopes/js.d.ts.map +0 -1
  70. package/dist/factory/settings/scopes/js.js.map +0 -1
  71. package/dist/factory/settings/scopes/json.d.ts.map +0 -1
  72. package/dist/factory/settings/scopes/json.js.map +0 -1
  73. package/dist/factory/settings/scopes/jsonc.d.ts.map +0 -1
  74. package/dist/factory/settings/scopes/jsonc.js.map +0 -1
  75. package/dist/factory/settings/scopes/mocha.d.ts.map +0 -1
  76. package/dist/factory/settings/scopes/mocha.js.map +0 -1
  77. package/dist/factory/settings/scopes/svelte.d.ts.map +0 -1
  78. package/dist/factory/settings/scopes/svelte.js.map +0 -1
  79. package/dist/factory/settings/scopes/ts.d.ts.map +0 -1
  80. package/dist/factory/settings/scopes/ts.js.map +0 -1
  81. package/dist/factory/settings/scopes/yml.d.ts.map +0 -1
  82. package/dist/factory/settings/scopes/yml.js.map +0 -1
  83. package/dist/factory/settings/setting.js.map +0 -1
  84. package/src/factory/factory.ts +0 -103
@@ -1,103 +0,0 @@
1
- import type { ScopeSettings } from "./settings";
2
- import type { Input } from "../interface/input";
3
-
4
- export class Factory {
5
- public readonly common;
6
- public readonly scopes;
7
-
8
- constructor(
9
- public readonly parsers: Input["imports"]["parsers"],
10
- {
11
- settings: defaultSettings,
12
- files: defaultFiles,
13
- ignores: defaultIgnores,
14
- rules: defaultRules,
15
- }: Input["defaults"],
16
- { "*": commonExtension = {}, ...scopeExtensions }: Input["extensions"] = {} as const,
17
- ) {
18
- const {
19
- noInlineConfig = defaultSettings.noInlineConfig,
20
- reportUnusedDisableDirectives = defaultSettings.reportUnusedDisableDirectives,
21
- sourceType = defaultSettings.sourceType,
22
- ecmaVersion = defaultSettings.ecmaVersion,
23
- ignores = [] as const,
24
- override = false,
25
- } = commonExtension;
26
-
27
- this.common = {
28
- settings: {
29
- name: "linted/*/settings",
30
- linterOptions: { noInlineConfig, reportUnusedDisableDirectives } as const,
31
- languageOptions: { sourceType, ecmaVersion } as const,
32
- } as const,
33
- ignores: {
34
- name: "linted/*/ignores",
35
- ignores: [
36
- ...override ? [] as const : defaultIgnores["*"],
37
- ...ignores,
38
- ] as const,
39
- } as const,
40
- } as const;
41
- this.scopes = {
42
- files: defaultFiles,
43
- ignores: defaultIgnores,
44
- rules: defaultRules,
45
- } as const;
46
-
47
- for (const s in scopeExtensions) {
48
- const {
49
- [s as keyof typeof scopeExtensions]: {
50
- files: moreFiles = [],
51
- ignores: moreIgnores = [],
52
- rules: moreRules = null,
53
- } = {} as const,
54
- } = scopeExtensions;
55
-
56
- this.scopes.files[s as keyof typeof scopeExtensions].push(...moreFiles);
57
- this.scopes.ignores[s as keyof typeof scopeExtensions].push(...moreIgnores);
58
-
59
- if (moreRules !== null)
60
- this.scopes.rules[s as keyof typeof scopeExtensions].push([`${s}:override`, moreRules]);
61
- }
62
- }
63
-
64
- public scope<S extends keyof typeof ScopeSettings>(scope: S, settings: InstanceType<typeof ScopeSettings[S]>) {
65
- const {
66
- files: {
67
- [scope]: files,
68
- },
69
- ignores: { [scope]: ignores },
70
- rules: { [scope]: rules },
71
- } = this.scopes,
72
- ruleset = rules.map(([id, rules]) => ({ id: `${scope}:${id}`, rules } as const)),
73
- { languageOptions, parserOptions } = settings,
74
- loadedLanguageOptions = {
75
- ...languageOptions,
76
- ..."parserOptions" in parserOptions
77
- ? {
78
- parserOptions: {
79
- ...parserOptions.parserOptions,
80
- ..."parser" in parserOptions.parserOptions
81
- ? { parser: this.parsers[parserOptions.parserOptions.parser] } as const
82
- : {} as const,
83
- } as const,
84
- } as const
85
- : {} as const,
86
- ..."parser" in languageOptions
87
- ? { parser: this.parsers[languageOptions.parser] } as const
88
- : {} as const,
89
- } as const;
90
-
91
- return files.length < 1
92
- ? [] as const
93
- : ruleset.map(({ id, rules }) => ({
94
- name: `linted/${id}`,
95
- files,
96
- ignores,
97
- rules,
98
- languageOptions: loadedLanguageOptions,
99
- ...settings.processor,
100
- ...settings.language,
101
- } as const));
102
- }
103
- }