@elaraai/tsserver-plugin-east 1.0.4 → 1.0.6

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 +56 -1
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -690,6 +690,58 @@ var preferJsxOverFactoryCall = {
690
690
  }
691
691
  };
692
692
 
693
+ // ../east-diagnostics/dist/src/rules/no-untracked-east-data.js
694
+ var NAME13 = "no-untracked-east-data";
695
+ var CODE13 = 990013;
696
+ function plainLiteralInitializer(decl, t) {
697
+ const init2 = decl.initializer;
698
+ if (init2 === void 0)
699
+ return void 0;
700
+ const unwrapped = t.isAsExpression(init2) || t.isSatisfiesExpression(init2) ? init2.expression : init2;
701
+ if (t.isArrayLiteralExpression(unwrapped) || t.isObjectLiteralExpression(unwrapped)) {
702
+ return unwrapped;
703
+ }
704
+ return void 0;
705
+ }
706
+ var noUntrackedEastData = {
707
+ name: NAME13,
708
+ code: CODE13,
709
+ description: "Inside East blocks, bind data consumed in East-typed positions with $.const/$.let, not a bare JS const.",
710
+ check(node, ctx) {
711
+ const t = ctx.ts;
712
+ if (!t.isIdentifier(node))
713
+ return;
714
+ const parent = node.parent;
715
+ const isCallArg = parent !== void 0 && t.isCallExpression(parent) && parent.expression !== node && parent.arguments.some((arg) => arg === node);
716
+ const isJsxValue = parent !== void 0 && t.isJsxExpression(parent) && parent.expression === node;
717
+ if (!isCallArg && !isJsxValue)
718
+ return;
719
+ if (!insideBlockScope(node, ctx))
720
+ return;
721
+ const contextual = ctx.checker.getContextualType(node);
722
+ if (contextual === void 0 || !isEastExprType(contextual))
723
+ return;
724
+ const symbol = ctx.checker.getSymbolAtLocation(node);
725
+ const decl = symbol?.valueDeclaration;
726
+ if (decl === void 0 || !t.isVariableDeclaration(decl))
727
+ return;
728
+ if (plainLiteralInitializer(decl, t) === void 0)
729
+ return;
730
+ if (!insideBlockScope(decl, ctx))
731
+ return;
732
+ const sf = ctx.sourceFile;
733
+ const start = node.getStart(sf);
734
+ ctx.report({
735
+ ruleName: NAME13,
736
+ code: CODE13,
737
+ start,
738
+ length: node.getEnd() - start,
739
+ messageText: `Bare \`const ${node.text} = \u2026\` isn't tracked by the East block builder. Bind East data with \`$.const([...], Type)\` (or \`$.let\`) so the binding carries its East type and is evaluated once.`,
740
+ category: "suggestion"
741
+ });
742
+ }
743
+ };
744
+
693
745
  // ../east-diagnostics/dist/src/rules/index.js
694
746
  var allRules = [
695
747
  noRedundantEastCast,
@@ -703,7 +755,8 @@ var allRules = [
703
755
  noUnexecutedEastExpression,
704
756
  noReinlinedEastBinding,
705
757
  noEastDataBuilderHelper,
706
- preferJsxOverFactoryCall
758
+ preferJsxOverFactoryCall,
759
+ noUntrackedEastData
707
760
  ];
708
761
 
709
762
  // ../east-diagnostics/dist/src/run.js
@@ -1098,6 +1151,8 @@ function rewriteEastAssignability(t, program, sourceFile, diagnostic, east) {
1098
1151
  return void 0;
1099
1152
  if (!actual.eastShaped && !expected.eastShaped)
1100
1153
  return void 0;
1154
+ if (expected.type === east.NeverType && actual.type !== east.NeverType)
1155
+ return void 0;
1101
1156
  let rendered;
1102
1157
  try {
1103
1158
  const diffs = east.diffTypes(actual.type, expected.type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/tsserver-plugin-east",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
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.4",
36
- "@elaraai/east-diagnostics": "1.0.4"
35
+ "@elaraai/east": "1.0.6",
36
+ "@elaraai/east-diagnostics": "1.0.6"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node scripts/build.mjs",