@lvce-editor/eslint-plugin-github-actions 2.3.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.
Files changed (2) hide show
  1. package/dist/index.js +214 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12,15 +12,22 @@ const platforms = {
12
12
  macos: 'macos'
13
13
  };
14
14
  const actions = {
15
- 'actions/checkout': ['actions/checkout@v4'],
15
+ 'actions/checkout': ['actions/checkout@v5'],
16
16
  'actions/setup-node': ['actions/setup-node@v6'],
17
- 'actions/cache': ['actions/cache@v4']
17
+ 'actions/cache': ['actions/cache@v4'],
18
+ 'actions/upload-pages-artifact': ['actions/upload-pages-artifact@v4'],
19
+ 'actions/deploy-pages': ['actions/deploy-pages@v4'],
20
+ 'actions/download-artifact': ['actions/download-artifact@v4'],
21
+ 'actions/upload-artifact': ['actions/upload-artifact@v4'],
22
+ 'actions/create-release': ['actions/create-release@v1']
18
23
  };
24
+ const npmRegistries = ['https://registry.npmjs.org', 'https://npm.pkg.github.com'];
25
+ const onProperties = ['push', 'pull_request'];
19
26
 
20
27
  const isSupported = (actions, value) => {
21
28
  return actions.includes(value);
22
29
  };
23
- const meta$1 = {
30
+ const meta$6 = {
24
31
  type: 'problem',
25
32
  docs: {
26
33
  description: 'Disallow unsupported action versions'
@@ -29,7 +36,7 @@ const meta$1 = {
29
36
  unsupportedActionVersion: 'Unsupported action version: {{value}}'
30
37
  }
31
38
  };
32
- const create$1 = context => {
39
+ const create$6 = context => {
33
40
  const sourceCode = getSourceCode(context);
34
41
  if (!sourceCode.parserServices?.isYAML) {
35
42
  return {};
@@ -56,11 +63,11 @@ const create$1 = context => {
56
63
 
57
64
  const actionVersions = {
58
65
  __proto__: null,
59
- create: create$1,
60
- meta: meta$1
66
+ create: create$6,
67
+ meta: meta$6
61
68
  };
62
69
 
63
- const parseVersion = (value, prefix) => {
70
+ const parseVersion = value => {
64
71
  return value;
65
72
  };
66
73
  const parseUbuntuVersion = value => {
@@ -81,7 +88,7 @@ const isSupportedMacosversion = version => {
81
88
  const isSupportedWindowsVersion = version => {
82
89
  return config.windows.includes(version);
83
90
  };
84
- const meta = {
91
+ const meta$5 = {
85
92
  type: 'problem',
86
93
  docs: {
87
94
  description: 'Disallow unsupported ci versions'
@@ -90,7 +97,7 @@ const meta = {
90
97
  unsupportedCiVersion: 'Unsupported ci version: {{value}}'
91
98
  }
92
99
  };
93
- const create = context => {
100
+ const create$5 = context => {
94
101
  const sourceCode = getSourceCode(context);
95
102
  if (!sourceCode.parserServices?.isYAML) {
96
103
  return {};
@@ -132,6 +139,192 @@ const create = context => {
132
139
  };
133
140
 
134
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 = {
292
+ __proto__: null,
293
+ create: create$1,
294
+ meta: meta$1
295
+ };
296
+
297
+ const meta = {
298
+ type: 'problem',
299
+ docs: {
300
+ description: 'Disallow unsupported timeout minute values'
301
+ },
302
+ messages: {
303
+ unsupportedTimeoutMinutes: 'Unsupported timeout minutes value: {{value}}'
304
+ }
305
+ };
306
+ const create = context => {
307
+ const sourceCode = getSourceCode(context);
308
+ if (!sourceCode.parserServices?.isYAML) {
309
+ return {};
310
+ }
311
+ return {
312
+ YAMLPair(node) {
313
+ 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') {
314
+ const nodeValue = node.value.value;
315
+ context.report({
316
+ node,
317
+ messageId: 'unsupportedTimeoutMinutes',
318
+ data: {
319
+ value: nodeValue
320
+ }
321
+ });
322
+ }
323
+ }
324
+ };
325
+ };
326
+
327
+ const timeoutMinutes = {
135
328
  __proto__: null,
136
329
  create,
137
330
  meta
@@ -143,8 +336,13 @@ const plugin = {
143
336
  version: '0.0.1'
144
337
  },
145
338
  rules: {
339
+ 'action-versions': actionVersions,
146
340
  'ci-versions': ciVersions,
147
- 'action-versions': actionVersions
341
+ 'max-parallel': maxParallel,
342
+ 'npm-registry': npmRegistry,
343
+ 'fail-fast': failFast,
344
+ 'timeout-minutes': timeoutMinutes,
345
+ on: on
148
346
  }
149
347
  };
150
348
  const recommended = [{
@@ -156,8 +354,13 @@ const recommended = [{
156
354
  parser: parserYAML
157
355
  },
158
356
  rules: {
357
+ 'github-actions/action-versions': 'error',
159
358
  'github-actions/ci-versions': 'error',
160
- 'github-actions/action-versions': 'error'
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'
161
364
  }
162
365
  }];
163
366
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-plugin-github-actions",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],