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

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

@ -6,6 +6,7 @@ module.exports = {
browser: true, browser: true,
}, },
extends: ['eslint:recommended', 'plugin:vue/vue3-recommended', 'plugin:prettier/recommended', '@vue/prettier'], extends: ['eslint:recommended', 'plugin:vue/vue3-recommended', 'plugin:prettier/recommended', '@vue/prettier'],
plugins: ['prettier', 'vue'],
parser: 'vue-eslint-parser', parser: 'vue-eslint-parser',
parserOptions: { parserOptions: {
ecmaVersion: 'latest', ecmaVersion: 'latest',
@ -23,7 +24,7 @@ module.exports = {
'no-console': 'off', 'no-console': 'off',
'vue/no-v-html': 'off', 'vue/no-v-html': 'off',
'vue/html-self-closing': [ 'vue/html-self-closing': [
'error', 'warn',
{ {
html: { html: {
void: 'any', void: 'any',
@ -91,31 +92,10 @@ module.exports = {
'EVENTS', 'EVENTS',
'CONTENT', 'CONTENT',
], ],
alphabetical: true, //字母顺序 alphabetical: true,
}, },
], ],
// 'prettier/prettier': [ 'prettier/prettier': 'error',
// '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,
// },
// ],
indent: [0, 4], indent: [0, 4],
eqeqeq: [2, 'always'], eqeqeq: [2, 'always'],
semi: [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 | _已解决_ | 2022.3.24 | .vscode/settings.json 配置 "editor.codeActionsOnSave": {"source.fixAll": true} |
| perttier 保存时不会自动格式化属性排序、需要执行命令才能格式化 | xwk | 2022.3.23 | 待解决 |

@ -32,7 +32,6 @@
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^13.2.1", "@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0", "@commitlint/config-conventional": "^13.2.0",
"@commitlint/prompt-cli": "^13.2.1",
"@nabla/vite-plugin-eslint": "^1.4.0", "@nabla/vite-plugin-eslint": "^1.4.0",
"@originjs/vite-plugin-global-style": "^1.0.2", "@originjs/vite-plugin-global-style": "^1.0.2",
"@types/node": "^17.0.21", "@types/node": "^17.0.21",

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

Loading…
Cancel
Save