@lvce-editor/eslint-plugin-github-actions 11.1.0 → 12.0.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 +261 -255
  2. package/package.json +1 -2
package/dist/index.js CHANGED
@@ -4,14 +4,14 @@ import { existsSync } from 'fs';
4
4
  import { resolve, relative } from 'path';
5
5
 
6
6
  const config = {
7
- ubuntu: ['ubuntu-24.04', 'ubuntu-24.04-arm'],
8
7
  macos: ['macos-15', 'macos-26'],
8
+ ubuntu: ['ubuntu-24.04', 'ubuntu-24.04-arm'],
9
9
  windows: ['windows-2025', 'windows-11-arm']
10
10
  };
11
11
  const platforms = {
12
- windows: 'windows',
12
+ macos: 'macos',
13
13
  ubuntu: 'ubuntu',
14
- macos: 'macos'
14
+ windows: 'windows'
15
15
  };
16
16
  const actions = {
17
17
  'actions/cache': ['actions/cache@v5'],
@@ -30,8 +30,8 @@ const npmCommands = ['run', 'test', 'publish', 'install', 'ci'];
30
30
  const shells = ['bash'];
31
31
  const pythonVersions = ['3.13', '3.14', '3.15'];
32
32
  const permissions$1 = {
33
- 'id-token': ['write'],
34
33
  contents: ['write'],
34
+ 'id-token': ['write'],
35
35
  pages: ['write']
36
36
  };
37
37
 
@@ -39,14 +39,14 @@ const isSupported = (actions, value) => {
39
39
  return actions.includes(value);
40
40
  };
41
41
  const meta$g = {
42
- type: 'problem',
43
42
  docs: {
44
43
  description: 'Disallow unsupported action versions'
45
44
  },
45
+ fixable: 'code',
46
46
  messages: {
47
47
  unsupportedActionVersion: 'Unsupported action version: {{value}}'
48
48
  },
49
- fixable: 'code'
49
+ type: 'problem'
50
50
  };
51
51
  const create$g = context => {
52
52
  const sourceCode = getSourceCode(context);
@@ -60,15 +60,15 @@ const create$g = context => {
60
60
  for (const [key, value] of Object.entries(actions)) {
61
61
  if (nodeValue.startsWith(key) && !isSupported(value, nodeValue)) {
62
62
  context.report({
63
- node: node.value,
64
- messageId: 'unsupportedActionVersion',
65
63
  data: {
66
64
  value: nodeValue
67
65
  },
68
66
  fix(fixer) {
69
67
  const validText = value.at(-1) || '';
70
68
  return fixer.replaceText(node.value, validText);
71
- }
69
+ },
70
+ messageId: 'unsupportedActionVersion',
71
+ node: node.value
72
72
  });
73
73
  }
74
74
  }
@@ -105,13 +105,13 @@ const isSupportedWindowsVersion = version => {
105
105
  return config.windows.includes(version);
106
106
  };
107
107
  const meta$f = {
108
- type: 'problem',
109
108
  docs: {
110
109
  description: 'Disallow unsupported ci versions'
111
110
  },
112
111
  messages: {
113
112
  unsupportedCiVersion: 'Unsupported ci version: {{value}}'
114
- }
113
+ },
114
+ type: 'problem'
115
115
  };
116
116
  const create$f = context => {
117
117
  const sourceCode = getSourceCode(context);
@@ -119,17 +119,17 @@ const create$f = context => {
119
119
  return {};
120
120
  }
121
121
  const checks = [{
122
- prefix: `${platforms.ubuntu}-`,
122
+ isSupported: isSupportedUbuntuVersion,
123
123
  parseVersion: parseUbuntuVersion,
124
- isSupported: isSupportedUbuntuVersion
124
+ prefix: `${platforms.ubuntu}-`
125
125
  }, {
126
- prefix: `${platforms.macos}-`,
126
+ isSupported: isSupportedMacosversion,
127
127
  parseVersion: parseMacosVersion,
128
- isSupported: isSupportedMacosversion
128
+ prefix: `${platforms.macos}-`
129
129
  }, {
130
- prefix: `${platforms.windows}-`,
130
+ isSupported: isSupportedWindowsVersion,
131
131
  parseVersion: parseWindowsVersion,
132
- isSupported: isSupportedWindowsVersion
132
+ prefix: `${platforms.windows}-`
133
133
  }];
134
134
  return {
135
135
  YAMLScalar(node) {
@@ -140,11 +140,11 @@ const create$f = context => {
140
140
  const isSupported = check.isSupported(version);
141
141
  if (!isSupported) {
142
142
  context.report({
143
- node,
144
- messageId: 'unsupportedCiVersion',
145
143
  data: {
146
144
  value: node.value
147
- }
145
+ },
146
+ messageId: 'unsupportedCiVersion',
147
+ node
148
148
  });
149
149
  }
150
150
  }
@@ -161,13 +161,13 @@ const ciVersions = {
161
161
  };
162
162
 
163
163
  const meta$e = {
164
- type: 'problem',
165
164
  docs: {
166
165
  description: 'Disallow unsupported fail fast values'
167
166
  },
168
167
  messages: {
169
168
  unsupportedFailFast: 'Unsupported fail fast value: {{value}}'
170
- }
169
+ },
170
+ type: 'problem'
171
171
  };
172
172
  const create$e = context => {
173
173
  const sourceCode = getSourceCode(context);
@@ -179,11 +179,11 @@ const create$e = context => {
179
179
  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') {
180
180
  const nodeValue = node.value.value;
181
181
  context.report({
182
- node: node.value,
183
- messageId: 'unsupportedFailFast',
184
182
  data: {
185
183
  value: nodeValue
186
- }
184
+ },
185
+ messageId: 'unsupportedFailFast',
186
+ node: node.value
187
187
  });
188
188
  }
189
189
  }
@@ -197,15 +197,53 @@ const failFast = {
197
197
  };
198
198
 
199
199
  const meta$d = {
200
- type: 'problem',
200
+ docs: {
201
+ description: 'Disallow unsupported github token values'
202
+ },
203
+ messages: {
204
+ unsupportedGithubToken: 'Unsupported github token value: {{value}}'
205
+ },
206
+ type: 'problem'
207
+ };
208
+ const create$d = context => {
209
+ const sourceCode = getSourceCode(context);
210
+ if (!sourceCode.parserServices?.isYAML) {
211
+ return {};
212
+ }
213
+ return {
214
+ YAMLPair(node) {
215
+ 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 === 'GITHUB_TOKEN' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
216
+ const nodeValue = node.value.value;
217
+ if (typeof nodeValue !== 'string' || nodeValue !== '${{ secrets.GITHUB_TOKEN }}') {
218
+ context.report({
219
+ data: {
220
+ value: nodeValue
221
+ },
222
+ messageId: 'unsupportedGithubToken',
223
+ node
224
+ });
225
+ }
226
+ }
227
+ }
228
+ };
229
+ };
230
+
231
+ const githubToken = {
232
+ __proto__: null,
233
+ create: create$d,
234
+ meta: meta$d
235
+ };
236
+
237
+ const meta$c = {
201
238
  docs: {
202
239
  description: 'Disallow unsupported matrix values'
203
240
  },
204
241
  messages: {
205
242
  unsupportedMatrix: 'Unsupported matrix value: {{value}}'
206
- }
243
+ },
244
+ type: 'problem'
207
245
  };
