@clarusjs/eslint-plugin 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -48,6 +48,11 @@ function* expressions(nodes) {
48
48
  }
49
49
  else if (n.type === 'fill')
50
50
  yield* expressions(n.children);
51
+ else if (n.type === 'await') {
52
+ yield n.expr;
53
+ for (const kids of [n.pending, ...(n.then ? [n.then.children] : []), ...(n.catch ? [n.catch.children] : [])])
54
+ yield* expressions(kids);
55
+ }
51
56
  }
52
57
  }
53
58
  /** The text ESLint parses: the script where it is, everything else spaces (line breaks kept). */
@@ -149,6 +154,7 @@ const usesVars = {
149
154
  const template = {
150
155
  meta: {
151
156
  type: 'problem',
157
+ fixable: 'code',
152
158
  docs: { description: 'The template rules of clarusjs check: unused inputs and imports, images without alt, labels and buttons without names' },
153
159
  schema: [{ type: 'object', additionalProperties: { enum: ['off', 'warn', 'error'] } }],
154
160
  },
@@ -165,8 +171,11 @@ const template = {
165
171
  return;
166
172
  } // the parser reports it
167
173
  // One ESLint rule for them all: its severity is the configured one, and the finding's rule is in the message.
168
- for (const m of found)
169
- context.report({ loc: { line: m.line, column: m.column - 1 }, message: `${m.message} (${m.rule})` });
174
+ // A finding's fix applies with eslint --fix, as with clarusjs check --fix.
175
+ for (const m of found) {
176
+ const fix = m.fix;
177
+ 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) } : {}) });
178
+ }
170
179
  },
171
180
  };
172
181
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarusjs/eslint-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
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.11.0",
31
+ "clarusjs": ">=0.16.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.11.0",
37
+ "clarusjs": "0.16.0",
38
38
  "eslint": "10.15.0",
39
39
  "typescript": "npm:@typescript/typescript6@6.0.2",
40
40
  "typescript-eslint": "8.73.0",