@alint-js/config 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,16 @@
1
- import { AlintConfig, AlintConfig as AlintConfig$1, ModelSize, ProviderDefinition, ProviderType, RunnerConfig, SetupConfig, SetupConfig as SetupConfig$1, SetupModelDefinition } from "@alint-js/core";
1
+ import { AlintConfig, AlintConfig as AlintConfig$1, ModelSize, ProviderDefinition, ProviderType, RunnerConfig, RunnerStatsConfig, SetupConfig, SetupConfig as SetupConfig$1, SetupModelDefinition } from "@alint-js/core";
2
2
 
3
3
  //#region src/config/load.d.ts
4
4
  declare function loadAlintConfig(cwd: string, configFile?: string): Promise<AlintConfig$1>;
5
5
  //#endregion
6
+ //#region src/ignore-patterns.d.ts
7
+ declare const ignorePatternsEslintDefaults: readonly ["**/node_modules/**", ".git/**", "**/.git/**"];
8
+ declare const ignorePatternsBuildOutputs: readonly ["**/dist/**", "**/coverage/**", "**/output/**", "**/.output/**", "**/.next/**", "**/.nuxt/**", "**/.svelte-kit/**", "**/.vercel/**"];
9
+ declare const ignorePatternsCaches: readonly ["**/.cache/**", "**/.temp/**", "**/.tmp/**", "**/temp/**", "**/tmp/**", "**/.vitepress/cache/**", "**/.vite-inspect/**"];
10
+ declare const ignorePatternsGenerated: readonly ["**/CHANGELOG*.md", "**/LICENSE*", "**/*.min.*", "**/__snapshots__/**", "**/components.d.ts"];
11
+ declare const ignorePatternsAIAgents: readonly ["**/.agents/**", "**/.claude/**"];
12
+ declare const ignorePatternsCommon: readonly ["**/node_modules/**", ".git/**", "**/.git/**", "**/dist/**", "**/coverage/**", "**/output/**", "**/.output/**", "**/.next/**", "**/.nuxt/**", "**/.svelte-kit/**", "**/.vercel/**", "**/.cache/**", "**/.temp/**", "**/.tmp/**", "**/temp/**", "**/tmp/**", "**/.vitepress/cache/**", "**/.vite-inspect/**", "**/CHANGELOG*.md", "**/LICENSE*", "**/*.min.*", "**/__snapshots__/**", "**/components.d.ts"];
13
+ //#endregion
6
14
  //#region src/paths.d.ts
