@elaraai/tsserver-plugin-east 1.0.67 → 1.0.69

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 (2) hide show
  1. package/dist/index.cjs +37 -1
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -246,6 +246,18 @@ function importsEastPackage(sf, t) {
246
246
  importsCache.set(sf, found);
247
247
  return found;
248
248
  }
249
+ function unresolvedEastImport(sf, checker, t) {
250
+ for (const stmt of sf.statements) {
251
+ if (!t.isImportDeclaration(stmt) && !t.isExportDeclaration(stmt))
252
+ continue;
253
+ const spec = stmt.moduleSpecifier;
254
+ if (spec === void 0 || !t.isStringLiteral(spec) || spec.text !== "@elaraai/east")
255
+ continue;
256
+ if (checker.getSymbolAtLocation(spec) === void 0)
257
+ return true;
258
+ }
259
+ return false;
260
+ }
249
261
  var declaresCache = /* @__PURE__ */ new WeakMap();
250
262
  var E3_DECLARATION_MEMBERS = /* @__PURE__ */ new Set([
251
263
  "input",
@@ -481,6 +493,26 @@ function insideReactive(node, t) {
481
493
  // ../east-diagnostics/dist/src/rules/prefer-let-const-over-east-value.js
482
494
  var NAME6 = "prefer-let-const-over-east-value";
483
495
  var CODE6 = 990006;
496
+ function typeIsLoadBearing(value, t) {
497
+ let found = false;
498
+ const emptyArray = (n) => n !== void 0 && t.isArrayLiteralExpression(n) && n.elements.length === 0;
499
+ const visit = (n) => {
500
+ if (found)
501
+ return;
502
+ if (t.isIdentifier(n) && n.text === "none")
503
+ found = true;
504
+ else if (emptyArray(n))
505
+ found = true;
506
+ else if (t.isNewExpression(n) && t.isIdentifier(n.expression) && (n.expression.text === "Map" || n.expression.text === "Set") && (n.arguments === void 0 || n.arguments.length === 0 || emptyArray(n.arguments[0])))
507
+ found = true;
508
+ else if (t.isCallExpression(n) && t.isIdentifier(n.expression) && (n.expression.text === "variant" || n.expression.text === "some"))
509
+ found = true;
510
+ else
511
+ t.forEachChild(n, visit);
512
+ };
513
+ visit(value);
514
+ return found;
515
+ }
484
516
  var preferLetConstOverEastValue = {
485
517
  name: NAME6,
486
518
  code: CODE6,
@@ -504,9 +536,11 @@ var preferLetConstOverEastValue = {
504
536
  return;
505
537
  if (!insideBlockScope(node, ctx))
506
538
  return;
539
+ const inner = node.arguments[0];
540
+ if ((asReturn || asCallbackBody) && node.arguments.length >= 2 && inner !== void 0 && typeIsLoadBearing(inner, t))
541
+ return;
507
542
  const sf = ctx.sourceFile;
508
543
  const start = node.getStart(sf);
509
- const inner = node.arguments[0];
510
544
  ctx.report({
511
545
  ruleName: NAME6,
512
546
  code: CODE6,
@@ -2223,6 +2257,8 @@ var allRules = [
2223
2257
 
2224
2258
  // ../east-diagnostics/dist/src/run.js
2225
2259
  function runEastRules(tsModule, program, sourceFile, checker, options = {}, rules = allRules) {
2260
+ if (unresolvedEastImport(sourceFile, checker, tsModule))
2261
+ return [];
2226
2262
  const diagnostics = [];
2227
2263
  const ctx = {
2228
2264
  ts: tsModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/tsserver-plugin-east",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "description": "TypeScript language service plugin for East — East idiom diagnostics and localized East type-diff error messages as native editor squiggles.",
6
6
  "main": "dist/index.cjs",
@@ -32,8 +32,8 @@
32
32
  "devDependencies": {
33
33
  "esbuild": "^0.27.3",
34
34
  "typescript": "~5.9.2",
35
- "@elaraai/east": "1.0.67",
36
- "@elaraai/east-diagnostics": "1.0.67"
35
+ "@elaraai/east-diagnostics": "1.0.69",
36
+ "@elaraai/east": "1.0.69"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node scripts/build.mjs",