Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 8034d68

Browse files
authored
feat(lint): add stylelint-config-standard and separate lint scripts (#493)
1 parent af164a7 commit 8034d68

File tree

21 files changed

+1451
-55
lines changed

21 files changed

+1451
-55
lines changed

.stylelintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
packages/cna-template/template/nuxt/pages/index.vue
3+
packages/cna-template/template/frameworks/iview/pages/index.vue

.stylelintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "stylelint-config-standard"
3+
}

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"type": "git"
99
},
1010
"scripts": {
11-
"lint": "eslint --ext .js,.mjs,.vue .",
11+
"lint": "yarn lint:js && yarn lint:style",
12+
"lint:js": "eslint --ext .js,.mjs,.vue .",
13+
"lint:style": "stylelint **/*.{vue,css}",
1214
"test": "ava --verbose",
1315
"test:snapshot": "ava --verbose --update-snapshots"
1416
},
@@ -17,7 +19,9 @@
1719
"@nuxtjs/eslint-config": "^2.0.2",
1820
"ava": "^3.7.1",
1921
"eslint": "^6.8.0",
20-
"lerna": "^3.20.2"
22+
"lerna": "^3.20.2",
23+
"stylelint": "^13.3.3",
24+
"stylelint-config-standard": "^20.0.0"
2125
},
2226
"name": "create-nuxt-app"
2327
}

packages/cna-template/template/_stylelint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
extends: 'stylelint-config-standard',
23
// add your custom config here
34
// https://stylelint.io/user-guide/configuration
45
rules: {}

packages/cna-template/template/frameworks/framevuerk/components/FramevuerkLogo.vue

