Skip to content

Commit 124cc37

Browse files
authored
Add github workflows (#1843)
* Add github workflows * Fix CI errors
1 parent 926064c commit 124cc37

File tree

3 files changed

+74
-27
lines changed

3 files changed

+74
-27
lines changed

.github/workflows/CI.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
8+
jobs:
9+
lint:
10+
name: Lint
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
- name: Install Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 16
19+
- name: Install Packages
20+
run: npm install --legacy-peer-deps
21+
- name: Lint
22+
run: npm run lint
23+
24+
test:
25+
name: Test
26+
strategy:
27+
matrix:
28+
node: [16, 17]
29+
os: [ubuntu-latest]
30+
31+
runs-on: ${{ matrix.os }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v3
35+
- name: Install Node.js v${{ matrix.node }}
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: ${{ matrix.node }}
39+
- name: Install Packages
40+
run: npm install --legacy-peer-deps
41+
- name: Test
42+
run: npm test

lib/rules/component-tags-order.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = {
4747
],
4848
messages: {
4949
unexpected:
50-
'<{{elementName}}{{elementAttributes}}> should be above <{{firstUnorderedName}}{{firstUnorderedAttributes}}> on line {{line}}.'
50+
"'<{{elementName}}{{elementAttributes}}>' should be above '<{{firstUnorderedName}}{{firstUnorderedAttributes}}>' on line {{line}}."
5151
}
5252
},
5353
/**
@@ -83,7 +83,7 @@ module.exports = {
8383

8484
return `${attribute.key.name}${
8585
attribute.value && attribute.value.value
86-
? '=' + attribute.value.value
86+
? `=${attribute.value.value}`
8787
: ''
8888
}`
8989
})
@@ -177,11 +177,11 @@ module.exports = {
177177
data: {
178178
elementName: element.name,
179179
elementAttributes: elementAttributes
180-
? ' ' + elementAttributes
180+
? ` ${elementAttributes}`
181181
: '',
182182
firstUnorderedName: firstUnordered.name,
183183
firstUnorderedAttributes: firstUnorderedttributes
184-
? ' ' + firstUnorderedttributes
184+
? ` ${firstUnorderedttributes}`
185185
: '',
186186
line: firstUnordered.loc.start.line
187187
},

tests/lib/rules/component-tags-order.js

+28-23
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,18 @@ tester.run('component-tags-order', rule, {
107107
{
108108
code: '<script setup></script><script></script><template></template><style></style>',
109109
output: null,
110-
options: [{ order: ['script[setup]', 'script:not([setup])', 'template', 'style'] }]
110+
options: [
111+
{ order: ['script[setup]', 'script:not([setup])', 'template', 'style'] }
112+
]
111113
},
112114
{
113115
code: '<template></template><script setup></script><script></script><style></style>',
114116
output: null,
115-
options: [{ order: [['script[setup]', 'script:not([setup])', 'template'], 'style'] }]
117+
options: [
118+
{
119+
order: [['script[setup]', 'script:not([setup])', 'template'], 'style']
120+
}
121+
]
116122
},
117123
{
118124
code: '<script></script><script setup></script><template></template><style></style>',
@@ -122,7 +128,7 @@ tester.run('component-tags-order', rule, {
122128
{
123129
code: '<template></template><script></script><script setup></script><style></style>',
124130
output: null,
125-
options: [{ order: [['script, 'template'], 'style'] }]
131+
options: [{ order: [['script', 'template'], 'style'] }]
126132
},
127133
{
128134
code: '<script></script><script setup></script><template></template><style></style>',
@@ -155,7 +161,6 @@ tester.run('component-tags-order', rule, {
155161
}
156162
]
157163
},
158-
,
159164
{
160165
code: '<template></template><script></script><script setup></script><style scoped></style><style></style><i18n lang="en"></i18n><i18n lang="ja"></i18n>',
161166
output: null,
@@ -200,12 +205,12 @@ tester.run('component-tags-order', rule, {
200205
code: '<style></style><template></template><script></script>',
201206
errors: [
202207
{
203-
message: '<template> should be above <style> on line 1.',
208+
message: "'<template>' should be above '<style>' on line 1.",
204209
line: 1,
205210
column: 16
206211
},
207212
{
208-
message: '<script> should be above <style> on line 1.',
213+
message: "'<script>' should be above '<style>' on line 1.",
209214
line: 1,
210215
column: 37
211216
}
@@ -217,7 +222,7 @@ tester.run('component-tags-order', rule, {
217222
options: [{ order: ['script', 'template', 'style'] }],
218223
errors: [
219224
{
220-
message: '<script> should be above <template> on line 1.',
225+
message: "'<script>' should be above '<template>' on line 1.",
221226
line: 1,
222227
column: 22
223228
}
@@ -233,7 +238,7 @@ tester.run('component-tags-order', rule, {
233238
<script></script>`,
234239
errors: [
235240
{
236-
message: '<script> should be above <style> on line 4.',
241+
message: "'<script>' should be above '<style>' on line 4.",
237242
line: 6
238243
}
239244
],
@@ -254,7 +259,7 @@ tester.run('component-tags-order', rule, {
254259
options: [{ order: ['script', 'template', 'style'] }],
255260
errors: [
256261
{
257-
message: '<script> should be above <template> on line 2.',
262+
message: "'<script>' should be above '<template>' on line 2.",
258263
line: 3
259264
}
260265
],
@@ -274,7 +279,7 @@ tester.run('component-tags-order', rule, {
274279
options: [{ order: ['template', 'script', 'style'] }],
275280
errors: [
276281
{
277-
message: '<template> should be above <script> on line 2.',
282+
message: "'<template>' should be above '<script>' on line 2.",
278283
line: 3
279284
}
280285
],
@@ -295,7 +300,7 @@ tester.run('component-tags-order', rule, {
295300
options: [{ order: ['docs', 'template', 'script', 'style'] }],
296301
errors: [
297302
{
298-
message: '<docs> should be above <template> on line 2.',
303+
message: "'<docs>' should be above '<template>' on line 2.",
299304
line: 3
300305
}
301306
],
@@ -317,7 +322,7 @@ tester.run('component-tags-order', rule, {
317322
options: [{ order: ['script', 'template', 'style'] }],
318323
errors: [
319324
{
320-
message: '<script> should be above <template> on line 2.',
325+
message: "'<script>' should be above '<template>' on line 2.",
321326
line: 4
322327
}
323328
],
@@ -340,7 +345,7 @@ tester.run('component-tags-order', rule, {
340345
options: [{ order: ['script', 'template', 'style'] }],
341346
errors: [
342347
{
343-
message: '<script> should be above <template> on line 2.',
348+
message: "'<script>' should be above '<template>' on line 2.",
344349
line: 5
345350
}
346351
],
@@ -361,7 +366,7 @@ tester.run('component-tags-order', rule, {
361366
options: [{ order: ['template', 'script'] }],
362367
errors: [
363368
{
364-
message: '<template> should be above <script> on line 2.',
369+
message: "'<template>' should be above '<script>' on line 2.",
365370
line: 3
366371
}
367372
],
@@ -376,11 +381,11 @@ tester.run('component-tags-order', rule, {
376381
`,
377382
errors: [
378383
{
379-
message: '<template> should be above <style> on line 2.',
384+
message: "'<template>' should be above '<style>' on line 2.",
380385
line: 3
381386
},
382387
{
383-
message: '<script> should be above <style> on line 2.',
388+
message: "'<script>' should be above '<style>' on line 2.",
384389
line: 4
385390
}
386391
],
@@ -400,11 +405,11 @@ tester.run('component-tags-order', rule, {
400405
`,
401406
errors: [
402407
{
403-
message: '<template> should be above <style> on line 2.',
408+
message: "'<template>' should be above '<style>' on line 2.",
404409
line: 4
405410
},
406411
{
407-
message: '<script> should be above <style> on line 2.',
412+
message: "'<script>' should be above '<style>' on line 2.",
408413
line: 5
409414
}
410415
],
@@ -424,7 +429,7 @@ tester.run('component-tags-order', rule, {
424429
`,
425430
errors: [
426431
{
427-
message: '<script> should be above <style> on line 2.',
432+
message: "'<script>' should be above '<style>' on line 2.",
428433
line: 3
429434
}
430435
],
@@ -437,7 +442,7 @@ tester.run('component-tags-order', rule, {
437442
errors: [
438443
{
439444
message:
440-
'<i18n locale=en> should be above <i18n locale=ja> on line 1.',
445+
"'<i18n locale=en>' should be above '<i18n locale=ja>' on line 1.",
441446
line: 1
442447
}
443448
]
@@ -448,7 +453,7 @@ tester.run('component-tags-order', rule, {
448453
options: [{ order: ['style:not([scoped])', 'style[scoped]'] }],
449454
errors: [
450455
{
451-
message: '<style> should be above <style scoped> on line 1.',
456+
message: "'<style>' should be above '<style scoped>' on line 1.",
452457
line: 1
453458
}
454459
]
@@ -459,7 +464,7 @@ tester.run('component-tags-order', rule, {
459464
options: [{ order: ['style[scoped]', 'style:not([scoped])'] }],
460465
errors: [
461466
{
462-
message: '<style scoped> should be above <style> on line 1.',
467+
message: "'<style scoped>' should be above '<style>' on line 1.",
463468
line: 1
464469
}
465470
]
@@ -470,7 +475,7 @@ tester.run('component-tags-order', rule, {
470475
options: [{ order: ['script:not([scoped])', 'style:not([scoped])'] }],
471476
errors: [
472477
{
473-
message: '<script> should be above <style> on line 1.',
478+
message: "'<script>' should be above '<style>' on line 1.",
474479
line: 1
475480
}
476481
]

0 commit comments

Comments
 (0)