@tsrx/eslint-plugin 0.3.74 → 0.3.77
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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -24
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +20 -12
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
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;
|
|
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$
|
|
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$
|
|
35
|
+
const rule$5 = {
|
|
36
36
|
meta: {
|
|
37
37
|
type: "suggestion",
|
|
38
38
|
docs: {
|
|
@@ -77,7 +77,7 @@ const rule$4 = {
|
|
|
77
77
|
};
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/rules/no-return-in-component.ts
|
|
80
|
-
const rule$
|
|
80
|
+
const rule$4 = {
|
|
81
81
|
meta: {
|
|
82
82
|
type: "problem",
|
|
83
83
|
docs: {
|
|
@@ -140,7 +140,7 @@ const NESTED_BOUNDARY_TYPES = new Set([
|
|
|
140
140
|
"MethodDefinition",
|
|
141
141
|
"PropertyDefinition"
|
|
142
142
|
]);
|
|
143
|
-
const rule$
|
|
143
|
+
const rule$3 = {
|
|
144
144
|
meta: {
|
|
145
145
|
type: "problem",
|
|
146
146
|
docs: {
|
|
@@ -224,7 +224,7 @@ const rule$2 = {
|
|
|
224
224
|
};
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/rules/no-lazy-destructuring-in-modules.ts
|
|
227
|
-
const rule$
|
|
227
|
+
const rule$2 = {
|
|
228
228
|
meta: {
|
|
229
229
|
type: "problem",
|
|
230
230
|
docs: {
|
|
@@ -255,7 +255,7 @@ const rule$1 = {
|
|
|
255
255
|
};
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/rules/valid-for-of-key.ts
|
|
258
|
-
const rule = {
|
|
258
|
+
const rule$1 = {
|
|
259
259
|
meta: {
|
|
260
260
|
type: "problem",
|
|
261
261
|
docs: {
|
|
@@ -336,6 +336,35 @@ function findVariable(scope, name) {
|
|
|
336
336
|
return null;
|
|
337
337
|
}
|
|
338
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
|
|
339
368
|
//#region src/index.ts
|
|
340
369
|
const plugin = {
|
|
341
370
|
meta: {
|
|
@@ -343,12 +372,41 @@ const plugin = {
|
|
|
343
372
|
version: "0.1.3"
|
|
344
373
|
},
|
|
345
374
|
rules: {
|
|
346
|
-
"no-module-scope-track": rule$
|
|
347
|
-
"prefer-oninput": rule$
|
|
348
|
-
"no-return-in-component": rule$
|
|
349
|
-
"control-flow-jsx": rule$
|
|
350
|
-
"no-lazy-destructuring-in-modules": rule$
|
|
351
|
-
"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
|
+
}
|
|
352
410
|
},
|
|
353
411
|
configs: {}
|
|
354
412
|
};
|
|
@@ -365,18 +423,20 @@ try {
|
|
|
365
423
|
} catch {
|
|
366
424
|
tsParser = null;
|
|
367
425
|
}
|
|
368
|
-
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";
|
|
369
435
|
const config = {
|
|
370
436
|
name,
|
|
371
437
|
files,
|
|
372
438
|
plugins: { ripple: plugin },
|
|
373
|
-
rules
|
|
374
|
-
"ripple/no-module-scope-track": "error",
|
|
375
|
-
"ripple/prefer-oninput": "warn",
|
|
376
|
-
"ripple/control-flow-jsx": "error",
|
|
377
|
-
"ripple/no-lazy-destructuring-in-modules": "error",
|
|
378
|
-
"ripple/valid-for-of-key": "error"
|
|
379
|
-
}
|
|
439
|
+
rules
|
|
380
440
|
};
|
|
381
441
|
if (parser) config.languageOptions = {
|
|
382
442
|
parser,
|
|
@@ -388,8 +448,8 @@ function createConfig(name, files, parser) {
|
|
|
388
448
|
return config;
|
|
389
449
|
}
|
|
390
450
|
plugin.configs.recommended = [
|
|
391
|
-
createConfig("ripple/recommended-ripple-files", ["**/*.tsrx"], rippleParser),
|
|
392
|
-
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),
|
|
393
453
|
{
|
|
394
454
|
name: "ripple/ignores",
|
|
395
455
|
ignores: [
|
|
@@ -401,8 +461,8 @@ plugin.configs.recommended = [
|
|
|
401
461
|
}
|
|
402
462
|
];
|
|
403
463
|
plugin.configs.strict = [
|
|
404
|
-
createConfig("ripple/strict-ripple-files", ["**/*.tsrx"], rippleParser),
|
|
405
|
-
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),
|
|
406
466
|
{
|
|
407
467
|
name: "ripple/ignores",
|
|
408
468
|
ignores: [
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["rule","rule","rule","NESTED_BOUNDARY_TYPES","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: 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 { 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;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,gBAAgB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C,CAAC,WAAW,WAAW,EAAE,SAAS;CACtF;EACC,MAAM;EACN,SAAS;GAAC;GAAa;GAAsB;GAAc;GAAc;EACzE;CACD;AAGD,OAAO,QAAQ,SAAS;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,S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I,QACH,MAAM,6CAA6C;CAGpD,MAAM,SAAc;EACnB;EACA;EACA,SAAS,EACR,QAAQ,QACR;EACD;EACA;CAGD,IAAI,QACH,OAAO,kBAAkB;EACxB;EACA,eAAe;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.
|
|
3
|
+
"version": "0.3.77",
|
|
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.
|
|
36
|
+
"@tsrx/eslint-parser": "0.3.77"
|
|
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.
|
|
47
|
-
"@tsrx/core": "0.1.
|
|
46
|
+
"@tsrx/eslint-parser": "0.3.77",
|
|
47
|
+
"@tsrx/core": "0.1.25"
|
|
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/**'],
|