@lvce-editor/eslint-plugin-github-actions 16.1.0 → 16.3.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 +89 -36
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ const permissions$1 = {
38
38
  const isSupported = (actions, value) => {
39
39
  return actions.includes(value);
40
40
  };
41
- const meta$i = {
41
+ const meta$j = {
42
42
  docs: {
43
43
  description: 'Disallow unsupported action versions'
44
44
  },
@@ -48,7 +48,7 @@ const meta$i = {
48
48
  },
49
49
  type: 'problem'
50
50
  };
51
- const create$i = context => {
51
+ const create$j = context => {
52
52
  const sourceCode = getSourceCode(context);
53
53
  if (!sourceCode.parserServices?.isYAML) {
54
54
  return {};
@@ -79,8 +79,8 @@ const create$i = context => {
79
79
 
80
80
  const actionVersions = {
81
81
  __proto__: null,
82
- create: create$i,
83
- meta: meta$i
82
+ create: create$j,
83
+ meta: meta$j
84
84
  };
85
85
 
86
86
  const parseVersion = value => {
@@ -104,7 +104,7 @@ const isSupportedMacosversion = version => {
104
104
  const isSupportedWindowsVersion = version => {
105
105
  return config.windows.includes(version);
106
106
  };
107
- const meta$h = {
107
+ const meta$i = {
108
108
  docs: {
109
109
  description: 'Disallow unsupported ci versions'
110
110
  },
@@ -113,7 +113,7 @@ const meta$h = {
113
113
  },
114
114
  type: 'problem'
115
115
  };
116
- const create$h = context => {
116
+ const create$i = context => {
117
117
  const sourceCode = getSourceCode(context);
118
118
  if (!sourceCode.parserServices?.isYAML) {
119
119
  return {};
@@ -157,11 +157,11 @@ const create$h = context => {
157
157
 
158
158
  const ciVersions = {
159
159
  __proto__: null,
160
- create: create$h,
161
- meta: meta$h
160
+ create: create$i,
161
+ meta: meta$i
162
162
  };
163
163
 
164
- const meta$g = {
164
+ const meta$h = {
165
165
  docs: {
166
166
  description: 'Disallow unsupported fail fast values'
167
167
  },
@@ -170,7 +170,7 @@ const meta$g = {
170
170
  },
171
171
  type: 'problem'
172
172
  };
173
- const create$g = context => {
173
+ const create$h = context => {
174
174
  const sourceCode = getSourceCode(context);
175
175
  if (!sourceCode.parserServices?.isYAML) {
176
176
  return {};
@@ -193,11 +193,11 @@ const create$g = context => {
193
193
 
194
194
  const failFast = {
195
195
  __proto__: null,
196
- create: create$g,
197
- meta: meta$g
196
+ create: create$h,
197
+ meta: meta$h
198
198
  };
199
199
 
200
- const meta$f = {
200
+ const meta$g = {
201
201
  docs: {
202
202
  description: 'Require GitHub Pages deployment best practices'
203
203
  },
@@ -242,7 +242,7 @@ const hasGithubPagesConcurrency = mapping => {
242
242
  }
243
243
  return isYamlScalarString(getMappingValue(mapping, 'group'), 'pages') && isYamlScalarBoolean(getMappingValue(mapping, 'cancel-in-progress'), false);
244
244
  };
245
- const create$f = context => {
245
+ const create$g = context => {
246
246
  const sourceCode = getSourceCode(context);
247
247
  if (!sourceCode.parserServices?.isYAML || !isCiWorkflow(context.filename)) {
248
248
  return {};
@@ -290,11 +290,11 @@ const create$f = context => {
290
290
 
291
291
  const githubPages = {
292
292
  __proto__: null,
293
- create: create$f,
294
- meta: meta$f
293
+ create: create$g,
294
+ meta: meta$g
295
295
  };
296
296
 
297
- const meta$e = {
297
+ const meta$f = {
298
298
  docs: {
299
299
  description: 'Disallow unsupported github token values'
300
300
  },
@@ -303,7 +303,7 @@ const meta$e = {
303
303
  },
304
304
  type: 'problem'
305
305
  };
306
- const create$e = context => {
306
+ const create$f = context => {
307
307
  const sourceCode = getSourceCode(context);
308
308
  if (!sourceCode.parserServices?.isYAML) {
309
309
  return {};
@@ -328,11 +328,11 @@ const create$e = context => {
328
328
 
329
329
  const githubToken = {
330
330
  __proto__: null,
331
- create: create$e,
332
- meta: meta$e
331
+ create: create$f,
332
+ meta: meta$f
333
333
  };
334
334
 
335
- const meta$d = {
335
+ const meta$e = {
336
336
  docs: {
337
337
  description: 'Disallow unsupported matrix values'
338
338
  },
@@ -341,7 +341,7 @@ const meta$d = {
341
341
  },
342
342
  type: 'problem'
343
343
  };
344
- const create$d = context => {
344
+ const create$e = context => {
345
345
  const sourceCode = getSourceCode(context);
346
346
  if (!sourceCode.parserServices?.isYAML) {
347
347
  return {};
@@ -364,11 +364,11 @@ const create$d = context => {
364
364
 
365
365
  const matrix = {
366
366
  __proto__: null,
367
- create: create$d,
368
- meta: meta$d
367
+ create: create$e,
368
+ meta: meta$e
369
369
  };
370
370
 
371
- const meta$c = {
371
+ const meta$d = {
372
372
  docs: {
373
373
  description: 'Disallow unsupported max parallel values'
374
374
  },
@@ -377,7 +377,7 @@ const meta$c = {
377
377
  },
378
378
  type: 'problem'
379
379
  };
380
- const create$c = context => {
380
+ const create$d = context => {
381
381
  const sourceCode = getSourceCode(context);
382
382
  if (!sourceCode.parserServices?.isYAML) {
383
383
  return {};
@@ -400,11 +400,11 @@ const create$c = context => {
400
400
 
401
401
  const maxParallel = {
402
402
  __proto__: null,
403
- create: create$c,
404
- meta: meta$c
403
+ create: create$d,
404
+ meta: meta$d
405
405
  };
406
406
 
407
- const meta$b = {
407
+ const meta$c = {
408
408
  docs: {
409
409
  description: 'Disallow unsupported needs values'
410
410
  },
@@ -437,7 +437,7 @@ const getValidNeeds = node => {
437
437
  }
438
438
  return validNeeds;
439
439
  };
440
- const create$b = context => {
440
+ const create$c = context => {
441
441
  const sourceCode = getSourceCode(context);
442
442
  if (!sourceCode.parserServices?.isYAML) {
443
443
  return {};
@@ -496,11 +496,11 @@ const create$b = context => {
496
496
 
497
497
  const needs = {
498
498
  __proto__: null,
499
- create: create$b,
500
- meta: meta$b
499
+ create: create$c,
500
+ meta: meta$c
501
501
  };
502
502
 
503
- const meta$a = {
503
+ const meta$b = {
504
504
  docs: {
505
505
  description: 'Disallow e2e tests in release workflows'
506
506
  },
@@ -509,7 +509,7 @@ const meta$a = {
509
509
  },
510
510
  type: 'problem'
511
511
  };
512
- const isReleaseWorkflow = filename => {
512
+ const isReleaseWorkflow$1 = filename => {
513
513
  const normalized = filename.replaceAll('\\', '/');
514
514
  return normalized.endsWith('/release.yml') || normalized.endsWith('/release.yaml') || normalized === 'release.yml' || normalized === 'release.yaml';
515
515
  };
@@ -528,9 +528,9 @@ const runsE2eTests = value => {
528
528
  }
529
529
  return false;
530
530
  };
531
- const create$a = context => {
531
+ const create$b = context => {
532
532
  const sourceCode = getSourceCode(context);
533
- if (!sourceCode.parserServices?.isYAML || !isReleaseWorkflow(context.filename)) {
533
+ if (!sourceCode.parserServices?.isYAML || !isReleaseWorkflow$1(context.filename)) {
534
534
  return {};
535
535
  }
536
536
  return {
@@ -546,6 +546,57 @@ const create$a = context => {
546
546
  };
547
547
 
548
548
  const noE2eInRelease = {
549
+ __proto__: null,
550
+ create: create$b,
551
+ meta: meta$b
552
+ };
553
+
554
+ const meta$a = {
555
+ docs: {
556
+ description: 'Disallow memory measurement in release workflows'
557
+ },
558
+ messages: {
559
+ noMeasureInRelease: 'Do not run memory measurement in release workflows'
560
+ },
561
+ type: 'problem'
562
+ };
563
+ const isReleaseWorkflow = filename => {
564
+ const normalized = filename.replaceAll('\\', '/');
565
+ return normalized.endsWith('/release.yml') || normalized.endsWith('/release.yaml') || normalized === 'release.yml' || normalized === 'release.yaml';
566
+ };
567
+ const runsMemoryMeasurement = value => {
568
+ const commands = value.replaceAll('\r', '\n').replaceAll('&&', ';').replaceAll('||', ';').split(/[\n;]/);
569
+ for (const command of commands) {
570
+ const tokens = command.trim().split(/\s+/);
571
+ const npmIndex = tokens.indexOf('npm');
572
+ if (npmIndex === -1) {
573
+ continue;
574
+ }
575
+ const scriptName = tokens[npmIndex + 2];
576
+ if (tokens[npmIndex + 1] === 'run' && (scriptName === 'measure' || scriptName?.startsWith('measure:'))) {
577
+ return true;
578
+ }
579
+ }
580
+ return false;
581
+ };
582
+ const create$a = context => {
583
+ const sourceCode = getSourceCode(context);
584
+ if (!sourceCode.parserServices?.isYAML || !isReleaseWorkflow(context.filename)) {
585
+ return {};
586
+ }
587
+ return {
588
+ YAMLPair(node) {
589
+ if (node && node.type === 'YAMLPair' && node.key && typeof node.key === 'object' && 'type' in node.key && node.key.type === 'YAMLScalar' && node.key.value === 'run' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar' && typeof node.value.value === 'string' && runsMemoryMeasurement(node.value.value)) {
590
+ context.report({
591
+ messageId: 'noMeasureInRelease',
592
+ node: node.value
593
+ });
594
+ }
595
+ }
596
+ };
597
+ };
598
+
599
+ const noMeasureInRelease = {
549
600
  __proto__: null,
550
601
  create: create$a,
551
602
  meta: meta$a
@@ -1016,6 +1067,7 @@ const plugin = {
1016
1067
  'max-parallel': maxParallel,
1017
1068
  needs: needs,
1018
1069
  'no-e2e-in-release': noE2eInRelease,
1070
+ 'no-measure-in-release': noMeasureInRelease,
1019
1071
  'node-version-file': nodeVersionFile,
1020
1072
  npm: npm,
1021
1073
  'npm-registry': npmRegistry,
@@ -1046,6 +1098,7 @@ const recommended = [{
1046
1098
  'github-actions/max-parallel': 'error',
1047
1099
  'github-actions/needs': 'error',
1048
1100
  'github-actions/no-e2e-in-release': 'error',
1101
+ 'github-actions/no-measure-in-release': 'error',
1049
1102
  'github-actions/node-version-file': 'error',
1050
1103
  'github-actions/npm': 'error',
1051
1104
  'github-actions/npm-registry': 'error',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-plugin-github-actions",
3
- "version": "16.1.0",
3
+ "version": "16.3.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "license": "MIT",