7
15
  interface GlobalSetupConfigPathOptions {
8
16
  isMacOS?: boolean;
@@ -10,6 +18,7 @@ interface GlobalSetupConfigPathOptions {
10
18
  }
11
19
  declare function getGlobalSetupConfigPath(env?: NodeJS.ProcessEnv, options?: GlobalSetupConfigPathOptions): string;
12
20
  declare function getProjectSetupConfigPath(cwd: string): string;
21
+ declare function getStatsDir(env?: NodeJS.ProcessEnv, options?: GlobalSetupConfigPathOptions): string;
13
22
  //#endregion
14
23
  //#region src/setup/load.d.ts
15
24
  declare const emptySetupConfig: SetupConfig$1;
@@ -23,4 +32,4 @@ declare function stringifySetupConfigToml(config: SetupConfig$1): string;
23
32
  //#region src/setup/write.d.ts
24
33
  declare function writeSetupConfig(filePath: string, config: SetupConfig$1): Promise<void>;
25
34
  //#endregion
26
- export { type AlintConfig, type GlobalSetupConfigPathOptions, type ModelSize, type ProviderDefinition, type ProviderType, type RunnerConfig, type SetupConfig, type SetupModelDefinition, emptySetupConfig, getGlobalSetupConfigPath, getProjectSetupConfigPath, loadAlintConfig, loadSetupConfig, mergeSetupConfigs, parseSetupConfigToml, stringifySetupConfigToml, writeSetupConfig };
35
+ export { type AlintConfig, type GlobalSetupConfigPathOptions, type ModelSize, type ProviderDefinition, type ProviderType, type RunnerConfig, type RunnerStatsConfig, type SetupConfig, type SetupModelDefinition, emptySetupConfig, getGlobalSetupConfigPath, getProjectSetupConfigPath, getStatsDir, ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated, loadAlintConfig, loadSetupConfig, mergeSetupConfigs, parseSetupConfigToml, stringifySetupConfigToml, writeSetupConfig };
package/dist/index.mjs CHANGED
@@ -17,13 +17,59 @@ async function loadAlintConfig(cwd, configFile) {
17
17
  return result.config ?? [];
18
18
  }
19
19
  //#endregion
20
+ //#region src/ignore-patterns.ts
21
+ const ignorePatternsEslintDefaults = [
22
+ "**/node_modules/**",
23
+ ".git/**",
24
+ "**/.git/**"
25
+ ];
26
+ const ignorePatternsBuildOutputs = [
27
+ "**/dist/**",
28
+ "**/coverage/**",
29
+ "**/output/**",
30
+ "**/.output/**",
31
+ "**/.next/**",
32
+ "**/.nuxt/**",
33
+ "**/.svelte-kit/**",
34
+ "**/.vercel/**"
35
+ ];
36
+ const ignorePatternsCaches = [
37
+ "**/.cache/**",
38
+ "**/.temp/**",
39
+ "**/.tmp/**",
40
+ "**/temp/**",
41
+ "**/tmp/**",
42
+ "**/.vitepress/cache/**",
43
+ "**/.vite-inspect/**"
44
+ ];
45
+ const ignorePatternsGenerated = [
46
+ "**/CHANGELOG*.md",
47
+ "**/LICENSE*",
48
+ "**/*.min.*",
49
+ "**/__snapshots__/**",
50
+ "**/components.d.ts"
51
+ ];
52
+ const ignorePatternsAIAgents = ["**/.agents/**", "**/.claude/**"];
53
+ const ignorePatternsCommon = [
54
+ ...ignorePatternsEslintDefaults,
55
+ ...ignorePatternsBuildOutputs,
56
+ ...ignorePatternsCaches,
57
+ ...ignorePatternsGenerated
58
+ ];
59
+ //#endregion
20
60
  //#region src/paths.ts
21
61
  function getGlobalSetupConfigPath(env = process.env, options = {}) {
22
- return join(env.XDG_CONFIG_HOME ?? resolveDefaultConfigHome(options), "alint", "config.toml");
62
+ return join(resolveAlintHome(env, options), "config.toml");
23
63
  }
24
64
  function getProjectSetupConfigPath(cwd) {
25
65
  return join(cwd, ".alint", "config.toml");
26
66
  }
67
+ function getStatsDir(env = process.env, options = {}) {
68
+ return join(resolveAlintHome(env, options), "stats");
69
+ }
70
+ function resolveAlintHome(env, options) {
71
+ return join(env.XDG_CONFIG_HOME ?? resolveDefaultConfigHome(options), "alint");
72
+ }
27
73
  function resolveDefaultConfigHome(options) {
28
74
  if (options.isMacOS ?? process.platform === "darwin") return join(homedir(), ".config");
29
75
  return options.xdgConfig ?? xdgConfig ?? join(homedir(), ".config");
@@ -97,6 +143,7 @@ function parseRunner(runner) {
97
143
  if (runner.cache !== void 0) parsedRunner.cache = parseRunnerCache(runner.cache);
98
144
  if (runner.file_concurrency !== void 0) parsedRunner.fileConcurrency = parsePositiveInteger(runner.file_concurrency, "runner file_concurrency");
99
145
  if (runner.rule_concurrency !== void 0) parsedRunner.ruleConcurrency = parsePositiveInteger(runner.rule_concurrency, "runner rule_concurrency");
146
+ if (runner.stats !== void 0) parsedRunner.stats = parseRunnerStats(runner.stats);
100
147
  if (runner.timeout_ms !== void 0) parsedRunner.timeoutMs = parsePositiveInteger(runner.timeout_ms, "runner timeout_ms");
101
148
  return parsedRunner;
102
149
  }
@@ -112,6 +159,19 @@ function parseRunnerCache(cache) {
112
159
  if (tomlCache.location !== void 0) parsedCache.location = readNonEmptyString(tomlCache.location, "runner cache location");
113
160
  return parsedCache;
114
161
  }
162
+ function parseRunnerStats(stats) {
163
+ if (typeof stats === "boolean") return stats;
164
+ if (!isPlainObject(stats)) throw new TypeError("Invalid runner stats: must be a boolean or an object.");
165
+ const tomlStats = stats;
166
+ const parsedStats = {};
167
+ if (tomlStats.enabled !== void 0) {
168
+ if (typeof tomlStats.enabled !== "boolean") throw new TypeError("Invalid runner stats enabled: must be a boolean.");
169
+ parsedStats.enabled = tomlStats.enabled;
170
+ }
171
+ if (tomlStats.location !== void 0) parsedStats.location = readNonEmptyString(tomlStats.location, "runner stats location");
172
+ if (tomlStats.retention_months !== void 0) parsedStats.retentionMonths = parsePositiveInteger(tomlStats.retention_months, "runner stats retention_months");
173
+ return parsedStats;
174
+ }
115
175
  function readFiniteNumber(value, label) {
116
176
  if (typeof value !== "number" || !Number.isFinite(value)) throw new TypeError(`Invalid ${label}: must be a finite number.`);
117
177
  return value;
@@ -163,12 +223,21 @@ function toTomlRunner(runner) {
163
223
  cache: toTomlRunnerCache(runner.cache),
164
224
  file_concurrency: runner.fileConcurrency,
165
225
  rule_concurrency: runner.ruleConcurrency,
226
+ stats: toTomlRunnerStats(runner.stats),
166
227
  timeout_ms: runner.timeoutMs
167
228
  };
168
229
  }
169
230
  function toTomlRunnerCache(cache) {
170
231
  return cache;
171
232
  }
233
+ function toTomlRunnerStats(stats) {
234
+ if (stats === void 0 || typeof stats === "boolean") return stats;
235
+ return {
236
+ enabled: stats.enabled,
237
+ location: stats.location,
238
+ retention_months: stats.retentionMonths
239
+ };
240
+ }
172
241
  //#endregion
173
242
  //#region src/setup/load.ts
174
243
  const emptySetupConfig = {
@@ -277,4 +346,4 @@ async function writeSetupConfig(filePath, config) {
277
346
  await writeFile(filePath, stringifySetupConfigToml(config), "utf8");
278
347
  }
279
348
  //#endregion
280
- export { emptySetupConfig, getGlobalSetupConfigPath, getProjectSetupConfigPath, loadAlintConfig, loadSetupConfig, mergeSetupConfigs, parseSetupConfigToml, stringifySetupConfigToml, writeSetupConfig };
349
+ export { emptySetupConfig, getGlobalSetupConfigPath, getProjectSetupConfigPath, getStatsDir, ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated, loadAlintConfig, loadSetupConfig, mergeSetupConfigs, parseSetupConfigToml, stringifySetupConfigToml, writeSetupConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/config",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.0.10",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -17,7 +17,7 @@
17
17
  "pathe": "^2.0.3",
18
18
  "smol-toml": "^1.7.0",
19
19
  "xdg-basedir": "^5.1.0",
20
- "@alint-js/core": "0.0.8"
20
+ "@alint-js/core": "0.0.10"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^26.0.1",