@lvce-editor/eslint-plugin-github-actions 2.18.0 → 2.20.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 +187 -94
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ const npmRegistries = ['https://registry.npmjs.org', 'https://npm.pkg.github.com
28
28
  const onProperties = ['push', 'pull_request'];
29
29
  const npmCommands = ['run', 'test', 'publish', 'install', 'ci'];
30
30
  const shells = ['bash'];
31
+ const pythonVersions = ['3.13', '3.14', '3.15'];
31
32
  const permissions$1 = {
32
33
  'id-token': ['write'],
33
34
  contents: ['write'],
@@ -37,7 +38,7 @@ const permissions$1 = {
37
38
  const isSupported = (actions, value) => {
38
39
  return actions.includes(value);
39
40
  };
40
- const meta$d = {
41
+ const meta$f = {
41
42
  type: 'problem',
42
43
  docs: {
43
44
  description: 'Disallow unsupported action versions'
@@ -47,7 +48,7 @@ const meta$d = {
47
48
  },
48
49
  fixable: 'code'
49
50
  };
50
- const create$d = context => {
51
+ const create$f = context => {
51
52
  const sourceCode = getSourceCode(context);
52
53
  if (!sourceCode.parserServices?.isYAML) {
53
54
  return {};
@@ -78,8 +79,8 @@ const create$d = context => {
78
79
 
79
80
  const actionVersions = {
80
81
  __proto__: null,
81
- create: create$d,
82
- meta: meta$d
82
+ create: create$f,
83
+ meta: meta$f
83
84
  };
84
85
 
85
86
  const parseVersion = value => {
@@ -103,7 +104,7 @@ const isSupportedMacosversion = version => {
103
104
  const isSupportedWindowsVersion = version => {
104
105
  return config.windows.includes(version);
105
106
  };
106
- const meta$c = {
107
+ const meta$e = {
107
108
  type: 'problem',
108
109
  docs: {
109
110
  description: 'Disallow unsupported ci versions'
@@ -112,7 +113,7 @@ const meta$c = {
112
113
  unsupportedCiVersion: 'Unsupported ci version: {{value}}'
113
114
  }
114
115
  };
115
- const create$c = context => {
116
+ const create$e = context => {
116
117
  const sourceCode = getSourceCode(context);
117
118
  if (!sourceCode.parserServices?.isYAML) {
118
119
  return {};
@@ -155,11 +156,11 @@ const create$c = context => {
155
156
 
156
157
  const ciVersions = {
157
158
  __proto__: null,
158
- create: create$c,
159
- meta: meta$c
159
+ create: create$e,
160
+ meta: meta$e
160
161
  };
161
162
 
162
- const meta$b = {
163
+ const meta$d = {
163
164
  type: 'problem',
164
165
  docs: {
165
166
  description: 'Disallow unsupported fail fast values'
@@ -168,7 +169,7 @@ const meta$b = {
168
169
  unsupportedFailFast: 'Unsupported fail fast value: {{value}}'
169
170
  }
170
171
  };
171
- const create$b = context => {
172
+ const create$d = context => {
172
173
  const sourceCode = getSourceCode(context);
173
174
  if (!sourceCode.parserServices?.isYAML) {
174
175
  return {};
@@ -191,11 +192,11 @@ const create$b = context => {
191
192
 
192
193
  const failFast = {
193
194
  __proto__: null,
194
- create: create$b,
195
- meta: meta$b
195
+ create: create$d,
196
+ meta: meta$d
196
197
  };
197
198
 
198
- const meta$a = {
199
+ const meta$c = {
199
200
  type: 'problem',
200
201
  docs: {
201
202
  description: 'Disallow unsupported matrix values'
@@ -204,7 +205,7 @@ const meta$a = {
204
205
  unsupportedMatrix: 'Unsupported matrix value: {{value}}'
205
206
  }
206
207
  };
207
- const create$a = context => {
208
+ const create$c = context => {
208
209
  const sourceCode = getSourceCode(context);
209
210
  if (!sourceCode.parserServices?.isYAML) {
210
211
  return {};
@@ -226,11 +227,11 @@ const create$a = context => {
226
227
 
227
228
  const matrix = {
228
229
  __proto__: null,
229
- create: create$a,
230
- meta: meta$a
230
+ create: create$c,
231
+ meta: meta$c
231
232
  };
232
233
 
233
- const meta$9 = {
234
+ const meta$b = {
234
235
  type: 'problem',
235
236
  docs: {
236
237
  description: 'Disallow unsupported max parallel values'
@@ -239,7 +240,7 @@ const meta$9 = {
239
240
  unsupportedMaxParallel: 'Unsupported max parallel value: {{value}}'
240
241
  }
241
242
  };
242
- const create$9 = context => {
243
+ const create$b = context => {
243
244
  const sourceCode = getSourceCode(context);
244
245
  if (!sourceCode.parserServices?.isYAML) {
245
246
  return {};
@@ -262,11 +263,11 @@ const create$9 = context => {
262
263
 
263
264
  const maxParallel = {
264
265
  __proto__: null,
265
- create: create$9,
266
- meta: meta$9
266
+ create: create$b,
267
+ meta: meta$b
267
268
  };
268
269
 
269
- const meta$8 = {
270
+ const meta$a = {
270
271
  type: 'problem',
271
272
  docs: {
272
273
  description: 'Disallow unsupported needs values'
@@ -297,7 +298,7 @@ const getValidNeeds = node => {
297
298
  }
298
299
  return validNeeds;
299
300
  };
300
- const create$8 = context => {
301
+ const create$a = context => {
301
302
  const sourceCode = getSourceCode(context);
302
303
  if (!sourceCode.parserServices?.isYAML) {
303
304
  return {};
@@ -305,38 +306,50 @@ const create$8 = context => {
305
306
  return {
306
307
  YAMLPair(node) {
307
308
  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) {
308
- if (node.value.type !== 'YAMLSequence') {
309
- context.report({
310
- node,
311
- messageId: 'unsupportedNeeds',
312
- data: {
313
- value: stringifyValue(node.value)
314
- }
315
- });
316
- return;
317
- }
318
309
  const validNeeds = getValidNeeds(node);
319
- for (const item of node.value.entries) {
320
- if (!item || item.type !== 'YAMLScalar' || typeof item.value !== 'string') {
310
+ if (node.value.type === 'YAMLScalar' && typeof node.value.value === 'string') {
311
+ if (!validNeeds.includes(node.value.value)) {
321
312
  context.report({
322
313
  node,
323
314
  messageId: 'unsupportedNeeds',
324
315
  data: {
325
- value: stringifyValue(item)
316
+ value: stringifyValue(node.value)
326
317
  }
327
318
  });
328
- continue;
329
319
  }
330
- if (!validNeeds.includes(item.value)) {
331
- context.report({
332
- node,
333
- messageId: 'unsupportedNeeds',
334
- data: {
335
- value: stringifyValue(item)
336
- }
337
- });
320
+ return;
321
+ }
322
+ if (node.value.type === 'YAMLSequence') {
323
+ for (const item of node.value.entries) {
324
+ if (!item || item.type !== 'YAMLScalar' || typeof item.value !== 'string') {
325
+ context.report({
326
+ node,
327
+ messageId: 'unsupportedNeeds',
328
+ data: {
329
+ value: stringifyValue(item)
330
+ }
331
+ });
332
+ continue;
333
+ }
334
+ if (!validNeeds.includes(item.value)) {
335
+ context.report({
336
+ node,
337
+ messageId: 'unsupportedNeeds',
338
+ data: {
339
+ value: stringifyValue(item)
340
+ }
341
+ });
342
+ }
338
343
  }
344
+ return;
339
345
  }
346
+ context.report({
347
+ node,
348
+ messageId: 'unsupportedNeeds',
349
+ data: {
350
+ value: stringifyValue(node.value)
351
+ }
352
+ });
340
353
  }
341
354
  }
342
355
  };
@@ -344,11 +357,49 @@ const create$8 = context => {
344
357
 
345
358
  const needs = {
346
359
  __proto__: null,
347
- create: create$8,
348
- meta: meta$8
360
+ create: create$a,
361
+ meta: meta$a
349
362
  };
350
363
 
351
- const meta$7 = {
364
+ const meta$9 = {
365
+ type: 'problem',
366
+ docs: {
367
+ description: 'Disallow unsupported node version file values'
368
+ },
369
+ messages: {
370
+ unsupportedNodeVersionFile: 'Unsupported node version file value: {{value}}'
371
+ }
372
+ };
373
+ const create$9 = context => {
374
+ const sourceCode = getSourceCode(context);
375
+ if (!sourceCode.parserServices?.isYAML) {
376
+ return {};
377
+ }
378
+ return {
379
+ YAMLPair(node) {
380
+ 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 === 'node-version-file' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
381
+ const nodeValue = node.value.value;
382
+ if (typeof nodeValue !== 'string' || nodeValue !== '.nvmrc') {
383
+ context.report({
384
+ node,
385
+ messageId: 'unsupportedNodeVersionFile',
386
+ data: {
387
+ value: nodeValue
388
+ }
389
+ });
390
+ }
391
+ }
392
+ }
393
+ };
394
+ };
395
+
396
+ const nodeVersionFile = {
397
+ __proto__: null,
398
+ create: create$9,
399
+ meta: meta$9
400
+ };
401
+
402
+ const meta$8 = {
352
403
  type: 'problem',
353
404
  docs: {
354
405
  description: 'Disallow unsupported npm registry values'
@@ -357,7 +408,7 @@ const meta$7 = {
357
408
  unsupportedNpmRegistry: 'Unsupported npm registry value: {{value}}'
358
409
  }
359
410
  };
360
- const create$7 = context => {
411
+ const create$8 = context => {
361
412
  const sourceCode = getSourceCode(context);
362
413
  if (!sourceCode.parserServices?.isYAML) {
363
414
  return {};
@@ -382,11 +433,11 @@ const create$7 = context => {
382
433
 
383
434
  const npmRegistry = {
384
435
  __proto__: null,
385
- create: create$7,
386
- meta: meta$7
436
+ create: create$8,
437
+ meta: meta$8
387
438
  };
388
439
 
389
- const meta$6 = {
440
+ const meta$7 = {
390
441
  type: 'problem',
391
442
  docs: {
392
443
  description: 'Disallow unsupported npm commands'
@@ -403,7 +454,7 @@ const isSupportedNpmCommand = value => {
403
454
  }
404
455
  return false;
405
456
  };
406
- const create$6 = context => {
457
+ const create$7 = context => {
407
458
  const sourceCode = getSourceCode(context);
408
459
  if (!sourceCode.parserServices?.isYAML) {
409
460
  return {};
@@ -431,11 +482,11 @@ const create$6 = context => {
431
482
 
432
483
  const npm = {
433
484
  __proto__: null,
434
- create: create$6,
435
- meta: meta$6
485
+ create: create$7,
486
+ meta: meta$7
436
487
  };
437
488
 
438
- const meta$5 = {
489
+ const meta$6 = {
439
490
  type: 'problem',
440
491
  docs: {
441
492
  description: 'Disallow unsupported on values'
@@ -444,7 +495,7 @@ const meta$5 = {
444
495
  unsupportedOn: 'Unsupported on value: {{value}}'
445
496
  }
446
497
  };
447
- const create$5 = context => {
498
+ const create$6 = context => {
448
499
  const sourceCode = getSourceCode(context);
449
500
  if (!sourceCode.parserServices?.isYAML) {
450
501
  return {};
@@ -471,11 +522,11 @@ const create$5 = context => {
471
522
 
472
523
  const on = {
473
524
  __proto__: null,
474
- create: create$5,
475
- meta: meta$5
525
+ create: create$6,
526
+ meta: meta$6
476
527
  };
477
528
 
478
- const meta$4 = {
529
+ const meta$5 = {
479
530
  type: 'problem',
480
531
  docs: {
481
532
  description: 'Disallow unsupported permission values'
@@ -484,7 +535,7 @@ const meta$4 = {
484
535
  unsupportedPermission: 'Unsupported permission value: {{value}}'
485
536
  }
486
537
  };
487
- const create$4 = context => {
538
+ const create$5 = context => {
488
539
  const sourceCode = getSourceCode(context);
489
540
  if (!sourceCode.parserServices?.isYAML) {
490
541
  return {};
@@ -525,6 +576,44 @@ const create$4 = context => {
525
576
  };
526
577
 
527
578
  const permissions = {
579
+ __proto__: null,
580
+ create: create$5,
581
+ meta: meta$5
582
+ };
583
+
584
+ const meta$4 = {
585
+ type: 'problem',
586
+ docs: {
587
+ description: 'Disallow unsupported python versions'
588
+ },
589
+ messages: {
590
+ unsupportedPythonVersion: 'Unsupported python version: {{value}}'
591
+ }
592
+ };
593
+ const create$4 = context => {
594
+ const sourceCode = getSourceCode(context);
595
+ if (!sourceCode.parserServices?.isYAML) {
596
+ return {};
597
+ }
598
+ return {
599
+ YAMLPair(node) {
600
+ 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 === 'python-version' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
601
+ const nodeValue = node.value.value;
602
+ if (typeof nodeValue !== 'string' || !pythonVersions.includes(nodeValue)) {
603
+ context.report({
604
+ node,
605
+ messageId: 'unsupportedPythonVersion',
606
+ data: {
607
+ value: nodeValue
608
+ }
609
+ });
610
+ }
611
+ }
612
+ }
613
+ };
614
+ };
615
+
616
+ const pythonVersion = {
528
617
  __proto__: null,
529
618
  create: create$4,
530
619
  meta: meta$4
@@ -607,12 +696,22 @@ const timeoutMinutes = {
607
696
  const meta$1 = {
608
697
  type: 'problem',
609
698
  docs: {
610
- description: 'Disallow unsupported node version file values'
699
+ description: 'Disallow non-existing working directories'
611
700
  },
612
701
  messages: {
613
- unsupportedNodeVersionFile: 'Unsupported node version file value: {{value}}'
702
+ invalidWorkingDirectory: 'Working directory not found: {{value}}',
703
+ workingDirectoryMustBeOfTypeString: 'Working directory must be of type string'
614
704
  }
615
705
  };
706
+ const allowedNonExistingWorkingDirectories = ['dist', '.tmp'];
707
+ const isAllowedNonExistingWorkingDirectory = relativePath => {
708
+ for (const item of allowedNonExistingWorkingDirectories) {
709
+ if (relativePath.startsWith(item)) {
710
+ return true;
711
+ }
712
+ }
713
+ return false;
714
+ };
616
715
  const create$1 = context => {
617
716
  const sourceCode = getSourceCode(context);
618
717
  if (!sourceCode.parserServices?.isYAML) {
@@ -620,12 +719,24 @@ const create$1 = context => {
620
719
  }
621
720
  return {
622
721
  YAMLPair(node) {
623
- 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 === 'node-version-file' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
722
+ 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 === 'working-directory' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
624
723
  const nodeValue = node.value.value;
625
- if (typeof nodeValue !== 'string' || nodeValue !== '.nvmrc') {
724
+ if (typeof nodeValue !== 'string') {
626
725
  context.report({
627
726
  node,
628
- messageId: 'unsupportedNodeVersionFile',
727
+ messageId: 'workingDirectoryMustBeOfTypeString',
728
+ data: {
729
+ value: nodeValue
730
+ }
731
+ });
732
+ return;
733
+ }
734
+ const path = resolve(context.cwd, nodeValue);
735
+ const relativePath = relative(context.cwd, path);
736
+ if (!isAllowedNonExistingWorkingDirectory(relativePath) && !existsSync(path)) {
737
+ context.report({
738
+ node,
739
+ messageId: 'invalidWorkingDirectory',
629
740
  data: {
630
741
  value: nodeValue
631
742
  }
@@ -636,7 +747,7 @@ const create$1 = context => {
636
747
  };
637
748
  };
638
749
 
639
- const nodeVersionFile = {
750
+ const workingDirectory = {
640
751
  __proto__: null,
641
752
  create: create$1,
642
753
  meta: meta$1
@@ -645,22 +756,12 @@ const nodeVersionFile = {
645
756
  const meta = {
646
757
  type: 'problem',
647
758
  docs: {
648
- description: 'Disallow non-existing working directories'
759
+ description: 'Disallow unsupported github token values'
649
760
  },
650
761
  messages: {
651
- invalidWorkingDirectory: 'Working directory not found: {{value}}',
652
- workingDirectoryMustBeOfTypeString: 'Working directory must be of type string'
762
+ unsupportedGithubToken: 'Unsupported github token value: {{value}}'
653
763
  }
654
764
  };
655
- const allowedNonExistingWorkingDirectories = ['dist', '.tmp'];
656
- const isAllowedNonExistingWorkingDirectory = relativePath => {
657
- for (const item of allowedNonExistingWorkingDirectories) {
658
- if (relativePath.startsWith(item)) {
659
- return true;
660
- }
661
- }
662
- return false;
663
- };
664
765
  const create = context => {
665
766
  const sourceCode = getSourceCode(context);
666
767
  if (!sourceCode.parserServices?.isYAML) {
@@ -668,24 +769,12 @@ const create = context => {
668
769
  }
669
770
  return {
670
771
  YAMLPair(node) {
671
- 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 === 'working-directory' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
772
+ 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') {
672
773
  const nodeValue = node.value.value;
673
- if (typeof nodeValue !== 'string') {
774
+ if (typeof nodeValue !== 'string' || nodeValue !== '${{ secrets.GITHUB_TOKEN }}') {
674
775
  context.report({
675
776
  node,
676
- messageId: 'workingDirectoryMustBeOfTypeString',
677
- data: {
678
- value: nodeValue
679
- }
680
- });
681
- return;
682
- }
683
- const path = resolve(context.cwd, nodeValue);
684
- const relativePath = relative(context.cwd, path);
685
- if (!isAllowedNonExistingWorkingDirectory(relativePath) && !existsSync(path)) {
686
- context.report({
687
- node,
688
- messageId: 'invalidWorkingDirectory',
777
+ messageId: 'unsupportedGithubToken',
689
778
  data: {
690
779
  value: nodeValue
691
780
  }
@@ -696,7 +785,7 @@ const create = context => {
696
785
  };
697
786
  };
698
787
 
699
- const workingDirectory = {
788
+ const githubToken = {
700
789
  __proto__: null,
701
790
  create,
702
791
  meta
@@ -711,9 +800,11 @@ const plugin = {
711
800
  'action-versions': actionVersions,
712
801
  'ci-versions': ciVersions,
713
802
  'fail-fast': failFast,
803
+ 'github-token': githubToken,
714
804
  'max-parallel': maxParallel,
715
805
  'node-version-file': nodeVersionFile,
716
806
  'npm-registry': npmRegistry,
807
+ 'python-version': pythonVersion,
717
808
  'timeout-minutes': timeoutMinutes,
718
809
  'working-directory': workingDirectory,
719
810
  matrix: matrix,
@@ -736,6 +827,7 @@ const recommended = [{
736
827
  'github-actions/action-versions': 'error',
737
828
  'github-actions/ci-versions': 'error',
738
829
  'github-actions/fail-fast': 'error',
830
+ 'github-actions/github-token': 'error',
739
831
  'github-actions/matrix': 'off',
740
832
  'github-actions/max-parallel': 'error',
741
833
  'github-actions/needs': 'error',
@@ -744,6 +836,7 @@ const recommended = [{
744
836
  'github-actions/npm': 'error',
745
837
  'github-actions/on': 'error',
746
838
  'github-actions/permissions': 'off',
839
+ 'github-actions/python-version': 'error',
747
840
  'github-actions/shell': 'error',
748
841
  'github-actions/timeout-minutes': 'error',
749
842
  'github-actions/working-directory': 'error'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-plugin-github-actions",
3
- "version": "2.18.0",
3
+ "version": "2.20.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],