openks / learn-vue

自定义组件文档
https://openks.github.io/learn-vue
0 stars 0 forks source link

20180704_vscode配置 #114

Open openks opened 6 years ago

openks commented 6 years ago
{
    "gitlens.advanced.messages": {
        "suppressShowKeyBindingsNotice": true,
        "suppressWelcomeNotice": true
    },
    "atomKeymap.promptV3Features": true,
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    "typescript.format.insertSpaceBeforeFunctionParenthesis": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    "gitlens.keymap": "alternate",
    "vetur.format.defaultFormatter.js": "vscode-typescript",//默认格式化规则 
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned" // html属性换行
        }
    },
    "prettier.singleQuote": true, //单引号
    "prettier.trailingComma": "all", //尾逗号
    "prettier.tabWidth": 4,
    "prettier.semi": true,
    "prettier.eslintIntegration": true,
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        "vue"
    ],
    "eslint.options": {
        "plugins": [
            "html"
        ]
    },
    "editor.formatOnSave": true,//保存自动格式化
    "eslint.autoFixOnSave": true, //保存时自动修复
    "editor.renderIndentGuides": false, //隐藏折叠线
    "window.zoomLevel": 2,
    "workbench.statusBar.feedback.visible": false,
}
openks commented 6 years ago

Missing space before function parentheses. (space-before-function-paren)'

报错信息如下:

file: 'file:///d%3A/code/src/components/demos/test.vue'
severity: '错误'
message: 'Missing space before function parentheses. (space-before-function-paren)'
at: '10,9'
source: 'eslint'
code: 'space-before-function-paren'

解决方案 不使用 prettier的格式化规则 添加如下配置 "vetur.format.defaultFormatter.js": "vscode-typescript",//默认格式化规则

openks commented 6 years ago

eslint 能够发现错误,但是调用eslint fix all命令无任何效果,但是修改配置文件 修改为保存自动修复竟然可以自动修复

    "eslint.validate": [
        "javascript",
        "javascriptreact",
        {
            "language": "html",
            "autoFix": true
        },
        {
            "language": "vue",
            "autoFix": true
        }
    ],
openks commented 6 years ago

emmet在vscode中tab建不起作用解决方案

"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {
    "vue-html": "html",
    "vue": "html"
}