svelte-docinfo 0.5.1 → 0.5.2

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.
@@ -91,7 +91,7 @@ const dispatchOnDuplicates = (mode, duplicates, log) => {
91
91
  }
92
92
  mode(duplicates, errorLog);
93
93
  };
94
- // ── Result types ─────────────────────────────────────────────────────────────
94
+ // Result types
95
95
  /**
96
96
  * Result of `analyze`, `analyzeFromFiles`, and `AnalysisSession.query`.
97
97
  *
@@ -154,7 +154,7 @@ const toModuleJson = (raw) => {
154
154
  ...(raw.moduleComment ? { moduleComment: raw.moduleComment } : {}),
155
155
  });
156
156
  };
157
- // ── Module dispatch ──────────────────────────────────────────────────────────
157
+ // Module dispatch
158
158
  /**
159
159
  * Analyze a single non-Svelte source file and extract module metadata.
160
160
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- // ── Serialization ───────────────────────────────────────────────────────────
11
+ // Serialization
12
12
  /**
13
13
  * JSON replacer that strips Zod default values for compact serialization.
14
14
  *
@@ -44,7 +44,7 @@
44
44
  * ```
45
45
  */
46
46
  export const compactReplacer = (_key, value) => (Array.isArray(value) && value.length === 0) || value === false ? undefined : value;
47
- // ── Display Helpers ─────────────────────────────────────────────────────────
47
+ // Display Helpers
48
48
  /**
49
49
  * Format declaration or member name with generic parameters for display.
50
50
  *
@@ -133,7 +133,7 @@ const pascalCaseFromModulePath = (modulePath) => {
133
133
  .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
134
134
  .join('');
135
135
  };
136
- // ── Type Reference Helpers ─────────────────────────────────────────────────
136
+ // Type Reference Helpers
137
137
  /**
138
138
  * Escape special regex characters in a string.
139
139
  */
@@ -218,7 +218,7 @@ export const findTypeReferences = (typeString, declarationNames) => {
218
218
  }
219
219
  return refs;
220
220
  };
221
- // ── Narrowed Declaration Types ──────────────────────────────────────────────
221
+ // Narrowed Declaration Types
222
222
  /**
223
223
  * Narrow a declaration by kind for type-safe field access.
224
224
  *
@@ -134,8 +134,12 @@ export declare const isNodeBuiltin: (specifier: string) => boolean;
134
134
  * resolver instance share the cache scope (correct, since resolver state is
135
135
  * shared too).
136
136
  *
137
- * Falls back to appending `.svelte` when the bare specifier doesn't resolve —
138
- * lets `.svelte` imports work without polluting the consumer's tsconfig.
137
+ * `ts.resolveModuleName` cannot resolve real `.svelte` files (no compiler
138
+ * option teaches it the extension), so relative and absolute `.svelte`
139
+ * specifiers — with or without the extension written — fall back to manual
140
+ * filesystem resolution against `fromFile`. Non-relative `.svelte` specifiers
141
+ * (tsconfig `paths` aliases, package subpaths) stay unresolved; supply a
142
+ * custom `resolveImport` for those setups.
139
143
  *
140
144
  * @param compilerOptions - parsed tsconfig (from `loadTsconfig`)
141
145
  * @param projectRoot - absolute project root for the module-resolution cache
@@ -1 +1 @@
1
- {"version":3,"file":"dep-resolver.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dep-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,CAC7B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,KACZ,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC9B,uEAAuE;IACvE,OAAO,EAAE,eAAe,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,cAAc,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,OAAO,aAAa,GAAG,SAAS,KAC9B,cAAc,GAAG,SAC6E,CAAC;AAElG;;;;;GAKG;AAC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AAa,GAAG,SAAS,KAC9B,cAAc,GAAG,SAC6E,CAAC;AAElG;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,IAAI,CAErD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,KAAK,CAAC,MAAM,CAOxE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,KAAG,OAA+B,CAAC;AAElF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,GACjC,iBAAiB,EAAE,CAAC,eAAe,EACnC,aAAa,MAAM,KACjB,cAsBF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC7B,eAAe,eAAe,EAC9B,WAAU,MAAM,GAAG,MAA0B,KAC3C,cAGD,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,cAG5B,CAAC"}
@@ -27,8 +27,10 @@
27
27
  * @module
28
28
  */
