@clarusjs/eslint-plugin 0.1.1 → 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 +6 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -154,6 +154,7 @@ const usesVars = {
154
154
  const template = {
155
155
  meta: {
156
156
  type: 'problem',
157
+ fixable: 'code',
157
158
  docs: { description: 'The template rules of clarusjs check: unused inputs and imports, images without alt, labels and buttons without names' },
158
159
  schema: [{ type: 'object', additionalProperties: { enum: ['off', 'warn', 'error'] } }],
159
160
  },
@@ -170,8 +171,11 @@ const template = {
170
171
  return;
171
172
  } // the parser reports it
172
173
  // One ESLint rule for them all: its severity is the configured one, and the finding's rule is in the message.
173
- for (const m of found)
174
- 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
+ }
175
179
  },
176
180
  };
177
181
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarusjs/eslint-plugin",
3
- "version": "0.1.1",
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.14.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.14.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",