@lvce-editor/eslint-plugin-github-actions 2.7.0 → 2.8.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.
- package/dist/index.js +168 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,11 +24,12 @@ const actions = {
|
|
|
24
24
|
const npmRegistries = ['https://registry.npmjs.org', 'https://npm.pkg.github.com'];
|
|
25
25
|
const onProperties = ['push', 'pull_request'];
|
|
26
26
|
const npmCommands = ['run', 'test', 'publish', 'install', 'ci'];
|
|
27
|
+
const shells = ['bash'];
|
|
27
28
|
|
|
28
29
|
const isSupported = (actions, value) => {
|
|
29
30
|
return actions.includes(value);
|
|
30
31
|
};
|
|
31
|
-
const meta$
|
|
32
|
+
const meta$a = {
|
|
32
33
|
type: 'problem',
|
|
33
34
|
docs: {
|
|
34
35
|
description: 'Disallow unsupported action versions'
|
|
@@ -37,7 +38,7 @@ const meta$7 = {
|
|
|
37
38
|
unsupportedActionVersion: 'Unsupported action version: {{value}}'
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
const create$
|
|
41
|
+
const create$a = context => {
|
|
41
42
|
const sourceCode = getSourceCode(context);
|
|
42
43
|
if (!sourceCode.parserServices?.isYAML) {
|
|
43
44
|
return {};
|
|
@@ -64,8 +65,8 @@ const create$7 = context => {
|
|
|
64
65
|
|
|
65
66
|
const actionVersions = {
|
|
66
67
|
__proto__: null,
|
|
67
|
-
create: create$
|
|
68
|
-
meta: meta$
|
|
68
|
+
create: create$a,
|
|
69
|
+
meta: meta$a
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
const parseVersion = value => {
|
|
@@ -89,7 +90,7 @@ const isSupportedMacosversion = version => {
|
|
|
89
90
|
const isSupportedWindowsVersion = version => {
|
|
90
91
|
return config.windows.includes(version);
|
|
91
92
|
};
|
|
92
|
-
const meta$
|
|
93
|
+
const meta$9 = {
|
|
93
94
|
type: 'problem',
|
|
94
95
|
docs: {
|
|
95
96
|
description: 'Disallow unsupported ci versions'
|
|
@@ -98,7 +99,7 @@ const meta$6 = {
|
|
|
98
99
|
unsupportedCiVersion: 'Unsupported ci version: {{value}}'
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
|
-
const create$
|
|
102
|
+
const create$9 = context => {
|
|
102
103
|
const sourceCode = getSourceCode(context);
|
|
103
104
|
if (!sourceCode.parserServices?.isYAML) {
|
|
104
105
|
return {};
|
|
@@ -141,11 +142,11 @@ const create$6 = context => {
|
|
|
141
142
|
|
|
142
143
|
const ciVersions = {
|
|
143
144
|
__proto__: null,
|
|
144
|
-
create: create$
|
|
145
|
-
meta: meta$
|
|
145
|
+
create: create$9,
|
|
146
|
+
meta: meta$9
|
|
146
147
|
};
|
|
147
148
|
|
|
148
|
-
const meta$
|
|
149
|
+
const meta$8 = {
|
|
149
150
|
type: 'problem',
|
|
150
151
|
docs: {
|
|
151
152
|
description: 'Disallow unsupported fail fast values'
|
|
@@ -154,7 +155,7 @@ const meta$5 = {
|
|
|
154
155
|
unsupportedFailFast: 'Unsupported fail fast value: {{value}}'
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
|
-
const create$
|
|
158
|
+
const create$8 = context => {
|
|
158
159
|
const sourceCode = getSourceCode(context);
|
|
159
160
|
if (!sourceCode.parserServices?.isYAML) {
|
|
160
161
|
return {};
|
|
@@ -177,11 +178,46 @@ const create$5 = context => {
|
|
|
177
178
|
|
|
178
179
|
const failFast = {
|
|
179
180
|
__proto__: null,
|
|
180
|
-
create: create$
|
|
181
|
-
meta: meta$
|
|
181
|
+
create: create$8,
|
|
182
|
+
meta: meta$8
|
|
182
183
|
};
|
|
183
184
|
|
|
184
|
-
const meta$
|
|
185
|
+
const meta$7 = {
|
|
186
|
+
type: 'problem',
|
|
187
|
+
docs: {
|
|
188
|
+
description: 'Disallow unsupported matrix values'
|
|
189
|
+
},
|
|
190
|
+
messages: {
|
|
191
|
+
unsupportedMatrix: 'Unsupported matrix value: {{value}}'
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const create$7 = context => {
|
|
195
|
+
const sourceCode = getSourceCode(context);
|
|
196
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
YAMLPair(node) {
|
|
201
|
+
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') {
|
|
202
|
+
context.report({
|
|
203
|
+
node,
|
|
204
|
+
messageId: 'unsupportedMatrix',
|
|
205
|
+
data: {
|
|
206
|
+
value: node.value
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const matrix = {
|
|
215
|
+
__proto__: null,
|
|
216
|
+
create: create$7,
|
|
217
|
+
meta: meta$7
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const meta$6 = {
|
|
185
221
|
type: 'problem',
|
|
186
222
|
docs: {
|
|
187
223
|
description: 'Disallow unsupported max parallel values'
|
|
@@ -190,7 +226,7 @@ const meta$4 = {
|
|
|
190
226
|
unsupportedMaxParallel: 'Unsupported max parallel value: {{value}}'
|
|
191
227
|
}
|
|
192
228
|
};
|
|
193
|
-
const create$
|
|
229
|
+
const create$6 = context => {
|
|
194
230
|
const sourceCode = getSourceCode(context);
|
|
195
231
|
if (!sourceCode.parserServices?.isYAML) {
|
|
196
232
|
return {};
|
|
@@ -213,11 +249,46 @@ const create$4 = context => {
|
|
|
213
249
|
|
|
214
250
|
const maxParallel = {
|
|
215
251
|
__proto__: null,
|
|
216
|
-
create: create$
|
|
217
|
-
meta: meta$
|
|
252
|
+
create: create$6,
|
|
253
|
+
meta: meta$6
|
|
218
254
|
};
|
|
219
255
|
|
|
220
|
-
const meta$
|
|
256
|
+
const meta$5 = {
|
|
257
|
+
type: 'problem',
|
|
258
|
+
docs: {
|
|
259
|
+
description: 'Disallow unsupported needs values'
|
|
260
|
+
},
|
|
261
|
+
messages: {
|
|
262
|
+
unsupportedNeeds: 'Unsupported needs value: {{value}}'
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const create$5 = context => {
|
|
266
|
+
const sourceCode = getSourceCode(context);
|
|
267
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
268
|
+
return {};
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
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') {
|
|
273
|
+
context.report({
|
|
274
|
+
node,
|
|
275
|
+
messageId: 'unsupportedNeeds',
|
|
276
|
+
data: {
|
|
277
|
+
value: node.value
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const needs = {
|
|
286
|
+
__proto__: null,
|
|
287
|
+
create: create$5,
|
|
288
|
+
meta: meta$5
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const meta$4 = {
|
|
221
292
|
type: 'problem',
|
|
222
293
|
docs: {
|
|
223
294
|
description: 'Disallow unsupported npm registry values'
|
|
@@ -226,7 +297,7 @@ const meta$3 = {
|
|
|
226
297
|
unsupportedNpmRegistry: 'Unsupported npm registry value: {{value}}'
|
|
227
298
|
}
|
|
228
299
|
};
|
|
229
|
-
const create$
|
|
300
|
+
const create$4 = context => {
|
|
230
301
|
const sourceCode = getSourceCode(context);
|
|
231
302
|
if (!sourceCode.parserServices?.isYAML) {
|
|
232
303
|
return {};
|
|
@@ -250,6 +321,55 @@ const create$3 = context => {
|
|
|
250
321
|
};
|
|
251
322
|
|
|
252
323
|
const npmRegistry = {
|
|
324
|
+
__proto__: null,
|
|
325
|
+
create: create$4,
|
|
326
|
+
meta: meta$4
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const meta$3 = {
|
|
330
|
+
type: 'problem',
|
|
331
|
+
docs: {
|
|
332
|
+
description: 'Disallow unsupported npm commands'
|
|
333
|
+
},
|
|
334
|
+
messages: {
|
|
335
|
+
unsupportedNpmCommand: 'Unsupported npm command: {{value}}'
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
const isSupportedNpmCommand = value => {
|
|
339
|
+
for (const npmCommand of npmCommands) {
|
|
340
|
+
if (value.startsWith(npmCommand)) {
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return false;
|
|
345
|
+
};
|
|
346
|
+
const create$3 = context => {
|
|
347
|
+
const sourceCode = getSourceCode(context);
|
|
348
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
349
|
+
return {};
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
YAMLPair(node) {
|
|
353
|
+
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 === 'run' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar' && typeof node.value.value === 'string') {
|
|
354
|
+
const nodeValue = node.value.value;
|
|
355
|
+
if (nodeValue.startsWith('npm ')) {
|
|
356
|
+
const rest = nodeValue.slice('npm '.length);
|
|
357
|
+
if (!isSupportedNpmCommand(rest)) {
|
|
358
|
+
context.report({
|
|
359
|
+
node,
|
|
360
|
+
messageId: 'unsupportedNpmCommand',
|
|
361
|
+
data: {
|
|
362
|
+
value: nodeValue
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const npm = {
|
|
253
373
|
__proto__: null,
|
|
254
374
|
create: create$3,
|
|
255
375
|
meta: meta$3
|
|
@@ -298,10 +418,10 @@ const on = {
|
|
|
298
418
|
const meta$1 = {
|
|
299
419
|
type: 'problem',
|
|
300
420
|
docs: {
|
|
301
|
-
description: 'Disallow unsupported
|
|
421
|
+
description: 'Disallow unsupported shell values'
|
|
302
422
|
},
|
|
303
423
|
messages: {
|
|
304
|
-
|
|
424
|
+
unsupportedShell: 'Unsupported shell value: {{value}}'
|
|
305
425
|
}
|
|
306
426
|
};
|
|
307
427
|
const create$1 = context => {
|
|
@@ -311,21 +431,23 @@ const create$1 = context => {
|
|
|
311
431
|
}
|
|
312
432
|
return {
|
|
313
433
|
YAMLPair(node) {
|
|
314
|
-
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 === '
|
|
434
|
+
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 === 'shell' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
|
|
315
435
|
const nodeValue = node.value.value;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
436
|
+
if (typeof nodeValue !== 'string' || !shells.includes(nodeValue)) {
|
|
437
|
+
context.report({
|
|
438
|
+
node,
|
|
439
|
+
messageId: 'unsupportedShell',
|
|
440
|
+
data: {
|
|
441
|
+
value: nodeValue
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}
|
|
323
445
|
}
|
|
324
446
|
}
|
|
325
447
|
};
|
|
326
448
|
};
|
|
327
449
|
|
|
328
|
-
const
|
|
450
|
+
const shell = {
|
|
329
451
|
__proto__: null,
|
|
330
452
|
create: create$1,
|
|
331
453
|
meta: meta$1
|
|
@@ -334,20 +456,12 @@ const timeoutMinutes = {
|
|
|
334
456
|
const meta = {
|
|
335
457
|
type: 'problem',
|
|
336
458
|
docs: {
|
|
337
|
-
description: 'Disallow unsupported
|
|
459
|
+
description: 'Disallow unsupported timeout minute values'
|
|
338
460
|
},
|
|
339
461
|
messages: {
|
|
340
|
-
|
|
462
|
+
unsupportedTimeoutMinutes: 'Unsupported timeout minutes value: {{value}}'
|
|
341
463
|
}
|
|
342
464
|
};
|
|
343
|
-
const isSupportedNpmCommand = value => {
|
|
344
|
-
for (const npmCommand of npmCommands) {
|
|
345
|
-
if (value.startsWith(npmCommand)) {
|
|
346
|
-
return true;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return false;
|
|
350
|
-
};
|
|
351
465
|
const create = context => {
|
|
352
466
|
const sourceCode = getSourceCode(context);
|
|
353
467
|
if (!sourceCode.parserServices?.isYAML) {
|
|
@@ -355,26 +469,21 @@ const create = context => {
|
|
|
355
469
|
}
|
|
356
470
|
return {
|
|
357
471
|
YAMLPair(node) {
|
|
358
|
-
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 === '
|
|
472
|
+
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') {
|
|
359
473
|
const nodeValue = node.value.value;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
messageId: 'unsupportedNpmCommand',
|
|
366
|
-
data: {
|
|
367
|
-
value: nodeValue
|
|
368
|
-
}
|
|
369
|
-
});
|
|
474
|
+
context.report({
|
|
475
|
+
node,
|
|
476
|
+
messageId: 'unsupportedTimeoutMinutes',
|
|
477
|
+
data: {
|
|
478
|
+
value: nodeValue
|
|
370
479
|
}
|
|
371
|
-
}
|
|
480
|
+
});
|
|
372
481
|
}
|
|
373
482
|
}
|
|
374
483
|
};
|
|
375
484
|
};
|
|
376
485
|
|
|
377
|
-
const
|
|
486
|
+
const timeoutMinutes = {
|
|
378
487
|
__proto__: null,
|
|
379
488
|
create,
|
|
380
489
|
meta
|
|
@@ -392,8 +501,11 @@ const plugin = {
|
|
|
392
501
|
'max-parallel': maxParallel,
|
|
393
502
|
'npm-registry': npmRegistry,
|
|
394
503
|
'timeout-minutes': timeoutMinutes,
|
|
504
|
+
matrix: matrix,
|
|
505
|
+
needs: needs,
|
|
506
|
+
npm: npm,
|
|
395
507
|
on: on,
|
|
396
|
-
|
|
508
|
+
shell
|
|
397
509
|
}
|
|
398
510
|
};
|
|
399
511
|
const recommended = [{
|
|
@@ -408,10 +520,13 @@ const recommended = [{
|
|
|
408
520
|
'github-actions/action-versions': 'error',
|
|
409
521
|
'github-actions/ci-versions': 'error',
|
|
410
522
|
'github-actions/fail-fast': 'error',
|
|
523
|
+
'github-actions/matrix': 'off',
|
|
411
524
|
'github-actions/max-parallel': 'error',
|
|
412
525
|
'github-actions/npm-registry': 'error',
|
|
413
526
|
'github-actions/npm': 'error',
|
|
527
|
+
'github-actions/needs': 'error',
|
|
414
528
|
'github-actions/on': 'error',
|
|
529
|
+
'github-actions/shell': 'error',
|
|
415
530
|
'github-actions/timeout-minutes': 'error'
|
|
416
531
|
}
|
|
417
532
|
}];
|