@lvce-editor/eslint-plugin-github-actions 2.8.0 → 2.10.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 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36,7 +36,8 @@ const meta$a = {
36
36
  },
37
37
  messages: {
38
38
  unsupportedActionVersion: 'Unsupported action version: {{value}}'
39
- }
39
+ },
40
+ fixable: 'code'
40
41
  };
41
42
  const create$a = context => {
42
43
  const sourceCode = getSourceCode(context);
@@ -50,10 +51,14 @@ const create$a = context => {
50
51
  for (const [key, value] of Object.entries(actions)) {
51
52
  if (nodeValue.startsWith(key) && !isSupported(value, nodeValue)) {
52
53
  context.report({
53
- node,
54
+ node: node.value,
54
55
  messageId: 'unsupportedActionVersion',
55
56
  data: {
56
57
  value: nodeValue
58
+ },
59
+ fix(fixer) {
60
+ const validText = value.at(-1) || '';
61
+ return fixer.replaceText(node.value, validText);
57
62
  }
58
63
  });
59
64
  }
@@ -165,7 +170,7 @@ const create$8 = context => {
165
170
  if (node && node.type === 'YAMLPair' && node.key && typeof node.key === 'object' && 'type' in node.key && node.key.type === 'YAMLScalar' && typeof node.key.value === 'string' && node.key.value === 'fail-fast' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar' && typeof node.value.value !== 'boolean') {
166
171
  const nodeValue = node.value.value;
167
172
  context.report({
168
- node,
173
+ node: node.value,
169
174
  messageId: 'unsupportedFailFast',
170
175
  data: {
171
176
  value: nodeValue
@@ -269,7 +274,7 @@ const create$5 = context => {
269
274
  }
270
275
  return {
271
276
  YAMLPair(node) {
272
- if (node && node.type === 'YAMLPair' && node.key && typeof node.key === 'object' && 'type' in node.key && node.key.type === 'YAMLScalar' && typeof node.key.value === 'string' && node.key.value === 'needs' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type !== 'YAMLSequence') {
277
+ if (node && node.type === 'YAMLPair' && node.key && typeof node.key === 'object' && 'type' in node.key && node.key.type === 'YAMLScalar' && typeof node.key.value === 'string' && node.key.value === 'needs' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type !== 'YAMLSequence' && !(node.value.type === 'YAMLScalar' && typeof node.value.value === 'string')) {
273
278
  context.report({
274
279
  node,
275
280
  messageId: 'unsupportedNeeds',
@@ -356,7 +361,7 @@ const create$3 = context => {
356
361
  const rest = nodeValue.slice('npm '.length);
357
362
  if (!isSupportedNpmCommand(rest)) {
358
363
  context.report({
359
- node,
364
+ node: node.value,
360
365
  messageId: 'unsupportedNpmCommand',
361
366
  data: {
362
367
  value: nodeValue
@@ -472,7 +477,7 @@ const create = context => {
472
477
  if (node && node.type === 'YAMLPair' && node.key && typeof node.key === 'object' && 'type' in node.key && node.key.type === 'YAMLScalar' && typeof node.key.value === 'string' && node.key.value === 'timeout-minutes' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar' && typeof node.value.value !== 'number') {
473
478
  const nodeValue = node.value.value;
474
479
  context.report({
475
- node,
480
+ node: node.value,
476
481
  messageId: 'unsupportedTimeoutMinutes',
477
482
  data: {
478
483
  value: nodeValue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-plugin-github-actions",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],