@plumeria/eslint-plugin 16.2.4 → 16.2.5

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.
@@ -7,6 +7,7 @@ exports.styleNameRequiresImport = {
7
7
  docs: {
8
8
  description: 'Disallow styleName prop in files without a @plumeria/core import',
9
9
  },
10
+ fixable: 'code',
10
11
  messages: {
11
12
  styleNameError: 'styleName requires importing "@plumeria/core".',
12
13
  },
@@ -29,12 +30,18 @@ exports.styleNameRequiresImport = {
29
30
  },
30
31
  'Program:exit'() {
31
32
  if (!hasPlumeriaImport) {
32
- for (const node of styleNameNodes) {
33
+ styleNameNodes.forEach((node, index) => {
33
34
  context.report({
34
35
  node,
35
36
  messageId: 'styleNameError',
37
+ fix(fixer) {
38
+ if (index === 0) {
39
+ return fixer.insertTextBefore(context.sourceCode.ast, 'import "@plumeria/core";\n');
40
+ }
41
+ return null;
42
+ },
36
43
  });
37
- }
44
+ });
38
45
  }
39
46
  },
40
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/eslint-plugin",
3
- "version": "16.2.4",
3
+ "version": "16.2.5",
4
4
  "description": "Plumeria ESLint plugin",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",