@useinsider/eslint-config 4.0.0-beta.3 → 4.0.0-beta.5

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.
Files changed (49) hide show
  1. package/dist/cli.cjs +36 -10
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/configs/dependencies.d.ts +1 -0
  4. package/dist/{javascript-dom-CvtQ6_9W.cjs → javascript-dom-bySaQErv.cjs} +4 -4
  5. package/dist/{javascript-dom-CvtQ6_9W.cjs.map → javascript-dom-bySaQErv.cjs.map} +1 -1
  6. package/dist/{javascript-node-BNsy3loY.cjs → javascript-node-DZxexKer.cjs} +4 -4
  7. package/dist/{javascript-node-BNsy3loY.cjs.map → javascript-node-DZxexKer.cjs.map} +1 -1
  8. package/dist/{javascript-DH8-N38w.cjs → javascript-ycJ4W-e9.cjs} +5 -5
  9. package/dist/{javascript-DH8-N38w.cjs.map → javascript-ycJ4W-e9.cjs.map} +1 -1
  10. package/dist/{jest-4Es9Ggaa.cjs → jest-B2fpQmUB.cjs} +3 -3
  11. package/dist/{jest-4Es9Ggaa.cjs.map → jest-B2fpQmUB.cjs.map} +1 -1
  12. package/dist/main.cjs +30 -32
  13. package/dist/main.cjs.map +1 -1
  14. package/dist/main.js +4 -6
  15. package/dist/main.js.map +1 -1
  16. package/dist/{oxlintOwnership-7hpdB3d1.cjs → removedOptions-BYMW8w__.cjs} +29 -1
  17. package/dist/removedOptions-BYMW8w__.cjs.map +1 -0
  18. package/dist/{oxlintOwnership-Cx0hgA_J.js → removedOptions-Cb8SG8SI.js} +18 -2
  19. package/dist/removedOptions-Cb8SG8SI.js.map +1 -0
  20. package/dist/{stylistic-CoP3MT1Y.cjs → stylistic-B2hCwBRu.cjs} +4 -4
  21. package/dist/{stylistic-CoP3MT1Y.cjs.map → stylistic-B2hCwBRu.cjs.map} +1 -1
  22. package/dist/{typescript-D3VeLnpn.cjs → typescript-DdgbCNKI.cjs} +7 -7
  23. package/dist/{typescript-D3VeLnpn.cjs.map → typescript-DdgbCNKI.cjs.map} +1 -1
  24. package/dist/{typescript-dom-iB_xBTAD.cjs → typescript-dom-C0NNSGLd.cjs} +4 -4
  25. package/dist/{typescript-dom-iB_xBTAD.cjs.map → typescript-dom-C0NNSGLd.cjs.map} +1 -1
  26. package/dist/{typescript-node-Cq6qhj53.cjs → typescript-node-CjG8N83q.cjs} +4 -4
  27. package/dist/{typescript-node-Cq6qhj53.cjs.map → typescript-node-CjG8N83q.cjs.map} +1 -1
  28. package/dist/utils/removedOptions.d.ts +10 -0
  29. package/dist/{vitest-BlGQswK2.cjs → vitest-B3kOWOzo.cjs} +3 -3
  30. package/dist/{vitest-BlGQswK2.cjs.map → vitest-B3kOWOzo.cjs.map} +1 -1
  31. package/dist/{vue2-Da1i_oVn.cjs → vue2-DfL5FqeZ.cjs} +8 -8
  32. package/dist/{vue2-Da1i_oVn.cjs.map → vue2-DfL5FqeZ.cjs.map} +1 -1
  33. package/dist/{vue2-options-api-BSdrUm8H.cjs → vue2-options-api-sSrBV5Si.cjs} +8 -8
  34. package/dist/{vue2-options-api-BSdrUm8H.cjs.map → vue2-options-api-sSrBV5Si.cjs.map} +1 -1
  35. package/dist/{vue2-typescript-options-api-LM7U5dWq.cjs → vue2-typescript-options-api-CbRC2wf-.cjs} +10 -10
  36. package/dist/{vue2-typescript-options-api-LM7U5dWq.cjs.map → vue2-typescript-options-api-CbRC2wf-.cjs.map} +1 -1
  37. package/dist/{vue2-typescript-dXLRSGNP.cjs → vue2-typescript-rJIMzNUI.cjs} +10 -10
  38. package/dist/{vue2-typescript-dXLRSGNP.cjs.map → vue2-typescript-rJIMzNUI.cjs.map} +1 -1
  39. package/dist/{vue3-621EM2Ii.cjs → vue3-DmrGRHbo.cjs} +8 -8
  40. package/dist/{vue3-621EM2Ii.cjs.map → vue3-DmrGRHbo.cjs.map} +1 -1
  41. package/dist/{vue3-options-api-CC9_fAiq.cjs → vue3-options-api-DPEk8rBk.cjs} +8 -8
  42. package/dist/{vue3-options-api-CC9_fAiq.cjs.map → vue3-options-api-DPEk8rBk.cjs.map} +1 -1
  43. package/dist/{vue3-typescript-DONe-IKz.cjs → vue3-typescript-Dz5BM0LJ.cjs} +10 -10
  44. package/dist/{vue3-typescript-DONe-IKz.cjs.map → vue3-typescript-Dz5BM0LJ.cjs.map} +1 -1
  45. package/dist/{vue3-typescript-options-api-D4pqpDFs.cjs → vue3-typescript-options-api-DiYz_vVd.cjs} +10 -10
  46. package/dist/{vue3-typescript-options-api-D4pqpDFs.cjs.map → vue3-typescript-options-api-DiYz_vVd.cjs.map} +1 -1
  47. package/package.json +2 -1
  48. package/dist/oxlintOwnership-7hpdB3d1.cjs.map +0 -1
  49. package/dist/oxlintOwnership-Cx0hgA_J.js.map +0 -1
