🧑‍💻 perf(弃用 prettier ,换成 eslint + stylelint):

依旧感谢岛风酱的代码 @frg2089

Co-authored-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
This commit is contained in:
BTMuli
2023-04-05 21:27:02 +08:00
committed by 舰队的偶像-岛风酱!
parent 0663d609c9
commit d817628de5
9 changed files with 4047 additions and 437 deletions

90
.eslintrc.yml Normal file
View File

@@ -0,0 +1,90 @@
root: true
env:
browser: true
es2021: true
extends:
- plugin:vue/vue3-recommended
- standard-with-typescript
overrides: []
parser: vue-eslint-parser
parserOptions:
parser: "@typescript-eslint/parser"
ecmaVersion: latest
sourceType: module
extraFileExtensions:
- .vue
project:
- ./tsconfig.json
- ./tsconfig.node.json
plugins:
- vue
rules:
# some rules that not normal disabled
semi: off
quotes: off
indent: off
no-tabs: off
camelcase: off
comma-dangle: off
no-case-declarations: off # 禁止在 case 子句中使用词法声明
no-useless-constructor: off # 禁用不必要的构造函数
# rules of standard
strictNullChecks: # 严格空值检查
- warn
- true
array-callback-return:
- error
- allowImplicit: true
# rules of vue
vue/max-attributes-per-line:
- off
# vue/max-len: # 限制代码长度不得超过这个长度
# - warn
# - code: 80
vue/html-indent:
- warn
- 2 # Vue 标签缩进
- baseIndent: 0 # 最外面的template缩进
vue/component-name-in-template-casing:
- warn # 组件应使用PascalCase命名
- "PascalCase"
vue/multi-word-component-names:
- off # 组件名应该是由多个单词组成
# rules of typescript
"@typescript-eslint/strict-boolean-expressions":
- off
"@typescript-eslint/indent":
- warn
- 2 # js/ts缩进
"@typescript-eslint/semi":
- warn
- always # 语句末尾必须加分号
"@typescript-eslint/quotes":
- warn
- double # 引号使用双引号
"@typescript-eslint/comma-dangle":
- warn
- always-multiline
"@typescript-eslint/prefer-unllish-coalescing": # 优先使用 ?? 而不是 || 进行空值判断
- warn
- ignoreConditionalTests: true
"@typescript-eslint/space-before-function-paren":
- warn
- always # 函数名和括号之间必须有空格
"@typescript-eslint/ban-types":
- warn
- types:
Object: # 禁止使用 Object
message: "Use {} instead"
fixWith: "{}"
Boolean: # 禁止使用 Boolean
message: "Use boolean instead"
Number: # 禁止使用 Number
message: "Use number instead"
String: # 禁止使用 String
message: "Use string instead"
Symbol: # 禁止使用 Symbol
message: "Use symbol instead"
"@typescript-eslint/no-floating-promises":
- warn
- ignoreVoid: true # 忽略 void 类型

View File

@@ -1,14 +0,0 @@
# JetBrains IDE Setting
.idea
# Visual Studio Code Setting
.vscode
# Node Modules
node_modules
package-lock.json
# Tauri build
dist
src-tauri/target
# Docs
README.md
LICENSE
docs

View File

@@ -1,8 +0,0 @@
"semi": true # 是否使用分号 true:使用
"singleQuote": false # 是否使用单引号
"printWidth": 100 # 一行最多多少个字符
"useTabs": true # 是否使用tab
"proseWrap": "preserve" # 是否换行
"arrowParens": "avoid" # 箭头函数参数是否使用括号
"bracketSpacing": true # 对象大括号是否有空格
"endOfLine": "auto" # 换行符

6
.stylelintrc.yml Normal file
View File

@@ -0,0 +1,6 @@
extends:
- stylelint-high-performance-animation
- stylelint-order
- stylelint-declaration-block-no-ignored-properties
- stylelint-config-standard-vue
# rules:

45
.vscode/settings.json vendored
View File

@@ -1,12 +1,8 @@
{
"workbench.iconTheme": "material-icon-theme",
"editor.inlineSuggest.enabled": true,
"editor.fontFamily": "Consolas, 'Courier New', monospaced",
"workbench.colorTheme": "Atom One Dark",
"editor.guides.bracketPairs": "active",
"github.copilot.enable": {
"*": true,
},
"editor.tabSize": 2,
"eslint.format.enable": true,
"eslint.quiet": false,
"eslint.lintTask.enable": true,
"eslint.validate": [
"typescript",
"html",
@@ -16,5 +12,36 @@
"yaml",
"plaintext"
],
"stylelint.configBasedir": "${workspaceFolder}",
"stylelint.enable": true,
"stylelint.validate": [
"css",
"less",
"postcss"
],
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[scss]": {
"editor.defaultFormatter": "stylelint.vscode-stylelint"
},
"editor.rulers": [
80,
120
],
"typescript.tsdk": "node_modules/typescript/lib"
}

4258
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,12 @@
"version": "0.1.2",
"author": "BTMuli <bt-muli@outlook.com>",
"scripts": {
"format": "prettier --write .",
"lint:all": "lint:code && lint:style",
"linx:all:fix": "lint:code:fix && lint:style:fix",
"lint:code": "eslint --ext .ts,.vue .",
"lint:code:fix": "lint:code --fix",
"lint:style": "stylelint './src/**/*.{vue}'",
"lint:style:fix": "lint:style --fix",
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
@@ -34,23 +39,35 @@
"dependencies": {
"@mdi/font": "7.2.96",
"@tauri-apps/api": "^1.2.0",
"clipboard": "^2.0.11",
"pinia": "^2.0.33",
"pinia-plugin-persistedstate": "^3.1.0",
"vue": "^3.2.47",
"vue-json-viewer": "^3.0.4",
"vue-router": "^4.1.6",
"vuetify": "npm:@vuetify/nightly@next"
},
"devDependencies": {
"@tauri-apps/cli": "^1.2.3",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"@vitejs/plugin-vue": "^4.1.0",
"clipboard": "^2.0.11",
"pinia": "^2.0.33",
"pinia-plugin-persistedstate": "^3.1.0",
"prettier": "^2.8.7",
"typescript": "^5.0.2",
"concurrently": "^8.0.1",
"eslint": "^8.37.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.10.0",
"stylelint": "^15.4.0",
"stylelint-config-standard-vue": "^1.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.7.0",
"stylelint-high-performance-animation": "^1.8.0",
"stylelint-order": "^6.0.3",
"typescript": "^5.0.3",
"vite": "^4.2.1",
"vite-plugin-vuetify": "^1.0.2",
"vue-json-viewer": "^3.0.4",
"vue-router": "^4.1.6",
"vue-tsc": "^1.2.0",
"vuetify": "^3.1.12"
"vue-devtools": "^5.1.4"
}
}

1
src/vite-env.d.ts vendored
View File

@@ -1,4 +1,3 @@
/// <reference types="vite/client" />
declare module "*.vue" {
import type { DefineComponent } from "vue";

View File

@@ -10,9 +10,24 @@
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true
"lib": [
"ESNext",
"DOM"
],
"skipLibCheck": true,
"types": [
"vite/client"
]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}