@lvce-editor/eslint-plugin-github-actions 2.4.0 → 2.5.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 +173 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,19 +12,22 @@ const platforms = {
|
|
|
12
12
|
macos: 'macos'
|
|
13
13
|
};
|
|
14
14
|
const actions = {
|
|
15
|
-
'actions/checkout': ['actions/checkout@
|
|
15
|
+
'actions/checkout': ['actions/checkout@v5'],
|
|
16
16
|
'actions/setup-node': ['actions/setup-node@v6'],
|
|
17
17
|
'actions/cache': ['actions/cache@v4'],
|
|
18
18
|
'actions/upload-pages-artifact': ['actions/upload-pages-artifact@v4'],
|
|
19
19
|
'actions/deploy-pages': ['actions/deploy-pages@v4'],
|
|
20
20
|
'actions/download-artifact': ['actions/download-artifact@v4'],
|
|
21
|
-
'actions/upload-artifact': ['actions/upload-artifact@v4']
|
|
21
|
+
'actions/upload-artifact': ['actions/upload-artifact@v4'],
|
|
22
|
+
'actions/create-release': ['actions/create-release@v1']
|
|
22
23
|
};
|
|
24
|
+
const npmRegistries = ['https://registry.npmjs.org', 'https://npm.pkg.github.com'];
|
|
25
|
+
const onProperties = ['push', 'pull_request'];
|
|
23
26
|
|
|
24
27
|
const isSupported = (actions, value) => {
|
|
25
28
|
return actions.includes(value);
|
|
26
29
|
};
|
|
27
|
-
const meta$
|
|
30
|
+
const meta$6 = {
|
|
28
31
|
type: 'problem',
|
|
29
32
|
docs: {
|
|
30
33
|
description: 'Disallow unsupported action versions'
|
|
@@ -33,7 +36,7 @@ const meta$2 = {
|
|
|
33
36
|
unsupportedActionVersion: 'Unsupported action version: {{value}}'
|
|
34
37
|
}
|
|
35
38
|
};
|
|
36
|
-
const create$
|
|
39
|
+
const create$6 = context => {
|
|
37
40
|
const sourceCode = getSourceCode(context);
|
|
38
41
|
if (!sourceCode.parserServices?.isYAML) {
|
|
39
42
|
return {};
|
|
@@ -60,8 +63,8 @@ const create$2 = context => {
|
|
|
60
63
|
|
|
61
64
|
const actionVersions = {
|
|
62
65
|
__proto__: null,
|
|
63
|
-
create: create$
|
|
64
|
-
meta: meta$
|
|
66
|
+
create: create$6,
|
|
67
|
+
meta: meta$6
|
|
65
68
|
};
|
|
66
69
|
|
|
67
70
|
const parseVersion = value => {
|
|
@@ -85,7 +88,7 @@ const isSupportedMacosversion = version => {
|
|
|
85
88
|
const isSupportedWindowsVersion = version => {
|
|
86
89
|
return config.windows.includes(version);
|
|
87
90
|
};
|
|
88
|
-
const meta$
|
|
91
|
+
const meta$5 = {
|
|
89
92
|
type: 'problem',
|
|
90
93
|
docs: {
|
|
91
94
|
description: 'Disallow unsupported ci versions'
|
|
@@ -94,7 +97,7 @@ const meta$1 = {
|
|
|
94
97
|
unsupportedCiVersion: 'Unsupported ci version: {{value}}'
|
|
95
98
|
}
|
|
96
99
|
};
|
|
97
|
-
const create$
|
|
100
|
+
const create$5 = context => {
|
|
98
101
|
const sourceCode = getSourceCode(context);
|
|
99
102
|
if (!sourceCode.parserServices?.isYAML) {
|
|
100
103
|
return {};
|
|
@@ -136,6 +139,156 @@ const create$1 = context => {
|
|
|
136
139
|
};
|
|
137
140
|
|
|
138
141
|
const ciVersions = {
|
|
142
|
+
__proto__: null,
|
|
143
|
+
create: create$5,
|
|
144
|
+
meta: meta$5
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const meta$4 = {
|
|
148
|
+
type: 'problem',
|
|
149
|
+
docs: {
|
|
150
|
+
description: 'Disallow unsupported fail fast values'
|
|
151
|
+
},
|
|
152
|
+
messages: {
|
|
153
|
+
unsupportedFailFast: 'Unsupported fail fast value: {{value}}'
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const create$4 = context => {
|
|
157
|
+
const sourceCode = getSourceCode(context);
|
|
158
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
159
|
+
return {};
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
YAMLPair(node) {
|
|
163
|
+
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') {
|
|
164
|
+
const nodeValue = node.value.value;
|
|
165
|
+
context.report({
|
|
166
|
+
node,
|
|
167
|
+
messageId: 'unsupportedFailFast',
|
|
168
|
+
data: {
|
|
169
|
+
value: nodeValue
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const failFast = {
|
|
178
|
+
__proto__: null,
|
|
179
|
+
create: create$4,
|
|
180
|
+
meta: meta$4
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const meta$3 = {
|
|
184
|
+
type: 'problem',
|
|
185
|
+
docs: {
|
|
186
|
+
description: 'Disallow unsupported max parallel values'
|
|
187
|
+
},
|
|
188
|
+
messages: {
|
|
189
|
+
unsupportedMaxParallel: 'Unsupported max parallel value: {{value}}'
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const create$3 = context => {
|
|
193
|
+
const sourceCode = getSourceCode(context);
|
|
194
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
195
|
+
return {};
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
YAMLPair(node) {
|
|
199
|
+
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') {
|
|
200
|
+
const nodeValue = node.value.value;
|
|
201
|
+
context.report({
|
|
202
|
+
node,
|
|
203
|
+
messageId: 'unsupportedMaxParallel',
|
|
204
|
+
data: {
|
|
205
|
+
value: nodeValue
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const maxParallel = {
|
|
214
|
+
__proto__: null,
|
|
215
|
+
create: create$3,
|
|
216
|
+
meta: meta$3
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const meta$2 = {
|
|
220
|
+
type: 'problem',
|
|
221
|
+
docs: {
|
|
222
|
+
description: 'Disallow unsupported npm registry values'
|
|
223
|
+
},
|
|
224
|
+
messages: {
|
|
225
|
+
unsupportedNpmRegistry: 'Unsupported npm registry value: {{value}}'
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const create$2 = context => {
|
|
229
|
+
const sourceCode = getSourceCode(context);
|
|
230
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
231
|
+
return {};
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
YAMLPair(node) {
|
|
235
|
+
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 === 'registry-url' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
|
|
236
|
+
const nodeValue = node.value.value;
|
|
237
|
+
if (typeof nodeValue !== 'string' || !npmRegistries.includes(nodeValue)) {
|
|
238
|
+
context.report({
|
|
239
|
+
node,
|
|
240
|
+
messageId: 'unsupportedNpmRegistry',
|
|
241
|
+
data: {
|
|
242
|
+
value: nodeValue
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const npmRegistry = {
|
|
252
|
+
__proto__: null,
|
|
253
|
+
create: create$2,
|
|
254
|
+
meta: meta$2
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const meta$1 = {
|
|
258
|
+
type: 'problem',
|
|
259
|
+
docs: {
|
|
260
|
+
description: 'Disallow unsupported on values'
|
|
261
|
+
},
|
|
262
|
+
messages: {
|
|
263
|
+
unsupportedOn: 'Unsupported on value: {{value}}'
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const create$1 = context => {
|
|
267
|
+
const sourceCode = getSourceCode(context);
|
|
268
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
269
|
+
return {};
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
YAMLPair(node) {
|
|
273
|
+
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') {
|
|
274
|
+
const pairs = node.value.pairs;
|
|
275
|
+
for (const pair of pairs) {
|
|
276
|
+
if (pair.key && pair.key.type === 'YAMLScalar' && typeof pair.key.value === 'string' && !onProperties.includes(pair.key.value)) {
|
|
277
|
+
context.report({
|
|
278
|
+
node,
|
|
279
|
+
messageId: 'unsupportedOn',
|
|
280
|
+
data: {
|
|
281
|
+
value: pair.key.value
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const on = {
|
|
139
292
|
__proto__: null,
|
|
140
293
|
create: create$1,
|
|
141
294
|
meta: meta$1
|
|
@@ -183,9 +336,13 @@ const plugin = {
|
|
|
183
336
|
version: '0.0.1'
|
|
184
337
|
},
|
|
185
338
|
rules: {
|
|
186
|
-
'ci-versions': ciVersions,
|
|
187
339
|
'action-versions': actionVersions,
|
|
188
|
-
'
|
|
340
|
+
'ci-versions': ciVersions,
|
|
341
|
+
'max-parallel': maxParallel,
|
|
342
|
+
'npm-registry': npmRegistry,
|
|
343
|
+
'fail-fast': failFast,
|
|
344
|
+
'timeout-minutes': timeoutMinutes,
|
|
345
|
+
on: on
|
|
189
346
|
}
|
|
190
347
|
};
|
|
191
348
|
const recommended = [{
|
|
@@ -197,8 +354,13 @@ const recommended = [{
|
|
|
197
354
|
parser: parserYAML
|
|
198
355
|
},
|
|
199
356
|
rules: {
|
|
357
|
+
'github-actions/action-versions': 'error',
|
|
200
358
|
'github-actions/ci-versions': 'error',
|
|
201
|
-
'github-actions/
|
|
359
|
+
'github-actions/fail-fast': 'error',
|
|
360
|
+
'github-actions/max-parallel': 'error',
|
|
361
|
+
'github-actions/npm-registry': 'error',
|
|
362
|
+
'github-actions/on': 'error',
|
|
363
|
+
'github-actions/timeout-minutes': 'error'
|
|
202
364
|
}
|
|
203
365
|
}];
|
|
204
366
|
|