package/dist/cli.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_oxlintOwnership = require("./oxlintOwnership-7hpdB3d1.cjs");
3
+ const require_removedOptions = require("./removedOptions-BYMW8w__.cjs");
4
4
  let globals = require("globals");
5
- globals = require_oxlintOwnership.__toESM(globals, 1);
5
+ globals = require_removedOptions.__toESM(globals, 1);
6
6
  let node_fs = require("node:fs");
7
7
  let node_path = require("node:path");
8
8
  let node_url = require("node:url");
@@ -10,7 +10,7 @@ let _typescript_eslint_types = require("@typescript-eslint/types");
10
10
  let node_crypto = require("node:crypto");
11
11
  let node_os = require("node:os");
12
12
  let typescript = require("typescript");
13
- typescript = require_oxlintOwnership.__toESM(typescript, 1);
13
+ typescript = require_removedOptions.__toESM(typescript, 1);
14
14
  let _typescript_eslint_parser = require("@typescript-eslint/parser");
15
15
  //#region src/cli/detect.ts
16
16
  var FLAT_CONFIG_FILENAMES = [
@@ -370,7 +370,10 @@ async function dispatch(argv, cwd, deps) {
370
370
  }
371
371
  //#endregion
372
372
  //#region src/configs/dependencies.ts
373
- var dependencies$14 = { oxlint: true };
373
+ var dependencies$14 = {
374
+ jiti: true,
375
+ oxlint: true
376
+ };
374
377
  //#endregion
375
378
  //#region src/configs/jest/dependencies.ts
376
379
  var dependencies$13 = { "eslint-plugin-jest": true };
@@ -423,6 +426,7 @@ var dependencies$7 = {
423
426
  };
424
427
  //#endregion
425
428
  //#region src/cli/resolveEslintConfigManifest.ts
429
+ var ESLINT_CONFIG_PACKAGE_NAME = "@useinsider/eslint-config";
426
430
  function tryReadManifest(candidate) {
427
431
  try {
428
432
  const raw = (0, node_fs.readFileSync)(candidate, "utf8");
@@ -451,11 +455,24 @@ function readOwnEslintConfigManifestFrom(runtimeDir) {
451
455
  function readOwnEslintConfigManifest$1() {
452
456
  return readOwnEslintConfigManifestFrom(resolveRuntimeDir());
453
457
  }
458
+ /**
459
+ * Install spec for the copy of `@useinsider/eslint-config` that is running right now, pinned to its
460
+ * own version. A dist-tag can never stand in for it: `latest` points at the previous major for as
461
+ * long as the current one ships on a prerelease tag, so resolving it downgrades the very consumer
462
+ * being scaffolded or migrated.
463
+ * @example
464
+ * ownEslintConfigSpec({ name: '@useinsider/eslint-config', version: '4.0.0-beta.3' });
465
+ * // '@useinsider/eslint-config@4.0.0-beta.3'
466
+ */
467
+ function ownEslintConfigSpec(manifest) {
468
+ const version = manifest.version?.trim();
469
+ if (!version) throw new Error(`Unable to read the running ${ESLINT_CONFIG_PACKAGE_NAME} version from its package.json. Refusing to install it from a dist-tag, which would downgrade this project.`);
470
+ return `${ESLINT_CONFIG_PACKAGE_NAME}@${version}`;
471
+ }
454
472
  //#endregion
455
473
  //#region src/cli/install.ts
456
474
  function toRequiredManifest(manifest) {
457
475
  return {
458
- version: manifest.version ?? "0.0.0",
459
476
  dependencies: manifest.dependencies ?? {},
460
477
  devDependencies: manifest.devDependencies ?? {},
461
478
  peerDependencies: manifest.peerDependencies ?? {},
@@ -482,7 +499,7 @@ function applyRecord(deps, manifest, record) {
482
499
  function buildDependencyList(answers, rawManifest = readOwnEslintConfigManifest$1()) {
483
500
  const manifest = toRequiredManifest(rawManifest);
484
501
  const deps = /* @__PURE__ */ new Set();
485
- deps.add(`@useinsider/eslint-config@${manifest.version}`);
502
+ deps.add(ownEslintConfigSpec(rawManifest));
486
503
  deps.add(pinned(manifest, "eslint"));
487
504
  deps.add(pinned(manifest, "globals"));
488
505
  applyRecord(deps, manifest, dependencies$14);
@@ -1772,7 +1789,11 @@ var PREFIX_PATTERNS = [
1772
1789
  "eslint-"
1773
1790
  ];
1774
1791
  var SCOPED_ESLINT_PATTERNS = [/^@[^/]+\/eslint-/u, /^@typescript-eslint\//u];
1775
- var SAFELIST = /* @__PURE__ */ new Set(["typescript", "@types/eslint"]);
1792
+ var SAFELIST = /* @__PURE__ */ new Set([
1793
+ "typescript",
1794
+ "@types/eslint",
1795
+ "jiti"
1796
+ ]);
1776
1797
  var SCOPE_TO_DEPS = {
1777
1798
  javascript: dependencies$6,
1778
1799
  javascriptDom: dependencies$5,
@@ -1900,7 +1921,7 @@ function resolveSpec(name, manifest, fallbacks) {
1900
1921
  function buildInstallList(scopes, manifest) {
1901
1922
  const specs = [];
1902
1923
  const fallbacks = [];
1903
- appendSpec(specs, "@useinsider/eslint-config@latest");
1924
+ appendSpec(specs, ownEslintConfigSpec(manifest));
1904
1925
  appendSpec(specs, resolveSpec("eslint", manifest, fallbacks));
1905
1926
  Object.entries(dependencies$14).forEach(([packageName, shouldInstall]) => {
1906
1927
  if (shouldInstall) appendSpec(specs, resolveSpec(packageName, manifest, fallbacks));
@@ -2234,8 +2255,8 @@ function formatDirective(owner, block, kind, rules, reason) {
2234
2255
  * movesToOxlint('@typescript-eslint/no-unused-vars', '.vue'); // false — ESLint still runs it in SFCs
2235
2256
  */
2236
2257
  function movesToOxlint(rule, fileExtension) {
2237
- if (!require_oxlintOwnership.isOxlintOwned(rule)) return false;
2238
- return !(SFC_EXTENSIONS.includes(fileExtension) && require_oxlintOwnership.isVueUnsafeRule(rule));
2258
+ if (!require_removedOptions.isOxlintOwned(rule)) return false;
2259
+ return !(SFC_EXTENSIONS.includes(fileExtension) && require_removedOptions.isVueUnsafeRule(rule));
2239
2260
  }
2240
2261
  function toSpans(comments, offset) {
2241
2262
  return comments.map((comment) => ({
@@ -4137,6 +4158,9 @@ function defineConfigReason(name) {
4137
4158
  function presetReason(name) {
4138
4159
  return `${name} still passes the v1 \`preset\` option, and this release could not read it — the preset list has to be an array of string literals. Restore the literal list and re-run the migration, or convert the call to the scope-keyed form by hand.`;
4139
4160
  }
4161
+ function removedOptionReason(name, details) {
4162
+ return `${name} passes option(s) this release removed. The migration copies the call across unchanged, so carrying them over would produce a lint module that fails on the next lint run. Update the call, then re-run the migration:\n${details}`;
4163
+ }
4140
4164
  function annotationWarning(line) {
4141
4165
  return {
4142
4166
  kind: "dropped-type-annotation",
@@ -4215,6 +4239,8 @@ function rehouseV3Config(source, filePath) {
4215
4239
  if (!isCallOf(unwrapped, aliases)) return refuse(indirectCallReason(name));
4216
4240
  const reading = readArgument(unwrapped);
4217
4241
  if (reading.optionKeys.includes("preset")) return refuse(presetReason(name));
4242
+ const removed = require_removedOptions.describeRemovedOptions(reading.optionKeys);
4243
+ if (removed !== null) return refuse(removedOptionReason(name, removed));
4218
4244
  return {
4219
4245
  kind: "rehoused",
4220
4246
  rehoused: {