@tsrx/eslint-plugin 0.3.72 → 0.3.76

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/README.md CHANGED
@@ -133,9 +133,9 @@ This rule is auto-fixable with `--fix`.
133
133
 
134
134
  ### `ripple/control-flow-jsx` (error)
135
135
 
136
- Checks render control flow inside functions that return native TSRX. `for...of`
137
- loops in returned TSRX should render elements, while loops inside `effect()`
138
- callbacks should not render JSX.
136
+ Checks template control flow inside functions that return native TSRX. `@for`
137
+ blocks should render template output, while ordinary `for...of` loops inside
138
+ `effect()` callbacks should not render JSX.
139
139
 
140
140
  ### `ripple/no-lazy-destructuring-in-modules` (error)
141
141
 
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ declare const plugin: {
13
13
  'control-flow-jsx': _$eslint.Rule.RuleModule;
14
14
  'no-lazy-destructuring-in-modules': _$eslint.Rule.RuleModule;
15
15
  'valid-for-of-key': _$eslint.Rule.RuleModule;
16
+ 'require-statement-container-body': _$eslint.Rule.RuleModule;
16
17
  };
17
18
  configs: any;
18
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQM,MAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;cASM,MAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "module";
2
2
  //#region src/rules/no-module-scope-track.ts
3
- const rule$5 = {
3
+ const rule$6 = {
4
4
  meta: {
5
5
  type: "problem",
6
6
  docs: {
@@ -32,7 +32,7 @@ const rule$5 = {
32
32
  };
33
33
  //#endregion
34
34
  //#region src/rules/prefer-oninput.ts
35
- const rule$4 = {
35
+ const rule$5 = {
36
36
  meta: {
37
37
  type: "suggestion",
38
38
  docs: {
@@ -63,9 +63,6 @@ const rule$4 = {
63
63
  "JSXAttribute[name.name=\"onChange\"]"(node) {
64
64
  report_onchange(node);
65
65
  },
66
- "Attribute[name.name=\"onChange\"]"(node) {
67
- report_onchange(node);
68
- },
69
66
  "Property[key.name=\"onChange\"]"(node) {
70
67
  if (context.sourceCode.getAncestors(node).some((ancestor) => ancestor.type === "ObjectExpression")) context.report({
71
68
  node,
@@ -80,7 +77,7 @@ const rule$4 = {
80
77
  };
81
78
  //#endregion
82
79
  //#region src/rules/no-return-in-component.ts
83
- const rule$3 = {
80
+ const rule$4 = {
84
81
  meta: {
85
82
  type: "problem",
86
83
  docs: {
@@ -97,7 +94,7 @@ const rule$3 = {
97
94
  };
98
95
  //#endregion
99
96
  //#region src/utils/tsrx.ts
100
- const NESTED_BOUNDARY_TYPES = new Set([
97
+ const NESTED_BOUNDARY_TYPES$1 = new Set([
101
98
  "FunctionDeclaration",
102
99
  "FunctionExpression",
103
100
  "ArrowFunctionExpression",
@@ -107,20 +104,22 @@ const NESTED_BOUNDARY_TYPES = new Set([
107
104
  "PropertyDefinition",
108
105
  "StaticBlock"
109
106
  ]);
110
- function isNativeTsrxNode(node) {
111
- return node?.type === "Element" || node?.type === "TsrxFragment";
107
+ function isNativeTsrxJsxNode(node) {
108
+ if (!node) return false;
109
+ if (node.type === "JSXCodeBlock" || node.type === "JSXIfExpression" || node.type === "JSXForExpression" || node.type === "JSXSwitchExpression" || node.type === "JSXTryExpression") return true;
110
+ return (node.type === "JSXElement" || node.type === "JSXFragment" || node.type === "JSXStyleElement") && !!node.metadata?.native_tsrx;
112
111
  }
113
112
  function functionReturnsNativeTsrx(node) {
114
113
  const body = node.body;
115
114
  if (!body) return false;
116
- if (isNativeTsrxNode(body)) return true;
115
+ if (isNativeTsrxJsxNode(body)) return true;
117
116
  if (body.type !== "BlockStatement") return false;
118
117
  return containsNativeTsrxReturn(body);
119
118
  }
120
119
  function containsNativeTsrxReturn(node) {
121
120
  if (!node || typeof node !== "object") return false;
122
- if (node.type === "ReturnStatement" && isNativeTsrxNode(node.argument)) return true;
123
- if (node.type !== "BlockStatement" && NESTED_BOUNDARY_TYPES.has(node.type)) return false;
121
+ if (node.type === "ReturnStatement" && isNativeTsrxJsxNode(node.argument)) return true;
122
+ if (node.type !== "BlockStatement" && NESTED_BOUNDARY_TYPES$1.has(node.type)) return false;
124
123
  for (const key of Object.keys(node)) {
125
124
  if (key === "parent" || key === "loc" || key === "range") continue;
126
125
  const value = node[key];
@@ -132,15 +131,24 @@ function containsNativeTsrxReturn(node) {
132
131
  }
133
132
  //#endregion
134
133
  //#region src/rules/control-flow-jsx.ts
135
- const rule$2 = {
134
+ const NESTED_BOUNDARY_TYPES = new Set([
135
+ "FunctionDeclaration",
136
+ "FunctionExpression",
137
+ "ArrowFunctionExpression",
138
+ "ClassDeclaration",
139
+ "ClassExpression",
140
+ "MethodDefinition",
141
+ "PropertyDefinition"
142
+ ]);
143
+ const rule$3 = {
136
144
  meta: {
137
145
  type: "problem",
138
146
  docs: {
139
- description: "Require JSX in for...of loops within components, but disallow JSX in for...of loops within effects",
147
+ description: "Require template output in @for blocks, but disallow JSX output in effect loops",
140
148
  recommended: true
141
149
  },
142
150
  messages: {
143
- requireJsxInLoop: "For...of loops in returned TSRX should contain JSX elements. Use JSX to render items.",
151
+ requireJsxInLoop: "@for blocks in returned TSRX should contain template output. Render an element, fragment, or nested template directive.",
144
152
  noJsxInEffectLoop: "For...of loops inside effect() should not contain JSX. Effects are for side effects, not rendering."
145
153
  },
146
154
  schema: []
@@ -150,19 +158,24 @@ const rule$2 = {
150
158
  let insideEffect = 0;
151
159
  let nonComponentFunctionDepth = 0;
152
160
  const functionStack = [];
153
- function containsJSX(node, visited = /* @__PURE__ */ new Set()) {
161
+ function containsTemplateOutput(node, visited = /* @__PURE__ */ new Set()) {
154
162
  if (!node) return false;
155
163
  if (visited.has(node)) return false;
156
164
  visited.add(node);
157
- if (node.type === "JSXElement" || node.type === "JSXFragment" || isNativeTsrxNode(node)) return true;
165
+ if (visited.size > 1 && NESTED_BOUNDARY_TYPES.has(node.type)) return false;
166
+ if (node.type === "JSXElement" || node.type === "JSXFragment" || node.type === "JSXStyleElement" || node.type === "JSXIfExpression" || node.type === "JSXForExpression" || node.type === "JSXSwitchExpression" || node.type === "JSXTryExpression") return true;
167
+ if (node.type === "JSXCodeBlock") {
168
+ const render = node.render;
169
+ return !!render && containsTemplateOutput(render, visited);
170
+ }
158
171
  const keys = Object.keys(node);
159
172
  for (const key of keys) {
160
173
  if (key === "parent" || key === "loc" || key === "range") continue;
161
174
  const value = node[key];
162
175
  if (value && typeof value === "object") {
163
176
  if (Array.isArray(value)) {
164
- for (const item of value) if (item && typeof item === "object" && containsJSX(item, visited)) return true;
165
- } else if (value.type && containsJSX(value, visited)) return true;
177
+ for (const item of value) if (item && typeof item === "object" && containsTemplateOutput(item, visited)) return true;
178
+ } else if (value.type && containsTemplateOutput(value, visited)) return true;
166
179
  }
167
180
  }
168
181
  return false;
@@ -181,15 +194,17 @@ const rule$2 = {
181
194
  insideEffect--;
182
195
  },
183
196
  ForOfStatement(node) {
184
- if (insideComponent === 0) return;
185
- const hasJSX = containsJSX(node.body);
186
- if (insideEffect > 0) {
187
- if (hasJSX) context.report({
188
- node,
189
- messageId: "noJsxInEffectLoop"
190
- });
191
- } else if (nonComponentFunctionDepth > 0) return;
192
- else if (!hasJSX) context.report({
197
+ if (insideComponent === 0 || insideEffect === 0) return;
198
+ if (containsTemplateOutput(node.body)) context.report({
199
+ node,
200
+ messageId: "noJsxInEffectLoop"
201
+ });
202
+ },
203
+ JSXForExpression(node) {
204
+ if (insideComponent === 0 || nonComponentFunctionDepth > 0) return;
205
+ const body = node.body;
206
+ if (!body || containsTemplateOutput(body)) return;
207
+ context.report({
193
208
  node,
194
209
  messageId: "requireJsxInLoop"
195
210
  });
@@ -209,7 +224,7 @@ const rule$2 = {
209
224
  };
210
225
  //#endregion
211
226
  //#region src/rules/no-lazy-destructuring-in-modules.ts
212
- const rule$1 = {
227
+ const rule$2 = {
213
228
  meta: {
214
229
  type: "problem",
215
230
  docs: {
@@ -240,7 +255,7 @@ const rule$1 = {
240
255
  };
241
256
  //#endregion
242
257
  //#region src/rules/valid-for-of-key.ts
243
- const rule = {
258
+ const rule$1 = {
244
259
  meta: {
245
260
  type: "problem",
246
261
  docs: {
@@ -251,7 +266,7 @@ const rule = {
251
266
  schema: []
252
267
  },
253
268
  create(context) {
254
- return { ForOfStatement(node) {
269
+ const checkForOfKey = (node) => {
255
270
  if (!node.key) return;
256
271
  const checkIdentifier = (identifier) => {
257
272
  if (!findVariable(context.sourceCode.getScope(node), identifier.name)) context.report({
@@ -304,7 +319,11 @@ const rule = {
304
319
  }
305
320
  };
306
321
  traverse(node.key);
307
- } };
322
+ };
323
+ return {
324
+ ForOfStatement: checkForOfKey,
325
+ JSXForExpression: checkForOfKey
326
+ };
308
327
  }
309
328
  };
310
329
  function findVariable(scope, name) {
@@ -317,6 +336,35 @@ function findVariable(scope, name) {
317
336
  return null;
318
337
  }
319
338
  //#endregion
339
+ //#region src/rules/require-statement-container-body.ts
340
+ const MESSAGE = "This function body contains TSRX template output, but it is a normal JavaScript block. Add '@' before the opening brace to use a TSRX statement container.";
341
+ function is_template_output_statement(node) {
342
+ if (!node) return false;
343
+ if (node.type === "JSXElement" || node.type === "JSXFragment" || node.type === "JSXStyleElement" || node.type === "JSXIfExpression" || node.type === "JSXForExpression" || node.type === "JSXSwitchExpression" || node.type === "JSXTryExpression") return true;
344
+ return node.type === "ExpressionStatement" && is_template_output_statement(node.expression);
345
+ }
346
+ function is_ignored_statement(node) {
347
+ return !node || node.type === "EmptyStatement";
348
+ }
349
+ function get_forgotten_output_statement(node) {
350
+ const body = node.body;
351
+ if (!body || body.type !== "BlockStatement") return null;
352
+ let target = null;
353
+ let target_index = -1;
354
+ const statements = body.body || [];
355
+ for (let index = 0; index < statements.length; index++) {
356
+ const statement = statements[index];
357
+ if (is_template_output_statement(statement)) {
358
+ if (target_index !== -1) return null;
359
+ target = statement;
360
+ target_index = index;
361
+ }
362
+ }
363
+ if (!target) return null;
364
+ for (const statement of statements.slice(target_index + 1)) if (!is_ignored_statement(statement)) return null;
365
+ return target;
366
+ }
367
+ //#endregion
320
368
  //#region src/index.ts
321
369
  const plugin = {
322
370
  meta: {
@@ -324,12 +372,41 @@ const plugin = {
324
372
  version: "0.1.3"
325
373
  },
326
374
  rules: {
327
- "no-module-scope-track": rule$5,
328
- "prefer-oninput": rule$4,
329
- "no-return-in-component": rule$3,
330
- "control-flow-jsx": rule$2,
331
- "no-lazy-destructuring-in-modules": rule$1,
332
- "valid-for-of-key": rule
375
+ "no-module-scope-track": rule$6,
376
+ "prefer-oninput": rule$5,
377
+ "no-return-in-component": rule$4,
378
+ "control-flow-jsx": rule$3,
379
+ "no-lazy-destructuring-in-modules": rule$2,
380
+ "valid-for-of-key": rule$1,
381
+ "require-statement-container-body": {
382
+ meta: {
383
+ type: "problem",
384
+ docs: { description: "Require @{...} for TSRX component bodies with setup and template output." },
385
+ fixable: "code",
386
+ messages: { requireStatementContainerBody: MESSAGE },
387
+ schema: []
388
+ },
389
+ create(context) {
390
+ function check_function(node) {
391
+ if (!node.returnType) return;
392
+ const forgotten_output = get_forgotten_output_statement(node);
393
+ if (!forgotten_output) return;
394
+ const body = node.body;
395
+ context.report({
396
+ node: forgotten_output,
397
+ messageId: "requireStatementContainerBody",
398
+ fix(fixer) {
399
+ return fixer.insertTextBefore(body, "@");
400
+ }
401
+ });
402
+ }
403
+ return {
404
+ FunctionDeclaration: check_function,
405
+ FunctionExpression: check_function,
406
+ ArrowFunctionExpression: check_function
407
+ };
408
+ }
409
+ }
333
410
  },
334
411
  configs: {}
335
412
  };
@@ -346,18 +423,20 @@ try {
346
423
  } catch {
347
424
  tsParser = null;
348
425
  }
349
- function createConfig(name, files, parser) {
426
+ function createConfig(name, files, parser, isTsrx) {
427
+ const rules = {
428
+ "ripple/no-module-scope-track": "error",
429
+ "ripple/prefer-oninput": "warn",
430
+ "ripple/control-flow-jsx": "error",
431
+ "ripple/no-lazy-destructuring-in-modules": "error",
432
+ "ripple/valid-for-of-key": "error"
433
+ };
434
+ if (isTsrx) rules["ripple/require-statement-container-body"] = "error";
350
435
  const config = {
351
436
  name,
352
437
  files,
353
438
  plugins: { ripple: plugin },
354
- rules: {
355
- "ripple/no-module-scope-track": "error",
356
- "ripple/prefer-oninput": "warn",
357
- "ripple/control-flow-jsx": "error",
358
- "ripple/no-lazy-destructuring-in-modules": "error",
359
- "ripple/valid-for-of-key": "error"
360
- }
439
+ rules
361
440
  };
362
441
  if (parser) config.languageOptions = {
363
442
  parser,
@@ -369,8 +448,8 @@ function createConfig(name, files, parser) {
369
448
  return config;
370
449
  }
371
450
  plugin.configs.recommended = [
372
- createConfig("ripple/recommended-ripple-files", ["**/*.tsrx"], rippleParser),
373
- createConfig("ripple/recommended-typescript-files", ["**/*.ts", "**/*.tsx"], tsParser),
451
+ createConfig("ripple/recommended-ripple-files", ["**/*.tsrx"], rippleParser, true),
452
+ createConfig("ripple/recommended-typescript-files", ["**/*.ts", "**/*.tsx"], tsParser, false),
374
453
  {
375
454
  name: "ripple/ignores",
376
455
  ignores: [
@@ -382,8 +461,8 @@ plugin.configs.recommended = [
382
461
  }
383
462
  ];
384
463
  plugin.configs.strict = [
385
- createConfig("ripple/strict-ripple-files", ["**/*.tsrx"], rippleParser),
386
- createConfig("ripple/strict-typescript-files", ["**/*.ts", "**/*.tsx"], tsParser),
464
+ createConfig("ripple/strict-ripple-files", ["**/*.tsrx"], rippleParser, true),
465
+ createConfig("ripple/strict-typescript-files", ["**/*.ts", "**/*.tsx"], tsParser, false),
387
466
  {
388
467
  name: "ripple/ignores",
389
468
  ignores: [
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rule","rule","rule","functionNode","rule","rule","noModuleScopeTrack","preferOnInput","noReturnInComponent","controlFlowJsx","noLazyDestructuringInModules","validForOfKey"],"sources":["../src/rules/no-module-scope-track.ts","../src/rules/prefer-oninput.ts","../src/rules/no-return-in-component.ts","../src/utils/tsrx.ts","../src/rules/control-flow-jsx.ts","../src/rules/no-lazy-destructuring-in-modules.ts","../src/rules/valid-for-of-key.ts","../src/index.ts"],"sourcesContent":["import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow calling track() at module scope',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tmoduleScope: 'track() cannot be called at module scope. Move it into a function body.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tlet functionDepth = 0;\n\n\t\tconst incrementFunctionDepth = () => functionDepth++;\n\t\tconst decrementFunctionDepth = () => functionDepth--;\n\n\t\treturn {\n\t\t\tFunctionDeclaration: incrementFunctionDepth,\n\t\t\t'FunctionDeclaration:exit': decrementFunctionDepth,\n\t\t\tFunctionExpression: incrementFunctionDepth,\n\t\t\t'FunctionExpression:exit': decrementFunctionDepth,\n\t\t\tArrowFunctionExpression: incrementFunctionDepth,\n\t\t\t'ArrowFunctionExpression:exit': decrementFunctionDepth,\n\n\t\t\t// Check track() calls\n\t\t\tCallExpression(node: AST.CallExpression) {\n\t\t\t\tif (\n\t\t\t\t\tnode.callee.type === 'Identifier' &&\n\t\t\t\t\tnode.callee.name === 'track' &&\n\t\t\t\t\tfunctionDepth === 0\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'moduleScope',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport type * as ESTreeJSX from '@tsrx/core/types/estree-jsx';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Prefer onInput over onChange for form inputs in Ripple',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tpreferOnInput:\n\t\t\t\t'Use \"onInput\" instead of \"onChange\". Ripple does not have synthetic events like React.',\n\t\t},\n\t\tfixable: 'code',\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst reported_ranges = new Set<string>();\n\n\t\tfunction report_onchange(node: AST.Attribute | ESTreeJSX.JSXAttribute) {\n\t\t\tconst range = node.range;\n\t\t\tif (!range) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst key = `${range[0]}:${range[1]}`;\n\t\t\tif (reported_ranges.has(key)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treported_ranges.add(key);\n\n\t\t\tcontext.report({\n\t\t\t\tnode,\n\t\t\t\tmessageId: 'preferOnInput',\n\t\t\t\tfix(fixer) {\n\t\t\t\t\treturn fixer.replaceText(node.name, 'onInput');\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\t// Check JSX attributes (standard JSX)\n\t\t\t'JSXAttribute[name.name=\"onChange\"]'(node: ESTreeJSX.JSXAttribute) {\n\t\t\t\treport_onchange(node);\n\t\t\t},\n\t\t\t// Check Attribute nodes (Ripple parser)\n\t\t\t'Attribute[name.name=\"onChange\"]'(node: AST.Attribute) {\n\t\t\t\treport_onchange(node);\n\t\t\t},\n\t\t\t// Check object properties (for spread props)\n\t\t\t'Property[key.name=\"onChange\"]'(node: AST.Property) {\n\t\t\t\t// Only report if this looks like it's in a props object\n\t\t\t\tconst ancestors = context.sourceCode.getAncestors(node);\n\t\t\t\tconst inObjectExpression = ancestors.some(\n\t\t\t\t\t(ancestor) => ancestor.type === 'ObjectExpression',\n\t\t\t\t);\n\n\t\t\t\tif (inObjectExpression) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'preferOnInput',\n\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\treturn fixer.replaceText(node.key, 'onInput');\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Deprecated: TSRX components are functions that return native TSRX expressions.',\n\t\t\trecommended: false,\n\t\t},\n\t\tdeprecated: true,\n\t\tmessages: {\n\t\t\tnoReturn: 'TSRX components should return native TSRX expressions.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tvoid context;\n\t\treturn {};\n\t},\n};\n\nexport default rule;\n","import type * as AST from '@tsrx/core/types/estree';\n\ntype AnyNode = AST.Node & Record<string, any>;\n\nconst NESTED_BOUNDARY_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n\t'ClassDeclaration',\n\t'ClassExpression',\n\t'MethodDefinition',\n\t'PropertyDefinition',\n\t'StaticBlock',\n]);\n\nexport function isNativeTsrxNode(node: AST.Node | null | undefined): boolean {\n\treturn node?.type === 'Element' || node?.type === 'TsrxFragment';\n}\n\nexport function functionReturnsNativeTsrx(node: AST.Node): boolean {\n\tconst functionNode = node as AnyNode;\n\tconst body = functionNode.body as AnyNode | undefined;\n\n\tif (!body) {\n\t\treturn false;\n\t}\n\n\tif (isNativeTsrxNode(body)) {\n\t\treturn true;\n\t}\n\n\tif (body.type !== 'BlockStatement') {\n\t\treturn false;\n\t}\n\n\treturn containsNativeTsrxReturn(body);\n}\n\nfunction containsNativeTsrxReturn(node: AnyNode): boolean {\n\tif (!node || typeof node !== 'object') {\n\t\treturn false;\n\t}\n\n\tif (node.type === 'ReturnStatement' && isNativeTsrxNode(node.argument)) {\n\t\treturn true;\n\t}\n\n\tif (node.type !== 'BlockStatement' && NESTED_BOUNDARY_TYPES.has(node.type)) {\n\t\treturn false;\n\t}\n\n\tfor (const key of Object.keys(node)) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst value = node[key];\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (const child of value) {\n\t\t\t\tif (child?.type && containsNativeTsrxReturn(child)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (value?.type && containsNativeTsrxReturn(value)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport { functionReturnsNativeTsrx, isNativeTsrxNode } from '../utils/tsrx.js';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Require JSX in for...of loops within components, but disallow JSX in for...of loops within effects',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\trequireJsxInLoop:\n\t\t\t\t'For...of loops in returned TSRX should contain JSX elements. Use JSX to render items.',\n\t\t\tnoJsxInEffectLoop:\n\t\t\t\t'For...of loops inside effect() should not contain JSX. Effects are for side effects, not rendering.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tlet insideComponent = 0;\n\t\tlet insideEffect = 0;\n\t\tlet nonComponentFunctionDepth = 0;\n\t\tconst functionStack: boolean[] = [];\n\n\t\tfunction containsJSX(node: AST.Node, visited: Set<AST.Node> = new Set()): boolean {\n\t\t\tif (!node) return false;\n\n\t\t\t// Avoid infinite loops from circular references\n\t\t\tif (visited.has(node)) return false;\n\t\t\tvisited.add(node);\n\n\t\t\tif (\n\t\t\t\tnode.type === ('JSXElement' as string) ||\n\t\t\t\tnode.type === ('JSXFragment' as string) ||\n\t\t\t\tisNativeTsrxNode(node)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst keys = Object.keys(node);\n\t\t\tfor (const key of keys) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst value = (node as any)[key];\n\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t\tfor (const item of value) {\n\t\t\t\t\t\t\tif (item && typeof item === 'object' && containsJSX(item, visited)) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (value.type && containsJSX(value, visited)) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: enterFunction,\n\t\t\t'FunctionDeclaration:exit': exitFunction,\n\t\t\tFunctionExpression: enterFunction,\n\t\t\t'FunctionExpression:exit': exitFunction,\n\t\t\tArrowFunctionExpression: enterFunction,\n\t\t\t'ArrowFunctionExpression:exit': exitFunction,\n\n\t\t\t\"CallExpression[callee.name='effect']\"() {\n\t\t\t\tinsideEffect++;\n\t\t\t},\n\t\t\t\"CallExpression[callee.name='effect']:exit\"() {\n\t\t\t\tinsideEffect--;\n\t\t\t},\n\n\t\t\tForOfStatement(node: AST.ForOfStatement) {\n\t\t\t\tif (insideComponent === 0) return;\n\n\t\t\t\tconst hasJSX = containsJSX(node.body);\n\n\t\t\t\tif (insideEffect > 0) {\n\t\t\t\t\tif (hasJSX) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tmessageId: 'noJsxInEffectLoop',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else if (nonComponentFunctionDepth > 0) {\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tif (!hasJSX) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tmessageId: 'requireJsxInLoop',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\n\t\tfunction enterFunction(node: AST.Node) {\n\t\t\tconst isComponent = functionReturnsNativeTsrx(node);\n\t\t\tfunctionStack.push(isComponent);\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent++;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth++;\n\t\t\t}\n\t\t}\n\n\t\tfunction exitFunction() {\n\t\t\tconst isComponent = functionStack.pop();\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent--;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth--;\n\t\t\t}\n\t\t}\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow lazy destructuring (&[] / &{}) in TypeScript/JavaScript modules',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tnoLazyDestructuring:\n\t\t\t\t'Lazy destructuring (&[] / &{}) cannot be used in TypeScript/JavaScript modules. Use .value to read and write tracked values instead.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.filename;\n\n\t\t// Skip TSRX files where lazy destructuring is valid\n\t\tif (filename && filename.endsWith('.tsrx')) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tArrayPattern(node: any) {\n\t\t\t\tif (node.lazy === true) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'noLazyDestructuring',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\tObjectPattern(node: any) {\n\t\t\t\tif (node.lazy === true) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'noLazyDestructuring',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport type { Scope } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Ensure variables used in for..of key expression are defined',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tundefinedVariable: \"Variable '{{name}}' is not defined.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tForOfStatement(node: AST.ForOfStatement) {\n\t\t\t\tif (!node.key) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst checkIdentifier = (identifier: AST.Identifier) => {\n\t\t\t\t\tconst scope = context.sourceCode.getScope(node);\n\t\t\t\t\tconst variable = findVariable(scope, identifier.name);\n\n\t\t\t\t\tif (!variable) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode: identifier,\n\t\t\t\t\t\t\tmessageId: 'undefinedVariable',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tname: identifier.name,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tconst traverse = (node: AST.Node) => {\n\t\t\t\t\tif (!node) return;\n\n\t\t\t\t\tswitch (node.type) {\n\t\t\t\t\t\tcase 'Identifier':\n\t\t\t\t\t\t\tcheckIdentifier(node);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'MemberExpression':\n\t\t\t\t\t\t\ttraverse(node.object);\n\n\t\t\t\t\t\t\tif (node.computed) {\n\t\t\t\t\t\t\t\ttraverse(node.property);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'BinaryExpression':\n\t\t\t\t\t\tcase 'LogicalExpression':\n\t\t\t\t\t\t\ttraverse(node.left);\n\t\t\t\t\t\t\ttraverse(node.right);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'UnaryExpression':\n\t\t\t\t\t\t\ttraverse(node.argument);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'CallExpression':\n\t\t\t\t\t\t\ttraverse(node.callee);\n\t\t\t\t\t\t\tnode.arguments.forEach(traverse);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'ArrayExpression':\n\t\t\t\t\t\t\t(node.elements as (AST.Expression | AST.SpreadElement)[]).forEach(traverse);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'ObjectExpression':\n\t\t\t\t\t\t\tnode.properties.forEach((prop: AST.Property | AST.SpreadElement) => {\n\t\t\t\t\t\t\t\tif (prop.type === 'Property') {\n\t\t\t\t\t\t\t\t\tif (prop.computed) {\n\t\t\t\t\t\t\t\t\t\ttraverse(prop.key);\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\ttraverse(prop.value);\n\t\t\t\t\t\t\t\t} else if (prop.type === 'SpreadElement') {\n\t\t\t\t\t\t\t\t\ttraverse(prop.argument);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'ConditionalExpression':\n\t\t\t\t\t\t\ttraverse(node.test);\n\t\t\t\t\t\t\ttraverse(node.consequent);\n\t\t\t\t\t\t\ttraverse(node.alternate);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'TemplateLiteral':\n\t\t\t\t\t\t\tnode.expressions.forEach(traverse);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\ttraverse(node.key);\n\t\t\t},\n\t\t};\n\t},\n};\n\nfunction findVariable(scope: Scope.Scope, name: string) {\n\tlet currentScope: Scope.Scope | null = scope;\n\n\twhile (currentScope) {\n\t\tconst variable = currentScope.variables.find((v: { name: string }) => v.name === name);\n\n\t\tif (variable) {\n\t\t\treturn variable;\n\t\t}\n\n\t\t// Also check references for global variables or variables defined in the loop itself (like the loop variable)\n\t\t// The loop variable might not be in the 'variables' list of the surrounding scope yet if we are inside the loop statement\n\t\t// But for 'for-of', the loop variable is in a special scope or the upper scope.\n\t\t// Let's rely on standard scope analysis.\n\n\t\t// Special case: check if the variable is the loop variable itself (left side of for-of)\n\t\t// The scope analysis might handle this, but let's be sure.\n\n\t\tcurrentScope = currentScope.upper;\n\t}\n\n\t// If not found in scopes, it might be a global variable.\n\t// ESLint scope analysis usually includes globals in the global scope.\n\t// However, if we are in a module, we might need to check if it's an implicit global or defined elsewhere.\n\t// For now, let's assume standard scope resolution works.\n\n\treturn null;\n}\n\nexport default rule;\n","import { createRequire } from 'module';\nimport noModuleScopeTrack from './rules/no-module-scope-track.js';\nimport preferOnInput from './rules/prefer-oninput.js';\nimport noReturnInComponent from './rules/no-return-in-component.js';\nimport controlFlowJsx from './rules/control-flow-jsx.js';\nimport noLazyDestructuringInModules from './rules/no-lazy-destructuring-in-modules.js';\nimport validForOfKey from './rules/valid-for-of-key.js';\n\nconst plugin = {\n\tmeta: {\n\t\tname: '@tsrx/eslint-plugin',\n\t\tversion: '0.1.3',\n\t},\n\trules: {\n\t\t'no-module-scope-track': noModuleScopeTrack,\n\t\t'prefer-oninput': preferOnInput,\n\t\t'no-return-in-component': noReturnInComponent,\n\t\t'control-flow-jsx': controlFlowJsx,\n\t\t'no-lazy-destructuring-in-modules': noLazyDestructuringInModules,\n\t\t'valid-for-of-key': validForOfKey,\n\t},\n\tconfigs: {} as any,\n};\n\n// Try to load optional parsers\nconst require = createRequire(import.meta.url);\n\nlet rippleParser: any;\nlet tsParser: any;\n\ntry {\n\trippleParser = require('@tsrx/eslint-parser');\n} catch {\n\t// @tsrx/eslint-parser is optional\n\trippleParser = null;\n}\n\ntry {\n\ttsParser = require('@typescript-eslint/parser');\n} catch {\n\t// @typescript-eslint/parser is optional\n\ttsParser = null;\n}\n\n// Helper to create config objects\nfunction createConfig(name: string, files: string[], parser: any) {\n\tconst config: any = {\n\t\tname,\n\t\tfiles,\n\t\tplugins: {\n\t\t\tripple: plugin,\n\t\t},\n\t\trules: {\n\t\t\t'ripple/no-module-scope-track': 'error',\n\t\t\t'ripple/prefer-oninput': 'warn',\n\t\t\t'ripple/control-flow-jsx': 'error',\n\t\t\t'ripple/no-lazy-destructuring-in-modules': 'error',\n\t\t\t'ripple/valid-for-of-key': 'error',\n\t\t},\n\t};\n\n\t// Only add parser if it's available\n\tif (parser) {\n\t\tconfig.languageOptions = {\n\t\t\tparser,\n\t\t\tparserOptions: {\n\t\t\t\tecmaVersion: 'latest',\n\t\t\t\tsourceType: 'module',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn config;\n}\n\n// Recommended configuration (flat config format)\nplugin.configs.recommended = [\n\tcreateConfig('ripple/recommended-ripple-files', ['**/*.tsrx'], rippleParser),\n\tcreateConfig('ripple/recommended-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser),\n\t{\n\t\tname: 'ripple/ignores',\n\t\tignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],\n\t},\n];\n\n// Strict configuration (flat config format)\nplugin.configs.strict = [\n\tcreateConfig('ripple/strict-ripple-files', ['**/*.tsrx'], rippleParser),\n\tcreateConfig('ripple/strict-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser),\n\t{\n\t\tname: 'ripple/ignores',\n\t\tignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],\n\t},\n];\n\nexport default plugin;\n"],"mappings":";;AAGA,MAAMA,SAAwB;CAC7B,MAAM;EACL,MAAM;EACN,MAAM;GACL,aAAa;GACb,aAAa;GACb;EACD,UAAU,EACT,aAAa,2EACb;EACD,QAAQ,EAAE;EACV;CACD,OAAO,SAAS;EACf,IAAI,gBAAgB;EAEpB,MAAM,+BAA+B;EACrC,MAAM,+BAA+B;EAErC,OAAO;GACN,qBAAqB;GACrB,4BAA4B;GAC5B,oBAAoB;GACpB,2BAA2B;GAC3B,yBAAyB;GACzB,gCAAgC;GAGh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CACvB,aAAa,8BAA8B,CAAC,YAAY,EAAE,aAAa;CACvE,aAAa,kCAAkC,CAAC,WAAW,WAAW,EAAE,SAAS;CACjF;EACC,MAAM;EACN,SAAS;GAAC;GAAa;GAAsB;GAAc;GAAc;EACzE;CACD"}
1
+ {"version":3,"file":"index.js","names":["rule","rule","rule","NESTED_BOUNDARY_TYPES","functionNode","rule","rule","rule","noModuleScopeTrack","preferOnInput","noReturnInComponent","controlFlowJsx","noLazyDestructuringInModules","validForOfKey","requireStatementContainerBody"],"sources":["../src/rules/no-module-scope-track.ts","../src/rules/prefer-oninput.ts","../src/rules/no-return-in-component.ts","../src/utils/tsrx.ts","../src/rules/control-flow-jsx.ts","../src/rules/no-lazy-destructuring-in-modules.ts","../src/rules/valid-for-of-key.ts","../src/rules/require-statement-container-body.ts","../src/index.ts"],"sourcesContent":["import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow calling track() at module scope',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tmoduleScope: 'track() cannot be called at module scope. Move it into a function body.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tlet functionDepth = 0;\n\n\t\tconst incrementFunctionDepth = () => functionDepth++;\n\t\tconst decrementFunctionDepth = () => functionDepth--;\n\n\t\treturn {\n\t\t\tFunctionDeclaration: incrementFunctionDepth,\n\t\t\t'FunctionDeclaration:exit': decrementFunctionDepth,\n\t\t\tFunctionExpression: incrementFunctionDepth,\n\t\t\t'FunctionExpression:exit': decrementFunctionDepth,\n\t\t\tArrowFunctionExpression: incrementFunctionDepth,\n\t\t\t'ArrowFunctionExpression:exit': decrementFunctionDepth,\n\n\t\t\t// Check track() calls\n\t\t\tCallExpression(node: AST.CallExpression) {\n\t\t\t\tif (\n\t\t\t\t\tnode.callee.type === 'Identifier' &&\n\t\t\t\t\tnode.callee.name === 'track' &&\n\t\t\t\t\tfunctionDepth === 0\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'moduleScope',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport type * as ESTreeJSX from '@tsrx/core/types/estree-jsx';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Prefer onInput over onChange for form inputs in Ripple',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tpreferOnInput:\n\t\t\t\t'Use \"onInput\" instead of \"onChange\". Ripple does not have synthetic events like React.',\n\t\t},\n\t\tfixable: 'code',\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst reported_ranges = new Set<string>();\n\n\t\tfunction report_onchange(node: ESTreeJSX.JSXAttribute) {\n\t\t\tconst range = node.range;\n\t\t\tif (!range) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst key = `${range[0]}:${range[1]}`;\n\t\t\tif (reported_ranges.has(key)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treported_ranges.add(key);\n\n\t\t\tcontext.report({\n\t\t\t\tnode,\n\t\t\t\tmessageId: 'preferOnInput',\n\t\t\t\tfix(fixer) {\n\t\t\t\t\treturn fixer.replaceText(node.name, 'onInput');\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\t// Check JSX attributes (standard JSX)\n\t\t\t'JSXAttribute[name.name=\"onChange\"]'(node: ESTreeJSX.JSXAttribute) {\n\t\t\t\treport_onchange(node);\n\t\t\t},\n\t\t\t// Check object properties (for spread props)\n\t\t\t'Property[key.name=\"onChange\"]'(node: AST.Property) {\n\t\t\t\t// Only report if this looks like it's in a props object\n\t\t\t\tconst ancestors = context.sourceCode.getAncestors(node);\n\t\t\t\tconst inObjectExpression = ancestors.some(\n\t\t\t\t\t(ancestor) => ancestor.type === 'ObjectExpression',\n\t\t\t\t);\n\n\t\t\t\tif (inObjectExpression) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'preferOnInput',\n\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\treturn fixer.replaceText(node.key, 'onInput');\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Deprecated: TSRX components are functions that return native TSRX expressions.',\n\t\t\trecommended: false,\n\t\t},\n\t\tdeprecated: true,\n\t\tmessages: {\n\t\t\tnoReturn: 'TSRX components should return native TSRX expressions.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tvoid context;\n\t\treturn {};\n\t},\n};\n\nexport default rule;\n","import type * as AST from '@tsrx/core/types/estree';\n\ntype AnyNode = AST.Node & Record<string, any>;\n\nconst NESTED_BOUNDARY_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n\t'ClassDeclaration',\n\t'ClassExpression',\n\t'MethodDefinition',\n\t'PropertyDefinition',\n\t'StaticBlock',\n]);\n\nexport function isNativeTsrxJsxNode(node: AST.Node | null | undefined): boolean {\n\tif (!node) return false;\n\n\tif (\n\t\tnode.type === ('JSXCodeBlock' as string) ||\n\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\tnode.type === ('JSXForExpression' as string) ||\n\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\tnode.type === ('JSXTryExpression' as string)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\t(node.type === ('JSXElement' as string) ||\n\t\t\tnode.type === ('JSXFragment' as string) ||\n\t\t\tnode.type === ('JSXStyleElement' as string)) &&\n\t\t!!(node as AnyNode).metadata?.native_tsrx\n\t);\n}\n\nexport function functionReturnsNativeTsrx(node: AST.Node): boolean {\n\tconst functionNode = node as AnyNode;\n\tconst body = functionNode.body as AnyNode | undefined;\n\n\tif (!body) {\n\t\treturn false;\n\t}\n\n\tif (isNativeTsrxJsxNode(body)) {\n\t\treturn true;\n\t}\n\n\tif (body.type !== 'BlockStatement') {\n\t\treturn false;\n\t}\n\n\treturn containsNativeTsrxReturn(body);\n}\n\nfunction containsNativeTsrxReturn(node: AnyNode): boolean {\n\tif (!node || typeof node !== 'object') {\n\t\treturn false;\n\t}\n\n\tif (node.type === 'ReturnStatement' && isNativeTsrxJsxNode(node.argument)) {\n\t\treturn true;\n\t}\n\n\tif (node.type !== 'BlockStatement' && NESTED_BOUNDARY_TYPES.has(node.type)) {\n\t\treturn false;\n\t}\n\n\tfor (const key of Object.keys(node)) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst value = node[key];\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (const child of value) {\n\t\t\t\tif (child?.type && containsNativeTsrxReturn(child)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (value?.type && containsNativeTsrxReturn(value)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport { functionReturnsNativeTsrx } from '../utils/tsrx.js';\n\nconst NESTED_BOUNDARY_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n\t'ClassDeclaration',\n\t'ClassExpression',\n\t'MethodDefinition',\n\t'PropertyDefinition',\n]);\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Require template output in @for blocks, but disallow JSX output in effect loops',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\trequireJsxInLoop:\n\t\t\t\t'@for blocks in returned TSRX should contain template output. Render an element, fragment, or nested template directive.',\n\t\t\tnoJsxInEffectLoop:\n\t\t\t\t'For...of loops inside effect() should not contain JSX. Effects are for side effects, not rendering.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tlet insideComponent = 0;\n\t\tlet insideEffect = 0;\n\t\tlet nonComponentFunctionDepth = 0;\n\t\tconst functionStack: boolean[] = [];\n\n\t\tfunction containsTemplateOutput(node: AST.Node, visited: Set<AST.Node> = new Set()): boolean {\n\t\t\tif (!node) return false;\n\n\t\t\t// Avoid infinite loops from circular references\n\t\t\tif (visited.has(node)) return false;\n\t\t\tvisited.add(node);\n\n\t\t\tif (visited.size > 1 && NESTED_BOUNDARY_TYPES.has(node.type)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode.type === ('JSXElement' as string) ||\n\t\t\t\tnode.type === ('JSXFragment' as string) ||\n\t\t\t\tnode.type === ('JSXStyleElement' as string) ||\n\t\t\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\t\t\tnode.type === ('JSXForExpression' as string) ||\n\t\t\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\t\t\tnode.type === ('JSXTryExpression' as string)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (node.type === ('JSXCodeBlock' as string)) {\n\t\t\t\tconst render = (node as any).render;\n\t\t\t\treturn !!render && containsTemplateOutput(render, visited);\n\t\t\t}\n\n\t\t\tconst keys = Object.keys(node);\n\t\t\tfor (const key of keys) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst value = (node as any)[key];\n\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t\tfor (const item of value) {\n\t\t\t\t\t\t\tif (item && typeof item === 'object' && containsTemplateOutput(item, visited)) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (value.type && containsTemplateOutput(value, visited)) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: enterFunction,\n\t\t\t'FunctionDeclaration:exit': exitFunction,\n\t\t\tFunctionExpression: enterFunction,\n\t\t\t'FunctionExpression:exit': exitFunction,\n\t\t\tArrowFunctionExpression: enterFunction,\n\t\t\t'ArrowFunctionExpression:exit': exitFunction,\n\n\t\t\t\"CallExpression[callee.name='effect']\"() {\n\t\t\t\tinsideEffect++;\n\t\t\t},\n\t\t\t\"CallExpression[callee.name='effect']:exit\"() {\n\t\t\t\tinsideEffect--;\n\t\t\t},\n\n\t\t\tForOfStatement(node: AST.ForOfStatement) {\n\t\t\t\tif (insideComponent === 0 || insideEffect === 0) return;\n\n\t\t\t\tif (containsTemplateOutput(node.body)) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'noJsxInEffectLoop',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tJSXForExpression(node: AST.Node) {\n\t\t\t\tif (insideComponent === 0 || nonComponentFunctionDepth > 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst body = (node as any).body;\n\t\t\t\tif (!body || containsTemplateOutput(body)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'requireJsxInLoop',\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\n\t\tfunction enterFunction(node: AST.Node) {\n\t\t\tconst isComponent = functionReturnsNativeTsrx(node);\n\t\t\tfunctionStack.push(isComponent);\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent++;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth++;\n\t\t\t}\n\t\t}\n\n\t\tfunction exitFunction() {\n\t\t\tconst isComponent = functionStack.pop();\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent--;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth--;\n\t\t\t}\n\t\t}\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow lazy destructuring (&[] / &{}) in TypeScript/JavaScript modules',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tnoLazyDestructuring:\n\t\t\t\t'Lazy destructuring (&[] / &{}) cannot be used in TypeScript/JavaScript modules. Use .value to read and write tracked values instead.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.filename;\n\n\t\t// Skip TSRX files where lazy destructuring is valid\n\t\tif (filename && filename.endsWith('.tsrx')) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tArrayPattern(node: any) {\n\t\t\t\tif (node.lazy === true) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'noLazyDestructuring',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\tObjectPattern(node: any) {\n\t\t\t\tif (node.lazy === true) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'noLazyDestructuring',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport type { Scope } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Ensure variables used in for..of key expression are defined',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tundefinedVariable: \"Variable '{{name}}' is not defined.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst checkForOfKey = (node: AST.ForOfStatement | AST.JSXForExpression) => {\n\t\t\tif (!node.key) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst checkIdentifier = (identifier: AST.Identifier) => {\n\t\t\t\tconst scope = context.sourceCode.getScope(node);\n\t\t\t\tconst variable = findVariable(scope, identifier.name);\n\n\t\t\t\tif (!variable) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: identifier,\n\t\t\t\t\t\tmessageId: 'undefinedVariable',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: identifier.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst traverse = (node: AST.Node) => {\n\t\t\t\tif (!node) return;\n\n\t\t\t\tswitch (node.type) {\n\t\t\t\t\tcase 'Identifier':\n\t\t\t\t\t\tcheckIdentifier(node);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'MemberExpression':\n\t\t\t\t\t\ttraverse(node.object);\n\n\t\t\t\t\t\tif (node.computed) {\n\t\t\t\t\t\t\ttraverse(node.property);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'BinaryExpression':\n\t\t\t\t\tcase 'LogicalExpression':\n\t\t\t\t\t\ttraverse(node.left);\n\t\t\t\t\t\ttraverse(node.right);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'UnaryExpression':\n\t\t\t\t\t\ttraverse(node.argument);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'CallExpression':\n\t\t\t\t\t\ttraverse(node.callee);\n\t\t\t\t\t\tnode.arguments.forEach(traverse);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ArrayExpression':\n\t\t\t\t\t\t(node.elements as (AST.Expression | AST.SpreadElement)[]).forEach(traverse);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ObjectExpression':\n\t\t\t\t\t\tnode.properties.forEach((prop: AST.Property | AST.SpreadElement) => {\n\t\t\t\t\t\t\tif (prop.type === 'Property') {\n\t\t\t\t\t\t\t\tif (prop.computed) {\n\t\t\t\t\t\t\t\t\ttraverse(prop.key);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\ttraverse(prop.value);\n\t\t\t\t\t\t\t} else if (prop.type === 'SpreadElement') {\n\t\t\t\t\t\t\t\ttraverse(prop.argument);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ConditionalExpression':\n\t\t\t\t\t\ttraverse(node.test);\n\t\t\t\t\t\ttraverse(node.consequent);\n\t\t\t\t\t\ttraverse(node.alternate);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'TemplateLiteral':\n\t\t\t\t\t\tnode.expressions.forEach(traverse);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttraverse(node.key);\n\t\t};\n\n\t\t// `@for (... ; key X)` loops parse to `JSXForExpression`, while the bare\n\t\t// `for (... ; key X)` form parses to `ForOfStatement`. Both carry the same\n\t\t// `key` shape, so validate either node type.\n\t\treturn {\n\t\t\tForOfStatement: checkForOfKey,\n\t\t\tJSXForExpression: checkForOfKey,\n\t\t};\n\t},\n};\n\nfunction findVariable(scope: Scope.Scope, name: string) {\n\tlet currentScope: Scope.Scope | null = scope;\n\n\twhile (currentScope) {\n\t\tconst variable = currentScope.variables.find((v: { name: string }) => v.name === name);\n\n\t\tif (variable) {\n\t\t\treturn variable;\n\t\t}\n\n\t\t// Also check references for global variables or variables defined in the loop itself (like the loop variable)\n\t\t// The loop variable might not be in the 'variables' list of the surrounding scope yet if we are inside the loop statement\n\t\t// But for 'for-of', the loop variable is in a special scope or the upper scope.\n\t\t// Let's rely on standard scope analysis.\n\n\t\t// Special case: check if the variable is the loop variable itself (left side of for-of)\n\t\t// The scope analysis might handle this, but let's be sure.\n\n\t\tcurrentScope = currentScope.upper;\n\t}\n\n\t// If not found in scopes, it might be a global variable.\n\t// ESLint scope analysis usually includes globals in the global scope.\n\t// However, if we are in a module, we might need to check if it's an implicit global or defined elsewhere.\n\t// For now, let's assume standard scope resolution works.\n\n\treturn null;\n}\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\n\ntype AnyNode = AST.Node & Record<string, any>;\n\nconst MESSAGE =\n\t\"This function body contains TSRX template output, but it is a normal JavaScript block. Add '@' before the opening brace to use a TSRX statement container.\";\n\nfunction is_template_output_statement(node: AnyNode | null | undefined): boolean {\n\tif (!node) return false;\n\n\tif (\n\t\tnode.type === ('JSXElement' as string) ||\n\t\tnode.type === ('JSXFragment' as string) ||\n\t\tnode.type === ('JSXStyleElement' as string) ||\n\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\tnode.type === ('JSXForExpression' as string) ||\n\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\tnode.type === ('JSXTryExpression' as string)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\tnode.type === 'ExpressionStatement' &&\n\t\tis_template_output_statement((node as AnyNode).expression)\n\t);\n}\n\nfunction is_ignored_statement(node: AnyNode | null | undefined): boolean {\n\treturn !node || node.type === 'EmptyStatement';\n}\n\nfunction get_forgotten_output_statement(node: AST.Node): AnyNode | null {\n\tconst body = (node as AnyNode).body;\n\tif (!body || body.type !== 'BlockStatement') {\n\t\treturn null;\n\t}\n\n\tlet target: AnyNode | null = null;\n\tlet target_index = -1;\n\tconst statements = body.body || [];\n\tfor (let index = 0; index < statements.length; index++) {\n\t\tconst statement = statements[index] as AnyNode;\n\t\tif (is_template_output_statement(statement)) {\n\t\t\tif (target_index !== -1) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttarget = statement;\n\t\t\ttarget_index = index;\n\t\t}\n\t}\n\n\tif (!target) {\n\t\treturn null;\n\t}\n\n\tfor (const statement of statements.slice(target_index + 1)) {\n\t\tif (!is_ignored_statement(statement as AnyNode)) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn target;\n}\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require @{...} for TSRX component bodies with setup and template output.',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\trequireStatementContainerBody: MESSAGE,\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tfunction check_function(node: AST.Node) {\n\t\t\tif (!(node as AnyNode).returnType) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst forgotten_output = get_forgotten_output_statement(node);\n\t\t\tif (!forgotten_output) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst body = (node as AnyNode).body;\n\t\t\tcontext.report({\n\t\t\t\tnode: forgotten_output,\n\t\t\t\tmessageId: 'requireStatementContainerBody',\n\t\t\t\tfix(fixer) {\n\t\t\t\t\treturn fixer.insertTextBefore(body, '@');\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: check_function,\n\t\t\tFunctionExpression: check_function,\n\t\t\tArrowFunctionExpression: check_function,\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { createRequire } from 'module';\nimport noModuleScopeTrack from './rules/no-module-scope-track.js';\nimport preferOnInput from './rules/prefer-oninput.js';\nimport noReturnInComponent from './rules/no-return-in-component.js';\nimport controlFlowJsx from './rules/control-flow-jsx.js';\nimport noLazyDestructuringInModules from './rules/no-lazy-destructuring-in-modules.js';\nimport validForOfKey from './rules/valid-for-of-key.js';\nimport requireStatementContainerBody from './rules/require-statement-container-body.js';\n\nconst plugin = {\n\tmeta: {\n\t\tname: '@tsrx/eslint-plugin',\n\t\tversion: '0.1.3',\n\t},\n\trules: {\n\t\t'no-module-scope-track': noModuleScopeTrack,\n\t\t'prefer-oninput': preferOnInput,\n\t\t'no-return-in-component': noReturnInComponent,\n\t\t'control-flow-jsx': controlFlowJsx,\n\t\t'no-lazy-destructuring-in-modules': noLazyDestructuringInModules,\n\t\t'valid-for-of-key': validForOfKey,\n\t\t'require-statement-container-body': requireStatementContainerBody,\n\t},\n\tconfigs: {} as any,\n};\n\n// Try to load optional parsers\nconst require = createRequire(import.meta.url);\n\nlet rippleParser: any;\nlet tsParser: any;\n\ntry {\n\trippleParser = require('@tsrx/eslint-parser');\n} catch {\n\t// @tsrx/eslint-parser is optional\n\trippleParser = null;\n}\n\ntry {\n\ttsParser = require('@typescript-eslint/parser');\n} catch {\n\t// @typescript-eslint/parser is optional\n\ttsParser = null;\n}\n\n// Helper to create config objects\nfunction createConfig(name: string, files: string[], parser: any, isTsrx: boolean) {\n\tconst rules: Record<string, string> = {\n\t\t'ripple/no-module-scope-track': 'error',\n\t\t'ripple/prefer-oninput': 'warn',\n\t\t'ripple/control-flow-jsx': 'error',\n\t\t'ripple/no-lazy-destructuring-in-modules': 'error',\n\t\t'ripple/valid-for-of-key': 'error',\n\t};\n\n\tif (isTsrx) {\n\t\trules['ripple/require-statement-container-body'] = 'error';\n\t}\n\n\tconst config: any = {\n\t\tname,\n\t\tfiles,\n\t\tplugins: {\n\t\t\tripple: plugin,\n\t\t},\n\t\trules,\n\t};\n\n\t// Only add parser if it's available\n\tif (parser) {\n\t\tconfig.languageOptions = {\n\t\t\tparser,\n\t\t\tparserOptions: {\n\t\t\t\tecmaVersion: 'latest',\n\t\t\t\tsourceType: 'module',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn config;\n}\n\n// Recommended configuration (flat config format)\nplugin.configs.recommended = [\n\tcreateConfig('ripple/recommended-ripple-files', ['**/*.tsrx'], rippleParser, true),\n\tcreateConfig('ripple/recommended-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),\n\t{\n\t\tname: 'ripple/ignores',\n\t\tignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],\n\t},\n];\n\n// Strict configuration (flat config format)\nplugin.configs.strict = [\n\tcreateConfig('ripple/strict-ripple-files', ['**/*.tsrx'], rippleParser, true),\n\tcreateConfig('ripple/strict-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),\n\t{\n\t\tname: 'ripple/ignores',\n\t\tignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],\n\t},\n];\n\nexport default plugin;\n"],"mappings":";;AAGA,MAAMA,SAAwB;CAC7B,MAAM;EACL,MAAM;EACN,MAAM;GACL,aAAa;GACb,aAAa;GACb;EACD,UAAU,EACT,aAAa,2EACb;EACD,QAAQ,EAAE;EACV;CACD,OAAO,SAAS;EACf,IAAI,gBAAgB;EAEpB,MAAM,+BAA+B;EACrC,MAAM,+BAA+B;EAErC,OAAO;GACN,qBAAqB;GACrB,4BAA4B;GAC5B,oBAAoB;GACpB,2BAA2B;GAC3B,yBAAyB;GACzB,gCAAgC;GAGhC,eAAe,MAA0B;IACxC,IACC,KAAK,OAAO,SAAS,gBACrB,KAAK,OAAO,SAAS,WACrB,kBAAkB,GAElB,QAAQ,OAAO;KACd;KACA,WAAW;KACX,CAAC;;GAGJ;;CAEF;;;ACxCD,MAAMC,SAAwB;CAC7B,MAAM;EACL,MAAM;EACN,MAAM;GACL,aAAa;GACb,aAAa;GACb;EACD,UAAU,EACT,eACC,8FACD;EACD,SAAS;EACT,QAAQ,EAAE;EACV;CACD,OAAO,SAAS;EACf,MAAM,kCAAkB,IAAI,KAAa;EAEzC,SAAS,gBAAgB,MAA8B;GACtD,MAAM,QAAQ,KAAK;GACnB,IAAI,CAAC,OACJ;GAGD,MAAM,MAAM,GAAG,MAAM,GAAG,GAAG,MAAM;GACjC,IAAI,gBAA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e;GACd,aAAa;GACb,YAAY;GACZ;EACD;CAGF,OAAO;;AAIR,OAAO,QAAQ,cAAc;CAC5B,aAAa,mCAAmC,CAAC,YAAY,EAAE,cAAc,KAAK;CAClF,aAAa,uCAAuC,CAAC,WAAW,WAAW,EAAE,UAAU,MAAM;CAC7F;EACC,MAAM;EACN,SAAS;GAAC;GAAa;GAAsB;GAAc;GAAc;EACzE;CACD;AAGD,OAAO,QAAQ,SAAS;CACvB,aAAa,8BAA8B,CAAC,YAAY,EAAE,cAAc,KAAK;CAC7E,aAAa,kCAAkC,CAAC,WAAW,WAAW,EAAE,UAAU,MAAM;CACxF;EACC,MAAM;EACN,SAAS;GAAC;GAAa;GAAsB;GAAc;GAAc;EACzE;CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsrx/eslint-plugin",
3
- "version": "0.3.72",
3
+ "version": "0.3.76",
4
4
  "description": "ESLint plugin for Ripple",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -33,7 +33,7 @@
33
33
  "peerDependencies": {
34
34
  "eslint": ">=9.0.0",
35
35
  "@typescript-eslint/parser": "^8.56.1",
36
- "@tsrx/eslint-parser": "0.3.72"
36
+ "@tsrx/eslint-parser": "0.3.76"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/eslint": "^9.6.1",
@@ -43,8 +43,8 @@
43
43
  "tsdown": "^0.22.0",
44
44
  "typescript": "^5.9.3",
45
45
  "vitest": "^4.1.6",
46
- "@tsrx/eslint-parser": "0.3.72",
47
- "@tsrx/core": "0.1.20"
46
+ "@tsrx/eslint-parser": "0.3.76",
47
+ "@tsrx/core": "0.1.24"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=22.0.0"
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ import noReturnInComponent from './rules/no-return-in-component.js';
5
5
  import controlFlowJsx from './rules/control-flow-jsx.js';
6
6
  import noLazyDestructuringInModules from './rules/no-lazy-destructuring-in-modules.js';
7
7
  import validForOfKey from './rules/valid-for-of-key.js';
8
+ import requireStatementContainerBody from './rules/require-statement-container-body.js';
8
9
 
9
10
  const plugin = {
10
11
  meta: {
@@ -18,6 +19,7 @@ const plugin = {
18
19
  'control-flow-jsx': controlFlowJsx,
19
20
  'no-lazy-destructuring-in-modules': noLazyDestructuringInModules,
20
21
  'valid-for-of-key': validForOfKey,
22
+ 'require-statement-container-body': requireStatementContainerBody,
21
23
  },
22
24
  configs: {} as any,
23
25
  };
@@ -43,20 +45,26 @@ try {
43
45
  }
44
46
 
45
47
  // Helper to create config objects
46
- function createConfig(name: string, files: string[], parser: any) {
48
+ function createConfig(name: string, files: string[], parser: any, isTsrx: boolean) {
49
+ const rules: Record<string, string> = {
50
+ 'ripple/no-module-scope-track': 'error',
51
+ 'ripple/prefer-oninput': 'warn',
52
+ 'ripple/control-flow-jsx': 'error',
53
+ 'ripple/no-lazy-destructuring-in-modules': 'error',
54
+ 'ripple/valid-for-of-key': 'error',
55
+ };
56
+
57
+ if (isTsrx) {
58
+ rules['ripple/require-statement-container-body'] = 'error';
59
+ }
60
+
47
61
  const config: any = {
48
62
  name,
49
63
  files,
50
64
  plugins: {
51
65
  ripple: plugin,
52
66
  },
53
- rules: {
54
- 'ripple/no-module-scope-track': 'error',
55
- 'ripple/prefer-oninput': 'warn',
56
- 'ripple/control-flow-jsx': 'error',
57
- 'ripple/no-lazy-destructuring-in-modules': 'error',
58
- 'ripple/valid-for-of-key': 'error',
59
- },
67
+ rules,
60
68
  };
61
69
 
62
70
  // Only add parser if it's available
@@ -75,8 +83,8 @@ function createConfig(name: string, files: string[], parser: any) {
75
83
 
76
84
  // Recommended configuration (flat config format)
77
85
  plugin.configs.recommended = [
78
- createConfig('ripple/recommended-ripple-files', ['**/*.tsrx'], rippleParser),
79
- createConfig('ripple/recommended-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser),
86
+ createConfig('ripple/recommended-ripple-files', ['**/*.tsrx'], rippleParser, true),
87
+ createConfig('ripple/recommended-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),
80
88
  {
81
89
  name: 'ripple/ignores',
82
90
  ignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],
@@ -85,8 +93,8 @@ plugin.configs.recommended = [
85
93
 
86
94
  // Strict configuration (flat config format)
87
95
  plugin.configs.strict = [
88
- createConfig('ripple/strict-ripple-files', ['**/*.tsrx'], rippleParser),
89
- createConfig('ripple/strict-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser),
96
+ createConfig('ripple/strict-ripple-files', ['**/*.tsrx'], rippleParser, true),
97
+ createConfig('ripple/strict-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),
90
98
  {
91
99
  name: 'ripple/ignores',
92
100
  ignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],