From e17ab1a94e8c887b41749bd0a153b8fa06760e18 Mon Sep 17 00:00:00 2001 From: Hiram <> Date: Sun, 24 Mar 2024 15:54:51 +0800 Subject: [PATCH] editer config --- .gitignore | 5 +++++ package.json | 30 +++++++++++++++++++++++++----- stylelint.config.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 stylelint.config.js diff --git a/.gitignore b/.gitignore index e7dccaa17..2f68e3f1f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,8 @@ out thumbnail .DS_Store *.log* + +# lock文件 +yarn.lock +package-lock.json +pnpm-lock.yaml \ No newline at end of file diff --git a/package.json b/package.json index e9bee5dcf..aa38ba81c 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,10 @@ "homepage": "https://github.com/Hiram-Wong/ZyPlayer", "scripts": { "format": "prettier --write .", - "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix", + "lint": "eslint --ext .vue,.js,.jsx,.ts,.tsx ./ --max-warnings 0", + "lint:fix": "eslint --ext .vue,.js,jsx,.ts,.tsx ./ --max-warnings 0 --fix", + "stylelint": "stylelint src/**/*.{html,vue,sass,less}", + "stylelint:fix": "stylelint --fix src/**/*.{html,vue,css,sass,less}", "typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false", "typecheck": "npm run typecheck:node && npm run typecheck:web", @@ -21,6 +24,7 @@ "dev": "electron-vite dev", "build": " electron-vite build", "postinstall": "electron-builder install-app-deps", + "build:web": "npm run build", "build:unpack": "npm run build && electron-builder --dir", "build:win": "npm run build && electron-builder --win", "build:mac": "npm run build && electron-builder --mac", @@ -37,10 +41,14 @@ "electron-updater": "^6.1.8", "fastify": "^4.26.2", "fastify-logger": "^1.0.1", + "hls-parser": "^0.10.9", "ip": "^2.0.1", "lodash-id": "^0.14.1", + "node-json-db": "^2.3.0", + "node-rsa": "^1.1.1", "puppeteer-core": "^22.5.0", - "puppeteer-in-electron": "^3.0.5" + "puppeteer-in-electron": "^3.0.5", + "sync-fetch": "^0.5.2" }, "devDependencies": { "@electron-toolkit/eslint-config": "^1.0.2", @@ -88,18 +96,21 @@ "public-ip": "^6.0.2", "qrcode.vue": "^3.4.1", "qs": "^6.12.0", - "sync-request": "^6.1.0", + "stylelint": "~16.2.1", + "stylelint-config-standard": "^36.0.0", + "stylelint-order": "~6.0.4", "tdesign-icons-vue-next": "^0.2.2", "tdesign-vue-next": "^1.9.0", + "terser": "^5.29.2", "typescript": "^5.4.2", "unplugin-auto-import": "^0.17.5", "unplugin-vue-components": "^0.26.0", "url": "^0.11.3", "uuid-by-string": "^4.0.0", "v3-infinite-loading": "^1.3.1", - "vite": "^5.1.6", + "vite": "^5.2.4", "vite-svg-loader": "^5.1.0", - "vue": "~3.3.8", + "vue": "^3.4.21", "vue-i18n": "^9.10.2", "vue-router": "^4.3.0", "vue-tsc": "^2.0.6", @@ -110,6 +121,15 @@ "xgplayer-mp4": "^3.0.14", "xpath": "^0.0.34" }, + "lint-staged": { + "*.{js,jsx,vue,ts,tsx}": [ + "prettier --write", + "npm run lint:fix" + ], + "*.{html,vue,css,sass,less}": [ + "npm run stylelint:fix" + ] + }, "engines": { "node": ">=18.18.0" } diff --git a/stylelint.config.js b/stylelint.config.js new file mode 100644 index 000000000..136a61275 --- /dev/null +++ b/stylelint.config.js @@ -0,0 +1,28 @@ +export default { + defaultSeverity: 'error', + extends: ['stylelint-config-standard'], + rules: { + 'no-descending-specificity': null, + 'import-notation': 'string', + 'no-empty-source': null, + 'custom-property-pattern': null, + 'selector-class-pattern': null, + 'selector-pseudo-class-no-unknown': [ + true, + { + ignorePseudoClasses: ['deep'], + }, + ], + 'media-query-no-invalid': null, // 官方表示此规则应当仅对于原生CSS启用,对于预处理器(Less)不应启用 + }, + overrides: [ + { + files: ['**/*.html', '**/*.vue'], + customSyntax: 'postcss-html', + }, + { + files: ['**/*.less'], + customSyntax: 'postcss-less', + }, + ], +}; \ No newline at end of file