29
29
  import { isBuiltin } from 'node:module';
30
+ import { dirname, isAbsolute, resolve as resolvePath } from 'node:path';
30
31
  import ts from 'typescript';
31
32
  import { init as esModuleLexerInit, parse as esModuleLexerParse } from 'es-module-lexer';
33
+ import { toPosixPath } from './paths.js';
32
34
  /**
33
35
  * Normalize the public `ResolveImport` union to an `ImportResolver`.
34
36
  *
@@ -92,8 +94,12 @@ export const isNodeBuiltin = (specifier) => isBuiltin(specifier);
92
94
  * resolver instance share the cache scope (correct, since resolver state is
93
95
  * shared too).
94
96
  *
95
- * Falls back to appending `.svelte` when the bare specifier doesn't resolve —
96
- * lets `.svelte` imports work without polluting the consumer's tsconfig.
97
+ * `ts.resolveModuleName` cannot resolve real `.svelte` files (no compiler
98
+ * option teaches it the extension), so relative and absolute `.svelte`
99
+ * specifiers — with or without the extension written — fall back to manual
100
+ * filesystem resolution against `fromFile`. Non-relative `.svelte` specifiers
101
+ * (tsconfig `paths` aliases, package subpaths) stay unresolved; supply a
102
+ * custom `resolveImport` for those setups.
97
103
  *
98
104
  * @param compilerOptions - parsed tsconfig (from `loadTsconfig`)
99
105
  * @param projectRoot - absolute project root for the module-resolution cache
@@ -104,12 +110,16 @@ export const createDefaultResolver = (compilerOptions, projectRoot) => {
104
110
  const result = ts.resolveModuleName(specifier, fromFile, compilerOptions, ts.sys, cache);
105
111
  if (result.resolvedModule)
106
112
  return result.resolvedModule.resolvedFileName;
107
- // Fallback: try with .svelte extension. ts.resolveModuleName doesn't
108
- // know about .svelte files unless explicitly configured.
109
- if (!specifier.endsWith('.svelte')) {
110
- const svelte = ts.resolveModuleName(specifier + '.svelte', fromFile, compilerOptions, ts.sys, cache);
111
- if (svelte.resolvedModule)
112
- return svelte.resolvedModule.resolvedFileName;
113
+ // ts.resolveModuleName never resolves real .svelte files — no compiler
114
+ // option teaches it the extension — so resolve relative/absolute
115
+ // specifiers manually, appending .svelte when it isn't written.
116
+ if (specifier.startsWith('./') || specifier.startsWith('../') || isAbsolute(specifier)) {
117
+ const withExt = specifier.endsWith('.svelte') ? specifier : specifier + '.svelte';
118
+ const candidate = isAbsolute(withExt) ? withExt : resolvePath(dirname(fromFile), withExt);
119
+ // posixified for parity with ts.resolveModuleName, which always
120
+ // returns forward-slash paths
121
+ if (ts.sys.fileExists(candidate))
122
+ return toPosixPath(candidate);
113
123
  }
114
124
  return null;
115
125
  };
@@ -58,7 +58,7 @@
58
58
  * @module
59
59
  */
60
60
  import { z } from 'zod';
61
- // ── Severity ─────────────────────────────────────────────────────────────────
61
+ // Severity
62
62
  /**
63
63
  * Diagnostic severity levels.
64
64
  *
@@ -66,7 +66,7 @@ import { z } from 'zod';
66
66
  * - `'warning'` — partial success, something seems off but analysis continued
67
67
  */
68
68
  export const DiagnosticSeverity = z.enum(['error', 'warning']);
69
- // ── Kind ─────────────────────────────────────────────────────────────────────
69
+ // Kind
70
70
  /**
71
71
  * Discriminant for `Diagnostic` variant types.
72
72
  */
@@ -86,7 +86,7 @@ export const DiagnosticKind = z.enum([
86
86
  'transform_failed',
87
87
  'resolver_failed',
88
88
  ]);
89
- // ── Variants ─────────────────────────────────────────────────────────────────
89
+ // Variants
90
90
  /**
91
91
  * Base diagnostic fields shared by every variant.
92
92
  *
@@ -339,7 +339,7 @@ export const Diagnostic = z.discriminatedUnion('kind', [
339
339
  TransformFailedDiagnostic,
340
340
  ResolverFailedDiagnostic,
341
341
  ]);
342
- // ── Helpers ────────────────────────────────────────────────────────────────
342
+ // Helpers
343
343
  /**
344
344
  * Check if any error-severity diagnostics were collected.
345
345
  */