208
- const create$d = context => {
246
+ const create$c = context => {
209
247
  const sourceCode = getSourceCode(context);
210
248
  if (!sourceCode.parserServices?.isYAML) {
211
249
  return {};
@@ -214,12 +252,12 @@ const create$d = context => {
214
252
  YAMLPair(node) {
215
253
  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 === 'matrix' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type !== 'YAMLSequence') {
216
254
  context.report({
217
- node,
218
- messageId: 'unsupportedMatrix',
219
255
  data: {
220
256
  // @ts-ignore
221
257
  value: node.value
222
- }
258
+ },
259
+ messageId: 'unsupportedMatrix',
260
+ node
223
261
  });
224
262
  }
225
263
  }
@@ -228,20 +266,20 @@ const create$d = context => {
228
266
 
229
267
  const matrix = {
230
268
  __proto__: null,
231
- create: create$d,
232
- meta: meta$d
269
+ create: create$c,
270
+ meta: meta$c
233
271
  };
234
272
 
235
- const meta$c = {
236
- type: 'problem',
273
+ const meta$b = {
237
274
  docs: {
238
275
  description: 'Disallow unsupported max parallel values'
239
276
  },
240
277
  messages: {
241
278
  unsupportedMaxParallel: 'Unsupported max parallel value: {{value}}'
242
- }
279
+ },
280
+ type: 'problem'
243
281
  };
244
- const create$c = context => {
282
+ const create$b = context => {
245
283
  const sourceCode = getSourceCode(context);
246
284
  if (!sourceCode.parserServices?.isYAML) {
247
285
  return {};
@@ -251,11 +289,11 @@ const create$c = context => {
251
289
  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 === 'max-parallel' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar' && typeof node.value.value !== 'number') {
252
290
  const nodeValue = node.value.value;
253
291
  context.report({
254
- node,
255
- messageId: 'unsupportedMaxParallel',
256
292
  data: {
257
293
  value: nodeValue
258
- }
294
+ },
295
+ messageId: 'unsupportedMaxParallel',
296
+ node
259
297
  });
260
298
  }
261
299
  }
@@ -264,33 +302,35 @@ const create$c = context => {
264
302
 
265
303
  const maxParallel = {
266
304
  __proto__: null,
267
- create: create$c,
268
- meta: meta$c
305
+ create: create$b,
306
+ meta: meta$b
269
307
  };
270
308
 
271
- const meta$b = {
272
- type: 'problem',
309
+ const meta$a = {
273
310
  docs: {
274
311
  description: 'Disallow unsupported needs values'
275
312
  },
276
313
  messages: {
277
314
  unsupportedNeeds: 'Unsupported needs value: {{value}}'
278
- }
315
+ },
316
+ type: 'problem'
279
317
  };
280
318
  const stringifyValue = node => {
281
319
  if (!node) {
282
320
  return '';
283
321
  }
284
322
  if (node.type === 'YAMLScalar') {
285
- return `${node.value}`;
323
+ return String(node.value);
286
324
  }
287
- return `${node.type}`;
325
+ return node.type;
288
326
  };
289
327
  const getValidNeeds = node => {
290
328
  const greatGrandParent = node.parent.parent.parent;
291
329
  const validNeeds = [];
292
330
  if (greatGrandParent.type === 'YAMLMapping') {
293
- const pairs = greatGrandParent.pairs;
331
+ const {
332
+ pairs
333
+ } = greatGrandParent;
294
334
  for (const pair of pairs) {
295
335
  if (pair.key && pair.key.type === 'YAMLScalar' && typeof pair.key.value === 'string') {
296
336
  validNeeds.push(pair.key.value);
@@ -299,7 +339,7 @@ const getValidNeeds = node => {
299
339
  }
300
340
  return validNeeds;
301
341
  };
302
- const create$b = context => {
342
+ const create$a = context => {
303
343
  const sourceCode = getSourceCode(context);
304
344
  if (!sourceCode.parserServices?.isYAML) {
305
345
  return {};
@@ -311,11 +351,11 @@ const create$b = context => {
311
351
  if (node.value.type === 'YAMLScalar' && typeof node.value.value === 'string') {
312
352
  if (!validNeeds.includes(node.value.value)) {
313
353
  context.report({
314
- node,
315
- messageId: 'unsupportedNeeds',
316
354
  data: {
317
355
  value: stringifyValue(node.value)
318
- }
356
+ },
357
+ messageId: 'unsupportedNeeds',
358
+ node
319
359
  });
320
360
  }
321
361
  return;
@@ -324,32 +364,32 @@ const create$b = context => {
324
364
  for (const item of node.value.entries) {
325
365
  if (!item || item.type !== 'YAMLScalar' || typeof item.value !== 'string') {
326
366
  context.report({
327
- node,
328
- messageId: 'unsupportedNeeds',
329
367
  data: {
330
368
  value: stringifyValue(item)
331
- }
369
+ },
370
+ messageId: 'unsupportedNeeds',
371
+ node
332
372
  });
333
373
  continue;
334
374
  }
335
375
  if (!validNeeds.includes(item.value)) {
336
376
  context.report({
337
- node,
338
- messageId: 'unsupportedNeeds',
339
377
  data: {
340
378
  value: stringifyValue(item)
341
- }
379
+ },
380
+ messageId: 'unsupportedNeeds',
381
+ node
342
382
  });
343
383
  }
344
384
  }
345
385
  return;
346
386
  }
347
387
  context.report({
348
- node,
349
- messageId: 'unsupportedNeeds',
350
388
  data: {
351
389
  value: stringifyValue(node.value)
352
- }
390
+ },
391
+ messageId: 'unsupportedNeeds',
392
+ node
353
393
  });
354
394
  }
355
395
  }
@@ -358,20 +398,20 @@ const create$b = context => {
358
398
 
359
399
  const needs = {
360
400
  __proto__: null,
361
- create: create$b,
362
- meta: meta$b
401
+ create: create$a,
402
+ meta: meta$a
363
403
  };
364
404
 
365
- const meta$a = {
366
- type: 'problem',
405
+ const meta$9 = {
367
406
  docs: {
368
407
  description: 'Disallow unsupported node version file values'
369
408
  },
370
409
  messages: {
371
410
  unsupportedNodeVersionFile: 'Unsupported node version file value: {{value}}'
372
- }
411
+ },
412
+ type: 'problem'
373
413
  };
374
- const create$a = context => {
414
+ const create$9 = context => {
375
415
  const sourceCode = getSourceCode(context);
376
416
  if (!sourceCode.parserServices?.isYAML) {
377
417
  return {};
@@ -382,11 +422,11 @@ const create$a = context => {
382
422
  const nodeValue = node.value.value;
383
423
  if (typeof nodeValue !== 'string' || nodeValue !== '.nvmrc') {
384
424
  context.report({
385
- node,
386
- messageId: 'unsupportedNodeVersionFile',
387
425
  data: {
388
426
  value: nodeValue
389
- }
427
+ },
428
+ messageId: 'unsupportedNodeVersionFile',
429
+ node
390
430
  });
391
431
  }
392
432
  }
@@ -396,20 +436,20 @@ const create$a = context => {
396
436
 
397
437
  const nodeVersionFile = {
398
438
  __proto__: null,
399
- create: create$a,
400
- meta: meta$a
439
+ create: create$9,
440
+ meta: meta$9
401
441
  };
402
442
 
403
- const meta$9 = {
404
- type: 'problem',
443
+ const meta$8 = {
405
444
  docs: {
406
445
  description: 'Disallow unsupported npm registry values'
407
446
  },
408
447
  messages: {
409
448
  unsupportedNpmRegistry: 'Unsupported npm registry value: {{value}}'
410
- }
449
+ },
450
+ type: 'problem'
411
451
  };
412
- const create$9 = context => {
452
+ const create$8 = context => {
413
453
  const sourceCode = getSourceCode(context);
414
454
  if (!sourceCode.parserServices?.isYAML) {
415
455
  return {};
@@ -420,11 +460,11 @@ const create$9 = context => {
420
460
  const nodeValue = node.value.value;
421
461
  if (typeof nodeValue !== 'string' || !npmRegistries.includes(nodeValue)) {
422
462
  context.report({
423
- node,
424
- messageId: 'unsupportedNpmRegistry',
425
463
  data: {
426
464
  value: nodeValue
427
- }
465
+ },
466
+ messageId: 'unsupportedNpmRegistry',
467
+ node
428
468
  });
429
469
  }
430
470
  }
@@ -434,18 +474,18 @@ const create$9 = context => {
434
474
 
435
475
  const npmRegistry = {
436
476
  __proto__: null,
437
- create: create$9,
438
- meta: meta$9
477
+ create: create$8,
478
+ meta: meta$8
439
479
  };
440
480
 
441
- const meta$8 = {
442
- type: 'problem',
481
+ const meta$7 = {
443
482
  docs: {
444
483
  description: 'Disallow unsupported npm commands'
445
484
  },
446
485
  messages: {
447
486
  unsupportedNpmCommand: 'Unsupported npm command: {{value}}'
448
- }
487
+ },
488
+ type: 'problem'
449
489
  };
450
490
  const isSupportedNpmCommand = value => {
451
491
  for (const npmCommand of npmCommands) {
@@ -455,7 +495,7 @@ const isSupportedNpmCommand = value => {
455
495
  }
456
496
  return false;
457
497
  };
458
- const create$8 = context => {
498
+ const create$7 = context => {
459
499
  const sourceCode = getSourceCode(context);
460
500
  if (!sourceCode.parserServices?.isYAML) {
461
501
  return {};
@@ -468,11 +508,11 @@ const create$8 = context => {
468
508
  const rest = nodeValue.slice('npm '.length);
469
509
  if (!isSupportedNpmCommand(rest)) {
470
510
  context.report({
471
- node: node.value,
472
- messageId: 'unsupportedNpmCommand',
473
511
  data: {
474
512
  value: nodeValue
475
- }
513
+ },
514
+ messageId: 'unsupportedNpmCommand',
515
+ node: node.value
476
516
  });
477
517
  }
478
518
  }
@@ -483,20 +523,20 @@ const create$8 = context => {
483
523
 
484
524
  const npm = {
485
525
  __proto__: null,
486
- create: create$8,
487
- meta: meta$8
526
+ create: create$7,
527
+ meta: meta$7
488
528
  };
489
529
 
490
- const meta$7 = {
491
- type: 'problem',
530
+ const meta$6 = {
492
531
  docs: {
493
532
  description: 'Disallow unsupported on values'
494
533
  },
495
534
  messages: {
496
535
  unsupportedOn: 'Unsupported on value: {{value}}'
497
- }
536
+ },
537
+ type: 'problem'
498
538
  };
499
- const create$7 = context => {
539
+ const create$6 = context => {
500
540
  const sourceCode = getSourceCode(context);
501
541
  if (!sourceCode.parserServices?.isYAML) {
502
542
  return {};
@@ -504,15 +544,17 @@ const create$7 = context => {
504
544
  return {
505
545
  YAMLPair(node) {
506
546
  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 === 'on' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLMapping') {
507
- const pairs = node.value.pairs;
547
+ const {
548
+ pairs
549
+ } = node.value;
508
550
  for (const pair of pairs) {
509
551
  if (pair.key && pair.key.type === 'YAMLScalar' && typeof pair.key.value === 'string' && !onProperties.includes(pair.key.value)) {
510
552
  context.report({
511
- node,
512
- messageId: 'unsupportedOn',
513
553
  data: {
514
554
  value: pair.key.value
515
- }
555
+ },
556
+ messageId: 'unsupportedOn',
557
+ node
516
558
  });
517
559
  }
518
560
  }
@@ -523,20 +565,20 @@ const create$7 = context => {
523
565
 
524
566
  const on = {
525
567
  __proto__: null,
526
- create: create$7,
527
- meta: meta$7
568
+ create: create$6,
569
+ meta: meta$6
528
570
  };
529
571
 
530
- const meta$6 = {
531
- type: 'problem',
572
+ const meta$5 = {
532
573
  docs: {
533
574
  description: 'Disallow unsupported permission values'
534
575
  },
535
576
  messages: {
536
577
  unsupportedPermission: 'Unsupported permission value: {{value}}'
537
- }
578
+ },
579
+ type: 'problem'
538
580
  };
539
- const create$6 = context => {
581
+ const create$5 = context => {
540
582
  const sourceCode = getSourceCode(context);
541
583
  if (!sourceCode.parserServices?.isYAML) {
542
584
  return {};
@@ -547,29 +589,29 @@ const create$6 = context => {
547
589
  for (const pair of node.value.pairs) {
548
590
  if (pair.key && pair.key.type === 'YAMLScalar' && typeof pair.key.value === 'string') {
549
591
  const supportedKey = Object.hasOwn(permissions$1, pair.key.value);
550
- if (!supportedKey) {
551
- context.report({
552
- node: pair.key,
553
- messageId: 'unsupportedPermission',
554
- data: {
555
- // @ts-ignore
556
- value: pair
557
- }
558
- });
559
- } else {
592
+ if (supportedKey) {
560
593
  if (pair.value && pair.value.type === 'YAMLScalar' && typeof pair.value.value === 'string') {
561
594
  const items = permissions$1[pair.key.value] || [];
562
595
  if (!items.includes(pair.value.value)) {
563
596
  context.report({
564
- node,
565
- messageId: 'unsupportedPermission',
566
597
  data: {
567
598
  // @ts-ignore
568
599
  value: pair.value
569
- }
600
+ },
601
+ messageId: 'unsupportedPermission',
602
+ node
570
603
  });
571
604
  }
572
605
  }
606
+ } else {
607
+ context.report({
608
+ data: {
609
+ // @ts-ignore
610
+ value: pair
611
+ },
612
+ messageId: 'unsupportedPermission',
613
+ node: pair.key
614
+ });
573
615
  }
574
616
  }
575
617
  }
@@ -580,20 +622,20 @@ const create$6 = context => {
580
622
 
581
623
  const permissions = {
582
624
  __proto__: null,
583
- create: create$6,
584
- meta: meta$6
625
+ create: create$5,
626
+ meta: meta$5
585
627
  };
586
628
 
587
- const meta$5 = {
588
- type: 'problem',
629
+ const meta$4 = {
589
630
  docs: {
590
631
  description: 'Disallow unsupported python versions'
591
632
  },
592
633
  messages: {
593
634
  unsupportedPythonVersion: 'Unsupported python version: {{value}}'
594
- }
635
+ },
636
+ type: 'problem'
595
637
  };
596
- const create$5 = context => {
638
+ const create$4 = context => {
597
639
  const sourceCode = getSourceCode(context);
598
640
  if (!sourceCode.parserServices?.isYAML) {
599
641
  return {};
@@ -604,11 +646,11 @@ const create$5 = context => {
604
646
  const nodeValue = node.value.value;
605
647
  if (typeof nodeValue !== 'string' || !pythonVersions.includes(nodeValue)) {
606
648
  context.report({
607
- node,
608
- messageId: 'unsupportedPythonVersion',
609
649
  data: {
610
650
  value: nodeValue
611
- }
651
+ },
652
+ messageId: 'unsupportedPythonVersion',
653
+ node
612
654
  });
613
655
  }
614
656
  }
@@ -618,20 +660,72 @@ const create$5 = context => {
618
660
 
619
661
  const pythonVersion = {
620
662
  __proto__: null,
621
- create: create$5,
622
- meta: meta$5
663
+ create: create$4,
664
+ meta: meta$4
623
665
  };
624
666
 
625
- const meta$4 = {
626
- type: 'problem',
667
+ const meta$3 = {
668
+ docs: {
669
+ description: 'Disallow unsupported release action usage'
670
+ },
671
+ fixable: 'code',
672
+ messages: {
673
+ unsupportedReleaseAction: 'Unsupported release action'
674
+ },
675
+ type: 'problem'
676
+ };
677
+ const create$3 = context => {
678
+ const sourceCode = getSourceCode(context);
679
+ if (!sourceCode.parserServices?.isYAML) {
680
+ return {};
681
+ }
682
+ return {
683
+ YAMLPair(node) {
684
+ 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 === 'uses' && node.value && node.value.type === 'YAMLScalar' && node.value.value === 'actions/create-release@v1') {
685
+ context.report({
686
+ data: {},
687
+ fix(fixer) {
688
+ const edits = [];
689
+ const {
690
+ parent
691
+ } = node;
692
+ edits.push(fixer.replaceText(node.value, 'softprops/action-gh-release@v2'));
693
+ for (const pair of parent.pairs) {
694
+ if (pair.key && pair.key.type === 'YAMLScalar' && pair.key.value === 'with' && pair.value?.type == 'YAMLMapping') {
695
+ const subPairs = pair.value.pairs;
696
+ for (const subPair of subPairs) {
697
+ if (subPair.key?.type === 'YAMLScalar' && subPair.key.value === 'release_name') {
698
+ edits.push(fixer.replaceText(subPair.key, 'name'));
699
+ }
700
+ }
701
+ }
702
+ }
703
+ return edits;
704
+ },
705
+ messageId: 'unsupportedReleaseAction',
706
+ node
707
+ });
708
+ }
709
+ }
710
+ };
711
+ };
712
+
713
+ const releaseAction = {
714
+ __proto__: null,
715
+ create: create$3,
716
+ meta: meta$3
717
+ };
718
+
719
+ const meta$2 = {
627
720
  docs: {
628
721
  description: 'Disallow unsupported shell values'
629
722
  },
630
723
  messages: {
631
724
  unsupportedShell: 'Unsupported shell value: {{value}}'
632
- }
725
+ },
726
+ type: 'problem'
633
727
  };
634
- const create$4 = context => {
728
+ const create$2 = context => {
635
729
  const sourceCode = getSourceCode(context);
636
730
  if (!sourceCode.parserServices?.isYAML) {
637
731
  return {};
@@ -642,11 +736,11 @@ const create$4 = context => {
642
736
  const nodeValue = node.value.value;
643
737
  if (typeof nodeValue !== 'string' || !shells.includes(nodeValue)) {
644
738
  context.report({
645
- node,
646
- messageId: 'unsupportedShell',
647
739
  data: {
648
740
  value: nodeValue
649
- }
741
+ },
742
+ messageId: 'unsupportedShell',
743
+ node
650
744
  });
651
745
  }
652
746
  }
@@ -656,20 +750,20 @@ const create$4 = context => {
656
750
 
657
751
  const shell = {
658
752
  __proto__: null,
659
- create: create$4,
660
- meta: meta$4
753
+ create: create$2,
754
+ meta: meta$2
661
755
  };
662
756
 
663
- const meta$3 = {
664
- type: 'problem',
757
+ const meta$1 = {
665
758
  docs: {
666
759
  description: 'Disallow unsupported timeout minute values'
667
760
  },
668
761
  messages: {
669
762
  unsupportedTimeoutMinutes: 'Unsupported timeout minutes value: {{value}}'
670
- }
763
+ },
764
+ type: 'problem'
671
765
  };
672
- const create$3 = context => {
766
+ const create$1 = context => {
673
767
  const sourceCode = getSourceCode(context);
674
768
  if (!sourceCode.parserServices?.isYAML) {
675
769
  return {};
@@ -679,11 +773,11 @@ const create$3 = context => {
679
773
  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') {
680
774
  const nodeValue = node.value.value;
681
775
  context.report({
682
- node: node.value,
683
- messageId: 'unsupportedTimeoutMinutes',
684
776
  data: {
685
777
  value: nodeValue
686
- }
778
+ },
779
+ messageId: 'unsupportedTimeoutMinutes',
780
+ node: node.value
687
781
  });
688
782
  }
689
783
  }
@@ -692,19 +786,19 @@ const create$3 = context => {
692
786
 
693
787
  const timeoutMinutes = {
694
788
  __proto__: null,
695
- create: create$3,
696
- meta: meta$3
789
+ create: create$1,
790
+ meta: meta$1
697
791
  };
698
792
 
699
- const meta$2 = {
700
- type: 'problem',
793
+ const meta = {
701
794
  docs: {
702
795
  description: 'Disallow non-existing working directories'
703
796
  },
704
797
  messages: {
705
798
  invalidWorkingDirectory: 'Working directory not found: {{value}}',
706
799
  workingDirectoryMustBeOfTypeString: 'Working directory must be of type string'
707
- }
800
+ },
801
+ type: 'problem'
708
802
  };
709
803
  const allowedNonExistingWorkingDirectories = ['dist', '.tmp'];
710
804
  const isAllowedNonExistingWorkingDirectory = relativePath => {
@@ -715,7 +809,7 @@ const isAllowedNonExistingWorkingDirectory = relativePath => {
715
809
  }
716
810
  return false;
717
811
  };
718
- const create$2 = context => {
812
+ const create = context => {
719
813
  const sourceCode = getSourceCode(context);
720
814
  if (!sourceCode.parserServices?.isYAML) {
721
815
  return {};
@@ -726,11 +820,11 @@ const create$2 = context => {
726
820
  const nodeValue = node.value.value;
727
821
  if (typeof nodeValue !== 'string') {
728
822
  context.report({
729
- node,
730
- messageId: 'workingDirectoryMustBeOfTypeString',
731
823
  data: {
732
824
  value: nodeValue
733
- }
825
+ },
826
+ messageId: 'workingDirectoryMustBeOfTypeString',
827
+ node
734
828
  });
735
829
  return;
736
830
  }
@@ -738,11 +832,11 @@ const create$2 = context => {
738
832
  const relativePath = relative(context.cwd, path);
739
833
  if (!isAllowedNonExistingWorkingDirectory(relativePath) && !existsSync(path)) {
740
834
  context.report({
741
- node,
742
- messageId: 'invalidWorkingDirectory',
743
835
  data: {
744
836
  value: nodeValue
745
- }
837
+ },
838
+ messageId: 'invalidWorkingDirectory',
839
+ node
746
840
  });
747
841
  }
748
842
  }
@@ -751,94 +845,6 @@ const create$2 = context => {
751
845
  };
752
846
 
753
847
  const workingDirectory = {
754
- __proto__: null,
755
- create: create$2,
756
- meta: meta$2
757
- };
758
-
759
- const meta$1 = {
760
- type: 'problem',
761
- docs: {
762
- description: 'Disallow unsupported github token values'
763
- },
764
- messages: {
765
- unsupportedGithubToken: 'Unsupported github token value: {{value}}'
766
- }
767
- };
768
- const create$1 = context => {
769
- const sourceCode = getSourceCode(context);
770
- if (!sourceCode.parserServices?.isYAML) {
771
- return {};
772
- }
773
- return {
774
- YAMLPair(node) {
775
- 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 === 'GITHUB_TOKEN' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
776
- const nodeValue = node.value.value;
777
- if (typeof nodeValue !== 'string' || nodeValue !== '${{ secrets.GITHUB_TOKEN }}') {
778
- context.report({
779
- node,
780
- messageId: 'unsupportedGithubToken',
781
- data: {
782
- value: nodeValue
783
- }
784
- });
785
- }
786
- }
787
- }
788
- };
789
- };
790
-
791
- const githubToken = {
792
- __proto__: null,
793
- create: create$1,
794
- meta: meta$1
795
- };
796
-
797
- const meta = {
798
- type: 'problem',
799
- docs: {
800
- description: 'Disallow unsupported release action usage'
801
- },
802
- messages: {
803
- unsupportedReleaseAction: 'Unsupported release action'
804
- },
805
- fixable: 'code'
806
- };
807
- const create = context => {
808
- const sourceCode = getSourceCode(context);
809
- if (!sourceCode.parserServices?.isYAML) {
810
- return {};
811
- }
812
- return {
813
- YAMLPair(node) {
814
- 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 === 'uses' && node.value && node.value.type === 'YAMLScalar' && node.value.value === 'actions/create-release@v1') {
815
- context.report({
816
- node,
817
- messageId: 'unsupportedReleaseAction',
818
- data: {},
819
- fix(fixer) {
820
- const edits = [];
821
- const parent = node.parent;
822
- edits.push(fixer.replaceText(node.value, 'softprops/action-gh-release@v2'));
823
- for (const pair of parent.pairs) {
824
- if (pair.key && pair.key.type === 'YAMLScalar' && pair.key.value === 'with' && pair.value?.type == 'YAMLMapping') {
825
- const subPairs = pair.value.pairs;
826
- for (const subPair of subPairs) {
827
- if (subPair.key?.type === 'YAMLScalar' && subPair.key.value === 'release_name') {
828
- edits.push(fixer.replaceText(subPair.key, 'name'));
829
- }
830
- }
831
- }
832
- }
833
- return edits;
834
- }
835
- });
836
- }
837
- }
838
- };
839
- };
840
-
841
- const releaseAction = {
842
848
  __proto__: null,
843
849
  create,
844
850
  meta
@@ -854,29 +860,29 @@ const plugin = {
854
860
  'ci-versions': ciVersions,
855
861
  'fail-fast': failFast,
856
862
  'github-token': githubToken,
863
+ matrix: matrix,
857
864
  'max-parallel': maxParallel,
865
+ needs: needs,
858
866
  'node-version-file': nodeVersionFile,
867
+ npm: npm,
859
868
  'npm-registry': npmRegistry,
869
+ on: on,
870
+ permissions,
860
871
  'python-version': pythonVersion,
861
872
  'release-action': releaseAction,
873
+ shell,
862
874
  'timeout-minutes': timeoutMinutes,
863
- 'working-directory': workingDirectory,
864
- matrix: matrix,
865
- needs: needs,
866
- npm: npm,
867
- on: on,
868
- permissions,
869
- shell
875
+ 'working-directory': workingDirectory
870
876
  }
871
877
  };
872
878
  const recommended = [{
873
- plugins: {
874
- 'github-actions': plugin
875
- },
876
879
  files: ['**/.github/workflows/*.y?(a)ml'],
877
880
  languageOptions: {
878
881
  parser: parserYAML
879
882
  },
883
+ plugins: {
884
+ 'github-actions': plugin
885
+ },
880
886
  rules: {
881
887
  'github-actions/action-versions': 'error',
882
888
  'github-actions/ci-versions': 'error',
@@ -886,8 +892,8 @@ const recommended = [{
886
892
  'github-actions/max-parallel': 'error',
887
893
  'github-actions/needs': 'error',
888
894
  'github-actions/node-version-file': 'error',
889
- 'github-actions/npm-registry': 'error',
890
895
  'github-actions/npm': 'error',
896
+ 'github-actions/npm-registry': 'error',
891
897
  'github-actions/on': 'error',
892
898
  'github-actions/permissions': 'off',
893
899
  'github-actions/python-version': 'error',
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-plugin-github-actions",
3
- "version": "11.1.0",
3
+ "version": "12.0.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
- "keywords": [],
7
6
  "license": "MIT",
8
7
  "description": "Lint github action workflows.",
9
8
  "repository": {