diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 769dcdb..4f69855 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -27,6 +27,7 @@ module.exports = { 'plugin:prettier/recommended', './.eslintrc-auto-import.json' ], + ignorePatterns: ['utils/log.js', 'unpackage/**/*'], /** * "off" 或 0 ==> 关闭规则 * "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行) @@ -73,7 +74,7 @@ module.exports = { 'vue/singleline-html-element-content-newline': 'off', // 在单行元素的内容之前和之后需要换行符 'vue/attribute-hyphenation': 'off', // 对模板中的自定义组件强制执行属性命名样式 'vue/require-default-prop': 'off', // 此规则要求为每个 prop 为必填时,必须提供默认值 - 'vue/multi-word-component-names': 'off', // 要求组件名称始终为 “-” 链接的单词 + 'vue/multi-word-component-names': 'off', // 要求组件名称始终为 "-" 链接的单词 'vue.prefer-template': 'off', 'vuejs-accessibility/click-events-have-key-events': 'off', 'no-console': 'off', diff --git a/.lintstagedrc.json b/.lintstagedrc.json index 3fa3573..3ae556d 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,9 +1,4 @@ { - "src/**/*.{vue,js}": [ - "npm run prettier", - "npm run eslint" - ], - "src/**/*.{vue,scss,css,less}": [ - "npm run stylelint:out" - ] + "src/**/*.{vue,js}": ["npm run prettier", "npm run eslint"], + "src/**/*.{vue,scss,css,less}": ["npm run stylelint:out"] } diff --git a/.prettierrc.json b/.prettierrc.json index f353308..6557641 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -15,8 +15,5 @@ "embeddedLanguageFormatting": "auto", "vueIndentScriptAndStyle": true, "singleAttributePerLine": false, - "htmlWhitespaceSensitivity": "css", - "requirePragma": false, - "insertPragma": false, - "proseWrap": "preserve" + "htmlWhitespaceSensitivity": "css" } diff --git a/.stylelintrc.json b/.stylelintrc.json index 3cd2e82..d2921e2 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -5,9 +5,22 @@ "stylelint-config-recess-order", "stylelint-config-html/vue" ], + "ignoreFiles": ["**/*.js", "**/*.ts", "unpackage/**/*"], "overrides": [ { - "files": ["**/*.(scss|css|vue|html)"], + "files": ["**/*.vue"], + "customSyntax": "postcss-html", + "rules": { + "at-rule-no-unknown": null, + "no-unknown-custom-properties": null + } + }, + { + "files": ["**/*.vue/*.scss"], + "customSyntax": "postcss-scss" + }, + { + "files": ["**/*.(scss|css|html)"], "customSyntax": "postcss-scss" } ], @@ -23,32 +36,20 @@ } ], "color-hex-length": null, - "declaration-property-value-no-unknown": [ - true, - { - "ignoreProperties": [ - "font-size", - "width", - "height", - "margin", - "padding", - "border-radius", - "line-height", - "box-shadow" - ] - } - ], + "declaration-property-value-no-unknown": null, "shorthand-property-no-redundant-values": null, "alpha-value-notation": null, "color-function-notation": null, - "declaration-property-value-allowed-list": { - "font-size": ["/rpx$/"], - "width": ["/rpx$/"], - "height": ["/rpx$/"], - "margin": ["/rpx$/"], - "padding": ["/rpx$/"], - "border-radius": ["/rpx$/"], - "line-height": ["/rpx$/"] - } + "at-rule-no-unknown": null, + "property-no-unknown": null, + "no-unknown-custom-properties": null, + "value-keyword-case": null, + "custom-property-pattern": null, + "selector-pseudo-class-no-unknown": [ + true, + { + "ignorePseudoClasses": ["deep", "global"] + } + ] } } diff --git a/package.json b/package.json index 136b775..2ddc94c 100644 --- a/package.json +++ b/package.json @@ -30,5 +30,12 @@ "unocss-preset-weapp": "^65.4.1", "vite-plugin-eslint": "^1.8.1", "postcss-scss": "^4.0.9" + }, + "scripts": { + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"", + "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"", + "lint": "eslint --fix \"**/*.{js,jsx,ts,tsx,vue}\"", + "lint:style": "stylelint --fix \"**/*.{css,scss,vue}\"", + "lint:all": "npm run format && npm run lint && npm run lint:style" } } diff --git a/pages/addDeviceForBluetooth/addLockGuid.vue b/pages/addDeviceForBluetooth/addLockGuid.vue index 42e3368..544c149 100644 --- a/pages/addDeviceForBluetooth/addLockGuid.vue +++ b/pages/addDeviceForBluetooth/addLockGuid.vue @@ -54,10 +54,10 @@ diff --git a/pages/main/home.vue b/pages/main/home.vue index 7dc265f..bd9f770 100644 --- a/pages/main/home.vue +++ b/pages/main/home.vue @@ -1,6 +1,6 @@