fix: 解决eslint格式报错保存时不会自动解决的问题

environments/test/deployments/1
saatana 4 years ago
parent d881723ed5
commit 539e9fd5fc

@ -6,6 +6,7 @@ module.exports = {
browser: true,
},
extends: ['eslint:recommended', 'plugin:vue/vue3-recommended', 'plugin:prettier/recommended', '@vue/prettier'],
plugins: ['prettier', 'vue'],
parser: 'vue-eslint-parser',
parserOptions: {
ecmaVersion: 'latest',
@ -23,7 +24,7 @@ module.exports = {
'no-console': 'off',
'vue/no-v-html': 'off',
'vue/html-self-closing': [
'error',
'warn',
{
html: {
void: 'any',
@ -91,31 +92,10 @@ module.exports = {
'EVENTS',
'CONTENT',
],
alphabetical: true, //字母顺序
alphabetical: true,
},
],
// 'prettier/prettier': [
// 'error',
// {
// printWidth: 120,
// tabWidth: 4,
// useTabs: false,
// semi: true,
// singleQuote: true,
// quoteProps: 'as-needed',
// jsxSingleQuote: false,
// trailingComma: 'es5',
// bracketSpacing: true,
// bracketSameLine: false,
// arrowParens: 'always',
// htmlWhitespaceSensitivity: 'ignore',
// vueIndentScriptAndStyle: true,
// endOfLine: 'auto',
// },
// {
// usePrettierrc: true,
// },
// ],
'prettier/prettier': 'error',
indent: [0, 4],
eqeqeq: [2, 'always'],
semi: [2, 'always'],

@ -1,3 +1,36 @@
{
"nuxt.isNuxtApp": false
"nuxt.isNuxtApp": false,
"js/ts.implicitProjectConfig.checkJs": true,
"js/ts.implicitProjectConfig.strictNullChecks": true,
"git.autofetch": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vetur.format.defaultFormatter.html": "prettier",
"eslint.enable": true,
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.run": "onType",
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "html", "vue"]
}

@ -1,4 +1,3 @@
| 问题描述 | 作者 | 记录时间 | 状态 | 解决时间 |
| ------------------------------------------------------------- | ---- | --------- | -------- | --------- |
| 自定义 SVG 图标颜色显示异常,初始颜色不对,鼠标移入颜色闪烁 | xwk | 2022.3.22 | _已解决_ | 2022.3.23 |
| perttier 保存时不会自动格式化属性排序、需要执行命令才能格式化 | xwk | 2022.3.23 | 待解决 |
| 问题描述 | 作者 | 记录时间 | 状态 | 解决时间 | 解决方法 |
| ------------------------------------------------------------- | ---- | --------- | -------- | --------- | ------------------------------------------------------------------------------ |
| perttier 保存时不会自动格式化属性排序、需要执行命令才能格式化 | xwk | 2022.3.23 | _已解决_ | 2022.3.24 | .vscode/settings.json 配置 "editor.codeActionsOnSave": {"source.fixAll": true} |

@ -1,65 +1,64 @@
{
"name": "msb-shop-admin",
"author": {
"name": "向文可",
"email": "1041367524@qq.com"
},
"private": true,
"version": "0.0.1",
"scripts": {
"dev": "vite",
"build:test": "vite build --mode test",
"build:preview": "vite build --mode preview",
"build:prod": "vite build --mode prod",
"preview": "vite preview",
"prepare": "husky install",
"lint": "eslint src/**/*.{vue,js,jsx} --fix"
},
"dependencies": {
"@element-plus/icons": "^0.0.11",
"@vueup/vue-quill": "^1.0.0-beta.8",
"axios": "^0.26.1",
"dayjs": "^1.11.0",
"element-plus": "^2.1.2",
"lodash": "^4.17.21",
"qs": "^6.10.3",
"quill-image-uploader": "^1.2.2",
"sortablejs": "^1.14.0",
"vue": "^3.2.25",
"vue-router": "^4.0.14",
"vuex": "^4.0.2"
},
"devDependencies": {
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@commitlint/prompt-cli": "^13.2.1",
"@nabla/vite-plugin-eslint": "^1.4.0",
"@originjs/vite-plugin-global-style": "^1.0.2",
"@types/node": "^17.0.21",
"@vitejs/plugin-legacy": "^1.7.1",
"@vitejs/plugin-vue": "^2.2.0",
"@vitejs/plugin-vue-jsx": "^1.3.8",
"airbnb": "^0.0.2",
"consola": "^2.15.3",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.5.0",
"husky": "^7.0.4",
"less": "^4.1.2",
"lint-staged": "^12.3.7",
"prettier": "^2.6.0",
"unplugin-auto-import": "^0.6.4",
"unplugin-vue-components": "^0.18.0",
"vite": "^2.8.0",
"vite-plugin-remove-console": "^0.0.6",
"vite-plugin-style-import": "^2.0.0",
"vite-plugin-svg-icons": "^2.0.1"
},
"lint-staged": {
"src/**/*.{jsx,tsx,ts,js,vue}": [
"prettier --write",
"eslint --fix"
]
}
"name": "msb-shop-admin",
"author": {
"name": "向文可",
"email": "1041367524@qq.com"
},
"private": true,
"version": "0.0.1",
"scripts": {
"dev": "vite",
"build:test": "vite build --mode test",
"build:preview": "vite build --mode preview",
"build:prod": "vite build --mode prod",
"preview": "vite preview",
"prepare": "husky install",
"lint": "eslint src/**/*.{vue,js,jsx} --fix"
},
"dependencies": {
"@element-plus/icons": "^0.0.11",
"@vueup/vue-quill": "^1.0.0-beta.8",
"axios": "^0.26.1",
"dayjs": "^1.11.0",
"element-plus": "^2.1.2",
"lodash": "^4.17.21",
"qs": "^6.10.3",
"quill-image-uploader": "^1.2.2",
"sortablejs": "^1.14.0",
"vue": "^3.2.25",
"vue-router": "^4.0.14",
"vuex": "^4.0.2"
},
"devDependencies": {
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@nabla/vite-plugin-eslint": "^1.4.0",
"@originjs/vite-plugin-global-style": "^1.0.2",
"@types/node": "^17.0.21",
"@vitejs/plugin-legacy": "^1.7.1",
"@vitejs/plugin-vue": "^2.2.0",
"@vitejs/plugin-vue-jsx": "^1.3.8",
"airbnb": "^0.0.2",
"consola": "^2.15.3",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.5.0",
"husky": "^7.0.4",
"less": "^4.1.2",
"lint-staged": "^12.3.7",
"prettier": "^2.6.0",
"unplugin-auto-import": "^0.6.4",
"unplugin-vue-components": "^0.18.0",
"vite": "^2.8.0",
"vite-plugin-remove-console": "^0.0.6",
"vite-plugin-style-import": "^2.0.0",
"vite-plugin-svg-icons": "^2.0.1"
},
"lint-staged": {
"src/**/*.{jsx,tsx,ts,js,vue}": [
"prettier --write",
"eslint --fix"
]
}
}

@ -12,9 +12,9 @@ import removeConsole from 'vite-plugin-remove-console';
import legacy from '@vitejs/plugin-legacy';
import eslintPlugin from '@nabla/vite-plugin-eslint';
export default ({ command, mode }) => {
console.info('command', command);
console.info('mode', mode);
export default (configEnv) => {
console.info('command', configEnv.command);
console.info('mode', configEnv.mode);
return {
server: {
host: '0.0.0.0',

Loading…
Cancel
Save