package/dist/exports.js CHANGED
@@ -14,10 +14,10 @@ import { join, relative, resolve } from 'node:path';
14
14
  import { glob } from 'tinyglobby';
15
15
  import { toPosixPath } from './paths.js';
16
16
  import { MAX_FILE_CONCURRENCY, map_concurrent } from './concurrency.js';
17
- // ── Condition priority ───────────────────────────────────────────────────────
17
+ // Condition priority
18
18
  /** Priority order for selecting the condition to use for source mapping. */
19
19
  const CONDITION_PRIORITY = ['svelte', 'default', 'import', 'require'];
20
- // ── Parsing ──────────────────────────────────────────────────────────────────
20
+ // Parsing
21
21
  /**
22
22
  * Read and parse the exports field from package.json.
23
23
  *
@@ -85,7 +85,7 @@ const flattenConditions = (value, prefix) => {
85
85
  }
86
86
  return null;
87
87
  };
88
- // ── Source mapping ───────────────────────────────────────────────────────────
88
+ // Source mapping
89
89
  /**
90
90
  * Map a dist file path to its source file path.
91
91
  *
@@ -131,7 +131,7 @@ export const mapDistToSource = (distPath, condition, options) => {
131
131
  }
132
132
  return sourceBase;
133
133
  };
134
- // ── Discovery ────────────────────────────────────────────────────────────────
134
+ // Discovery
135
135
  /**
136
136
  * Select the best condition for source mapping from an export entry.
137
137
  */
package/dist/index.js CHANGED
@@ -8,22 +8,22 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- // ── Core entry points ───────────────────────────────────────────────────────
11
+ // Core entry points
12
12
  export { analyze, analyzeFromFiles } from './analyze.js';
13
13
  export { throwOnDuplicates, AnalyzeResultJson } from './analyze-core.js';
14
14
  export { createAnalysisSession } from './session.js';
15
15
  export { normalizeResolveImport } from './dep-resolver.js';
16
- // ── Types (Zod schemas + TypeScript interfaces) ─────────────────────────────
16
+ // Types (Zod schemas + TypeScript interfaces)
17
17
  export { DeclarationKind, DeclarationModifier, MemberKind, Reactivity, GenericParamJson, ParameterJson, ComponentPropJson, OverloadJson, FunctionMemberJson, VariableMemberJson, ConstructorMemberJson, MemberJson, FunctionDeclarationJson, ClassDeclarationJson, InterfaceDeclarationJson, TypeDeclarationJson, VariableDeclarationJson, EnumDeclarationJson, ComponentDeclarationJson, SnippetDeclarationJson, NamespaceDeclarationJson, DeclarationJson, ReExportJson, ExternalReExportJson, ModuleJson, } from './types.js';
18
- // ── Declaration helpers ────────────────────────────────────────────────────
18
+ // Declaration helpers
19
19
  export { getDisplayName, generateImport, compactReplacer, isKind, findTypeReferences, buildTypeReferencePatterns, } from './declaration-helpers.js';
20
- // ── Source options ──────────────────────────────────────────────────────────
20
+ // Source options
21
21
  export { createSourceOptions, DEFAULT_SOURCE_OPTIONS } from './source-config.js';
22
- // ── Post-processing ────────────────────────────────────────────────────────
22
+ // Post-processing
23
23
  export { findDuplicates, mergeReExports, resolveComponentAliases, resolveExportSurface, } from './postprocess.js';
24
- // ── File system constants ──────────────────────────────────────────────────
24
+ // File system constants
25
25
  export { deriveIncludePatterns } from './files.js';
26
- // ── File discovery ──────────────────────────────────────────────────────────
26
+ // File discovery
27
27
  export { discoverSourceFiles } from './discovery.js';
