refine: stylelint 配置

This commit is contained in:
菲鸽 2024-04-07 17:21:44 +08:00
parent 01098cfe29
commit b5700cf767
3 changed files with 21 additions and 2 deletions

View File

@ -9,6 +9,7 @@ module.exports = {
'stylelint-config-html/vue', 'stylelint-config-html/vue',
'stylelint-config-recess-order', 'stylelint-config-recess-order',
], ],
plugins: ['stylelint-prettier'],
overrides: [ overrides: [
// 扫描 .vue/html 文件中的<style>标签内的样式 // 扫描 .vue/html 文件中的<style>标签内的样式
{ {
@ -22,6 +23,7 @@ module.exports = {
], ],
// 自定义规则 // 自定义规则
rules: { rules: {
'prettier/prettier': true,
// 允许 global 、export 、v-deep等伪类 // 允许 global 、export 、v-deep等伪类
'selector-pseudo-class-no-unknown': [ 'selector-pseudo-class-no-unknown': [
true, true,
@ -42,9 +44,10 @@ module.exports = {
ignoreTypes: ['page'], ignoreTypes: ['page'],
}, },
], ],
'comment-empty-line-before': 'never', 'comment-empty-line-before': 'never', // never|always|always-multi-line|never-multi-line
'custom-property-empty-line-before': 'never', 'custom-property-empty-line-before': 'never',
'no-empty-source': null, 'no-empty-source': null,
'scss/comment-no-empty': null, 'comment-no-empty': null,
'no-duplicate-selectors': null,
}, },
} }

View File

@ -142,6 +142,7 @@
"stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard": "^35.0.0", "stylelint-config-standard": "^35.0.0",
"stylelint-config-standard-scss": "^12.0.0", "stylelint-config-standard-scss": "^12.0.0",
"stylelint-prettier": "^5.0.0",
"terser": "^5.26.0", "terser": "^5.26.0",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"unocss": "^0.58.0", "unocss": "^0.58.0",

15
pnpm-lock.yaml generated
View File

@ -196,6 +196,9 @@ devDependencies:
stylelint-config-standard-scss: stylelint-config-standard-scss:
specifier: ^12.0.0 specifier: ^12.0.0
version: 12.0.0(postcss@8.4.32)(stylelint@16.0.2) version: 12.0.0(postcss@8.4.32)(stylelint@16.0.2)
stylelint-prettier:
specifier: ^5.0.0
version: 5.0.0(prettier@3.2.5)(stylelint@16.0.2)
terser: terser:
specifier: ^5.26.0 specifier: ^5.26.0
version: 5.26.0 version: 5.26.0
@ -12908,6 +12911,18 @@ packages:
stylelint: 16.0.2(typescript@4.9.5) stylelint: 16.0.2(typescript@4.9.5)
dev: true dev: true
/stylelint-prettier@5.0.0(prettier@3.2.5)(stylelint@16.0.2):
resolution: {integrity: sha512-RHfSlRJIsaVg5Br94gZVdWlz/rBTyQzZflNE6dXvSxt/GthWMY3gEHsWZEBaVGg7GM+XrtVSp4RznFlB7i0oyw==}
engines: {node: '>=18.12.0'}
peerDependencies:
prettier: '>=3.0.0'
stylelint: '>=16.0.0'
dependencies:
prettier: 3.2.5
prettier-linter-helpers: 1.0.0
stylelint: 16.0.2(typescript@4.9.5)
dev: true
/stylelint-scss@6.0.0(stylelint@16.0.2): /stylelint-scss@6.0.0(stylelint@16.0.2):
resolution: {integrity: sha512-N1xV/Ef5PNRQQt9E45unzGvBUN1KZxCI8B4FgN/pMfmyRYbZGVN4y9qWlvOMdScU17c8VVCnjIHTVn38Bb6qSA==} resolution: {integrity: sha512-N1xV/Ef5PNRQQt9E45unzGvBUN1KZxCI8B4FgN/pMfmyRYbZGVN4y9qWlvOMdScU17c8VVCnjIHTVn38Bb6qSA==}
engines: {node: '>=18.12.0'} engines: {node: '>=18.12.0'}