+10-5
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,31 @@ export default {
4848
vertical-align: middle;
4949
width: 43px;
5050
}
51+
5152
.logo svg {
52-
width: 100%;
53-
height: auto;
54-
max-height: 12em;
55-
margin: 0 auto;
53+
width: 100%;
54+
height: auto;
55+
max-height: 12em;
56+
margin: 0 auto;
5657
}
58+
5759
.logo svg polygon {
5860
transform: translateY(-100%);
5961
transition-duration: 2s;
6062
}
63+
6164
.logo svg path {
6265
fill: transparent;
6366
transition-delay: 0.6s;
6467
transition-duration: 1s;
6568
}
69+
6670
.logo.ready svg polygon {
6771
transform: translateY(0);
6872
fill: #fff;
6973
}
70-
.logo.ready svg path {
74+
75+
.logo.ready svg path {
7176
stroke: transparent;
7277
stroke-width: 0;
7378
fill: #fff;

packages/cna-template/template/frameworks/framevuerk/layouts/default.vue

+14-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@
44

55
<style>
66
html {
7-
font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI',
8-
Roboto, 'Helvetica Neue', Arial, sans-serif;
7+
font-family:
8+
'Source Sans Pro',
9+
-apple-system,
10+
BlinkMacSystemFont,
11+
'Segoe UI',
12+
Roboto,
13+
'Helvetica Neue',
14+
Arial,
15+
sans-serif;
916
font-size: 15px;
1017
word-spacing: 1px;
1118
-ms-text-size-adjust: 100%;
@@ -14,12 +21,14 @@ html {
1421
-webkit-font-smoothing: antialiased;
1522
box-sizing: border-box;
1623
}
24+
1725
*,
18-
*:before,
19-
*:after {
26+
*::before,
27+
*::after {
2028
box-sizing: border-box;
2129
margin: 0;
2230
}
31+
2332
html,
2433
body,
2534
#__nuxt,
@@ -28,6 +37,7 @@ body,
2837
height: 100%;
2938
position: initial;
3039
}
40+
3141
body .material-icons {
3242
vertical-align: middle;
3343
}

packages/cna-template/template/frameworks/framevuerk/pages/index.vue

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export default {
177177
margin: 0 auto;
178178
max-width: 768px;
179179
}
180+
180181
.sidebar {
181182
min-width: 300px;
182183
}

packages/cna-template/template/frameworks/iview/pages/index.vue

+13-2
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,33 @@ export default {
4141
align-items: center;
4242
text-align: center;
4343
}
44+
4445
.title {
45-
font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
46-
'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
46+
font-family:
47+
'Quicksand',
48+
'Source Sans Pro',
49+
-apple-system,
50+
BlinkMacSystemFont,
51+
'Segoe UI',
52+
Roboto,
53+
'Helvetica Neue',
54+
Arial,
55+
sans-serif;
4756
display: block;
4857
font-weight: 300;
4958
font-size: 100px;
5059
color: #35495e;
5160
letter-spacing: 1px;
5261
}
62+
5363
.subtitle {
5464
font-weight: 300;
5565
font-size: 42px;
5666
color: #526488;
5767
word-spacing: 5px;
5868
padding-bottom: 15px;
5969
}
70+
6071
.links {
6172
padding-top: 15px;
6273
}

packages/cna-template/template/frameworks/vuesax/components/VuesaxLogo.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
width: 100%;
99
max-width: 170px;
1010
}
11+
1112
.vuesax-logo svg {
1213
width: 100%;
13-
fill: #35495e
14+
fill: #35495e;
1415
}
1516
</style>

packages/cna-template/template/frameworks/vuesax/pages/index.vue

+26-8
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,23 @@ export default {
8484
}
8585
8686
.title {
87-
font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
88-
'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
87+
font-family:
88+
'Quicksand',
89+
'Source Sans Pro',
90+
-apple-system,
91+
BlinkMacSystemFont,
92+
'Segoe UI',
93+
Roboto,
94+
'Helvetica Neue',
95+
Arial,
96+
sans-serif;
8997
display: block;
9098
font-weight: 300;
9199
font-size: 55px;
92100
color: #35495e;
93101
letter-spacing: 1px;
94102
text-transform: capitalize;
95-
margin: 25px 0px
103+
margin: 25px 0;
96104
}
97105
98106
.subtitle {
@@ -106,12 +114,12 @@ export default {
106114
107115
.subtitle a {
108116
font-weight: 500;
109-
color: inherit
117+
color: inherit;
110118
}
111119
112120
.links {
113121
padding-top: 15px;
114-
margin-bottom: 20px
122+
margin-bottom: 20px;
115123
}
116124
117125
.content-logos {
@@ -120,14 +128,24 @@ export default {
120128
justify-content: center;
121129
min-width: 500px;
122130
}
131+
123132
.plus {
124133
font-size: 2.5rem;
125134
margin: 15px;
126-
color: #35495e
135+
color: #35495e;
127136
}
137+
128138
.h3 {
129-
font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
130-
'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
139+
font-family:
140+
'Quicksand',
141+
'Source Sans Pro',
142+
-apple-system,
143+
BlinkMacSystemFont,
144+
'Segoe UI',
145+
Roboto,
146+
'Helvetica Neue',
147+
Arial,
148+
sans-serif;
131149
font-weight: 400;
132150
margin: 10px;
133151
}

packages/cna-template/template/frameworks/vuetify/components/VuetifyLogo.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<style>
1010
.VuetifyLogo {
11-
height:180px;
11+
height: 180px;
1212
width: 180px;
1313
transform: rotateY(560deg);
1414
animation: turn 3.5s ease-out forwards 1s;

packages/cna-template/template/nuxt/components/Logo.vue

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
0% {
2828
opacity: 0;
2929
}
30+
3031
100% {
3132
opacity: 1;
3233
}

packages/cna-template/template/nuxt/layouts/default.vue

+11-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66

77
<style>
88
html {
9-
font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI',
10-
Roboto, 'Helvetica Neue', Arial, sans-serif;
9+
font-family:
10+
'Source Sans Pro',
11+
-apple-system,
12+
BlinkMacSystemFont,
13+
'Segoe UI',
14+
Roboto,
15+
'Helvetica Neue',
16+
Arial,
17+
sans-serif;
1118
font-size: 16px;
1219
word-spacing: 1px;
1320
-ms-text-size-adjust: 100%;
@@ -18,8 +25,8 @@ html {
1825
}
1926
2027
*,
21-
*:before,
22-
*:after {
28+
*::before,
29+
*::after {
2330
box-sizing: border-box;
2431
margin: 0;
2532
}

packages/cna-template/template/nuxt/package.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ module.exports = {
1616
const lintStaged = eslint && linter.includes('lintStaged')
1717
const stylelint = linter.includes('stylelint')
1818
const prettier = linter.includes('prettier')
19+
const lintScripts = {
20+
eslint: '<%= pmRun %> lint:js',
21+
stylelint: '<%= pmRun %> lint:style'
22+
}
1923

2024
if (!eslint) {
21-
delete pkg.scripts.lint
25+
delete lintScripts.eslint
26+
delete pkg.scripts['lint:js']
2227
delete pkg.devDependencies['@nuxtjs/eslint-config']
2328
delete pkg.devDependencies['@nuxtjs/eslint-module']
2429
delete pkg.devDependencies['babel-eslint']
@@ -32,16 +37,24 @@ module.exports = {
3237
delete pkg.devDependencies['lint-staged']
3338
}
3439
if (!stylelint) {
35-
lintStaged && delete pkg['lint-staged']['*.{css,vue']
40+
lintStaged && delete pkg['lint-staged']['*.{css,vue}']
41+
delete lintScripts.stylelint
42+
delete pkg.scripts['lint:style']
3643
delete pkg.devDependencies['@nuxtjs/stylelint-module']
3744
delete pkg.devDependencies.stylelint
45+
delete pkg.devDependencies['stylelint-config-standard']
3846
}
3947
if (!prettier) {
4048
delete pkg.devDependencies['eslint-config-prettier']
4149
delete pkg.devDependencies['eslint-plugin-prettier']
4250
delete pkg.devDependencies.prettier
4351
}
4452

53+
const lintScript = Object.values(lintScripts).join(' && ')
54+
if (lintScript) {
55+
pkg.scripts.lint = lintScript
56+
}
57+
4558
// Modules
4659
if (!features.includes('axios')) {
4760
delete pkg.dependencies['@nuxtjs/axios']

packages/cna-template/template/nuxt/package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"build": "nuxt build",
55
"start": "nuxt start",
66
"generate": "nuxt generate",
7-
"lint": "eslint --ext .js,.vue --ignore-path .gitignore ."
7+
"lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
8+
"lint:style": "stylelint **/*.{vue,css} --ignore-path .gitignore"
89
},
910
"lint-staged": {
1011
"*.{js,vue}": "eslint",
@@ -36,6 +37,7 @@
3637
"husky": "^4.2.5",
3738
"lint-staged": "^10.1.7",
3839
"@nuxtjs/stylelint-module": "^3.2.2",
39-
"stylelint": "^13.3.3"
40+
"stylelint": "^13.3.3",
41+
"stylelint-config-standard": "^20.0.0"
4042
}
4143
}

packages/cna-template/template/nuxt/pages/index.vue

+13-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ export default {
5252
<%_ if (ui === 'tailwind') { _%>
5353
/* Sample `apply` at-rules with Tailwind CSS
5454
.container {
55-
@apply min-h-screen flex justify-center items-center text-center mx-auto;
55+
@apply min-h-screen flex justify-center items-center text-center mx-auto;
5656
}
5757
*/
58-
<%_ } _%>
58+
<%_ }
59+
_%>
5960
.container {
6061
margin: 0 auto;
6162
min-height: 100vh;
@@ -66,8 +67,16 @@ export default {
6667
}
6768

6869
.title {
69-
font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
70-
'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
70+
font-family:
71+
'Quicksand',
72+
'Source Sans Pro',
73+
-apple-system,
74+
BlinkMacSystemFont,
75+
'Segoe UI',
76+
Roboto,
77+
'Helvetica Neue',
78+
Arial,
79+
sans-serif;
7180
display: block;
7281
font-weight: 300;
7382
font-size: 100px;

0 commit comments

Comments
 (0)