28
- // ── Diagnostics ─────────────────────────────────────────────────────────────
28
+ // Diagnostics
29
29
  export { hasErrors, hasWarnings, errorsOf, warningsOf, byKind, formatDiagnostic, DiagnosticSeverity, DiagnosticKind, Diagnostic, } from './diagnostics.js';
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/session.ts"],"names":[],"m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AAC,cAAc,CAAC,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/F,0DAA0D;IAC1D,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,mEAAmE;IACnE,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,4EAA4E;IAC5E,IAAI,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9B;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC;IAC9C;;;;;;;;OAQG;IACH,oBAAoB,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1C;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CACnD,8BAA8B,EAC9B,aAAa,GAAG,cAAc,CAC9B;IACA;;;;;;;;;OASG;IACH,aAAa,EAAE,mBAAmB,CAAC;IACnC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,kDAAkD;IAClD,GAAG,CAAC,EAAE,WAAW,CAAC;CAClB;AA+FD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB,KAAG,eAsdvE,CAAC"}
package/dist/session.js CHANGED
@@ -133,7 +133,7 @@ export const createAnalysisSession = (options) => {
133
133
  return sessionDefaultResolver;
134
134
  return getDefaultResolver();
135
135
  };
136
- // ── Phase 1: sync per-file transform/lex ─────────────────────────────────
136
+ // Phase 1: sync per-file transform/lex
137
137
  // `resolver` is `null` when the entire batch is pre-resolved — phase 1
138
138
  // needs no resolver identity in that case, and skipping `pickResolver`
139
139
  // avoids constructing the lazy default for fully pre-resolved consumers.
@@ -231,7 +231,7 @@ export const createAnalysisSession = (options) => {
231
231
  preResolvedDeps: usePreResolved ? preResolvedDeps : undefined,
232
232
  };
233
233
  };
