@clarusjs/eslint-plugin 0.1.1 → 0.2.1
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.js +17 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -32,13 +32,23 @@ function* expressions(nodes) {
|
|
|
32
32
|
}
|
|
33
33
|
yield* expressions(n.children);
|
|
34
34
|
}
|
|
35
|
-
else if (n.type === 'if')
|
|
35
|
+
else if (n.type === 'if') {
|
|
36
|
+
// @transition (name, options) around it: its arguments read script names too.
|
|
37
|
+
if (n.transition?.name)
|
|
38
|
+
yield n.transition.name;
|
|
39
|
+
if (n.transition?.options)
|
|
40
|
+
yield n.transition.options;
|
|
36
41
|
for (const b of n.branches) {
|
|
37
42
|
if (b.cond)
|
|
38
43
|
yield b.cond;
|
|
39
44
|
yield* expressions(b.children);
|
|
40
45
|
}
|
|
46
|
+
}
|
|
41
47
|
else if (n.type === 'for') {
|
|
48
|
+
if (n.transition?.name)
|
|
49
|
+
yield n.transition.name;
|
|
50
|
+
if (n.transition?.options)
|
|
51
|
+
yield n.transition.options;
|
|
42
52
|
yield n.list;
|
|
43
53
|
if (n.track)
|
|
44
54
|
yield n.track;
|
|
@@ -154,6 +164,7 @@ const usesVars = {
|
|
|
154
164
|
const template = {
|
|
155
165
|
meta: {
|
|
156
166
|
type: 'problem',
|
|
167
|
+
fixable: 'code',
|
|
157
168
|
docs: { description: 'The template rules of clarusjs check: unused inputs and imports, images without alt, labels and buttons without names' },
|
|
158
169
|
schema: [{ type: 'object', additionalProperties: { enum: ['off', 'warn', 'error'] } }],
|
|
159
170
|
},
|
|
@@ -170,8 +181,11 @@ const template = {
|
|
|
170
181
|
return;
|
|
171
182
|
} // the parser reports it
|
|
172
183
|
// One ESLint rule for them all: its severity is the configured one, and the finding's rule is in the message.
|
|
173
|
-
|
|
174
|
-
|
|
184
|
+
// A finding's fix applies with eslint --fix, as with clarusjs check --fix.
|
|
185
|
+
for (const m of found) {
|
|
186
|
+
const fix = m.fix;
|
|
187
|
+
context.report({ loc: { line: m.line, column: m.column - 1 }, message: `${m.message} (${m.rule})`, ...(fix ? { fix: (fixer) => fixer.replaceTextRange([fix.start, fix.end], fix.text) } : {}) });
|
|
188
|
+
}
|
|
175
189
|
},
|
|
176
190
|
};
|
|
177
191
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clarusjs/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Lint clarusjs .tscl components with ESLint: their <script> blocks with your rules, and the template rules of clarusjs check",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"clarusjs": ">=0.
|
|
31
|
+
"clarusjs": ">=0.17.0",
|
|
32
32
|
"eslint": "^9.0.0 || ^10.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^26.6.6",
|
|
36
36
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
37
|
-
"clarusjs": "0.
|
|
37
|
+
"clarusjs": "0.17.0",
|
|
38
38
|
"eslint": "10.15.0",
|
|
39
39
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
40
40
|
"typescript-eslint": "8.73.0",
|