234
- // ── Phase 3: serial per-file LS push + entry write ───────────────────────
234
+ // Phase 3: serial per-file LS push + entry write
235
235
  const phase3 = (pending, resolved) => {
236
236
  if (pending.cacheHit) {
237
237
  // Cached SetFileResult: same diagnostics array reference, changed: false.
@@ -247,13 +247,16 @@ export const createAnalysisSession = (options) => {
247
247
  // Build `unfilteredDeps` from one of two sources:
248
248
  // pre-resolved → caller's `file.dependencies`, posixified + filtered
249
249
  // lex+resolve → resolver task outputs, already posixified, filtered
250
- const unfilteredDeps = [];
250
+ // The Set dedupes in first-occurrence order — multiple statements
251
+ // importing the same module (or a duplicate caller-declared edge) are
252
+ // one edge.
253
+ const depSet = new Set();
251
254
  if (pending.preResolvedDeps !== undefined) {
252
255
  for (const raw of pending.preResolvedDeps) {
253
256
  const posix = toPosixPath(raw);
254
257
  if (!isSource(posix, sourceOptions))
255
258
  continue;
256
- unfilteredDeps.push(posix);
259
+ depSet.add(posix);
257
260
  }
258
261
  }
259
262
  else {
@@ -262,9 +265,10 @@ export const createAnalysisSession = (options) => {
262
265
  continue;
263
266
  if (!isSource(r, sourceOptions))
264
267
  continue;
265
- unfilteredDeps.push(r);
268
+ depSet.add(r);
266
269
  }
267
270
  }
271
+ const unfilteredDeps = [...depSet];
268
272
  // Build a mode-specific entry. The discriminator (`mode`) tags which
269
273
  // cache-key field to read on the next ingest: `resolverIdentity` for
270
274
  // lex+resolve, `preResolvedDepsSnapshot` for pre-resolved. Snapshot
@@ -310,7 +314,7 @@ export const createAnalysisSession = (options) => {
310
314
  }
311
315
  return { changed: true, diagnostics: [...pending.ingestDiagnostics] };
312
316
  };
313
- // ── setFiles: orchestrate three phases ───────────────────────────────────
317
+ // setFiles: orchestrate three phases
314
318
  const setFiles = async (files, opts) => {
315
319
  await ensureLexerReady();
316
320
  // Resolver gating: pick one only if any file in the batch lacks
package/dist/svelte.js CHANGED
@@ -464,7 +464,7 @@ const extractPropsMetadata = (virtualSource) => {
464
464
  visit(virtualSource);
465
465
  return { bindableProps, propsDefaults, propsTypeName };
466
466
  };
467
- // ── Snippet Detection ──────────────────────────────────────────────────────
467
+ // Snippet Detection
468
468
  /**
469
469
  * Check if a type string represents a `Snippet` type.
470
470
  *
@@ -535,7 +535,7 @@ export const synthesizeSnippetTypeSignature = (parameters) => {
535
535
  const inner = parameters.map((p) => `${p.name}: ${p.type}`).join(', ');
536
536
  return `Snippet<[${inner}]>`;
537
537
  };
538
- // ── Checker-Backed Analysis ─────────────────────────────────────────────────
538
+ // Checker-Backed Analysis
539
539
  /**
540
540
  * Check if a symbol name is an internal svelte2tsx identifier.
541
541
  *
package/dist/types.js CHANGED
@@ -304,7 +304,7 @@ const functionLikeFields = {
304
304
  ...callableFields,
305
305
  ...returnFields,
306
306
  };
307
- // ── MemberJson Variants ────────────────────────────────────────────────────
307
+ // MemberJson Variants
308
308
  /**
309
309
  * A function member (method, call signature, method signature).
310
310
  * Has `parameters`, `returnType`, `returnDescription`, `overloads`.
@@ -380,7 +380,7 @@ export const ConstructorMemberJson = z.strictObject({
380
380
  * Nesting is exactly one level deep — members never contain their own members.
381
381
  */
382
382
  export const MemberJson = z.discriminatedUnion('kind', [FunctionMemberJson, VariableMemberJson, ConstructorMemberJson]);
383
- // ── DeclarationJson Variants ────────────────────────────────────────────────
383
+ // DeclarationJson Variants
384
384
  /** Top-level-only fields shared by all `DeclarationJson` variants. */
385
385
  const declarationTopLevelFields = {
386
386
  /**
package/dist/vite.js CHANGED
@@ -71,7 +71,7 @@ const svelteDocinfo = (options = {}) => {
71
71
  // runs at cold start). Tracked here because the session has no concept of
72
72
  // "discovery" — it ingests files the plugin hands to it.
73
73
  let discoveryDiagnostics = [];
74
- // ── Resolver wiring ──────────────────────────────────────────────────────
74
+ // Resolver wiring
75
75
  // Dev resolver: server.pluginContainer.resolveId. Stable identity across
76
76
  // the dev session — cache hits work across HMR cycles.
77
77
  const viteDevResolver = {
@@ -86,7 +86,7 @@ const svelteDocinfo = (options = {}) => {
86
86
  },
87
87
  identity: VITE_DEV_IDENTITY,
88
88
  };
89
- // ── In-flight analysis tracking ─────────────────────────────────────────
89
+ // In-flight analysis tracking
90
90
  // Initial analysis runs once in buildStart; HMR flushes run on debounce.
91
91
  // `load()` awaits both so we never serve stale JSON to a freshly-importing
92
92
  // module.
@@ -182,7 +182,7 @@ const svelteDocinfo = (options = {}) => {
182
182
  log.error(`[svelte-docinfo] ${message}`);
183
183
  };
184
184
  const isWatchedFile = (file) => isSource(file, resolvedSourceOptions);
185
- // ── Initial analysis (cold start in buildStart) ──────────────────────────
185
+ // Initial analysis (cold start in buildStart)
186
186
  const runInitialAnalysis = async () => {
187
187
  if (!session)
188
188
  return;
@@ -198,7 +198,7 @@ const svelteDocinfo = (options = {}) => {
198
198
  const result = session.query({ onDuplicates, log: logger ?? undefined });
199
199
  updateOutputFromQuery(result.modules, result.diagnostics);
200
200
  };
201
- // ── HMR flush: drain pendingChanges via setFiles + query ─────────────────
201
+ // HMR flush: drain pendingChanges via setFiles + query
202
202
  const flushBatch = async () => {
203
203
  if (initialPromise)
204
204
  await initialPromise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-docinfo",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "static analysis for TypeScript and Svelte",
5
5
  "glyph": "📜",
6
6
  "logo": "logo.svg",
@@ -53,7 +53,7 @@
53
53
  "@fuzdev/blake3_wasm": "^0.1.1",
54
54
  "@fuzdev/fuz_code": "^0.46.0",
55
55
  "@fuzdev/fuz_css": "^0.62.0",
56
- "@fuzdev/fuz_ui": "^0.202.0",
56
+ "@fuzdev/fuz_ui": "^0.203.1",
57
57
  "@fuzdev/fuz_util": "^0.65.1",
58
58
  "@fuzdev/gro": "^0.204.0",
59
59
  "@ryanatkn/eslint-config": "^0.12.1",