美文网首页
格式化vue配置

格式化vue配置

作者: 肥羊猪 | 来源:发表于2021-04-23 21:30 被阅读0次

.prettierrc文件:

{
    "tabWidth": 4,
    "singleQuote": true,
    "trailingComma": "none",
    "printWidth": 1000,
    "proseWrap": "never",
    "bracketSpacing": true,
    "endOfLine": "lf",
    "overrides": [
        {
            "files": ".prettierrc",
            "options": {
                "parser": "json"
            }
        },
        {
            "files": "*.{css,sass,scss,less}",
            "options": {
                "parser": "less",
                "tabWidth": 4
            }
        }
    ]
}

vscode
setting.json文件:

{
    // vscode默认启用了根据文件类型自动设置tabsize的选项
    "editor.detectIndentation": false,
    // 重新设定tabsize
    "editor.tabSize": 4,
    //   字体大小
    "editor.fontSize": 18,
    // #每次保存的时候自动格式化
    "editor.formatOnSave": true,
    // 添加 vue 支持
    "eslint.validate": [
        "vue",
        "html",
        "javascript"
    ],
    //  #让函数(名)和后面的括号之间加个空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    // #这个按用户自身习惯选择
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    // #让vue中的js按编辑器自带的ts格式进行格式化
    "vetur.format.defaultFormatter.js": "vscode-typescript",
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned"
            // #vue组件中html代码格式化样式
        }
    },
    // 保存时自动格式化
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true,
        "source.fixAll.stylelint": true
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[jsonc]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    },
    // 主题
    "workbench.iconTheme": "material-icon-theme",
    // 格式化stylus, 需安装Manta's Stylus Supremacy插件
    "stylusSupremacy.insertColons": false, // 是否插入冒号
    "stylusSupremacy.insertSemicolons": false, // 是否插入分好
    "stylusSupremacy.insertBraces": false, // 是否插入大括号
    "stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行
    "stylusSupremacy.insertNewLineAroundBlocks": false, // 两个选择器中是否换行
    "diffEditor.ignoreTrimWhitespace": true,
    "editor.fontLigatures": null // 两个选择器中是否换行
}

相关文章

  • vscode配置

    一. vscode配置 1. 设置vue文件格式化 2. vetur配置 3. Document This插件配置...

  • Vue项目配置ESLint校验

    Vue项目配置ESLint校验,并使用prettier进行代码格式化。 配置 配置前安装一下依赖,之后在项目根目录...

  • Vscode配置eslint

    用到的插件 Eslint 需要全局安装 eslint Vetur 提供vue的语法支持,以及格式化 配置文件

  • 格式化vue配置

    .prettierrc文件: vscodesetting.json文件:

  • eslint 自动格式化

    vue 保存自动eslint 格式化 自动格式化 Vue 相关 备用一(推荐) 备用二

  • vscode 首选项的一些配置(主要关于VUE)

    Vue开发 主要利用vetur这个插件。下面介绍一些vetur的配置等 格式化 vutur校验 eslint 校验...

  • VSCode - Beautify插件配置 *.vue

    使用Beautify插件配置*.vue自动格式化按如下步骤设置 1.在工作目录下建立.jsbeautifyrc文件...

  • vue-eslint配置文件

    在vue的配置文件.eslintrc.js中配置以下选项 这样只需要右键格式化以下文件夹,大部分eslint规则...

  • 记录vscode 在vue项目中格式化问题

    解决格式化添加分号,单引号变双引号问题 1. 在 vue项目的根目录创建 .prettierrc.json 配置文...

  • Vue项目配置

    vue-cli配置、网络请求配置、移动端配置 # vue-cli配置:vue.config.js配置文件 配置文件...

网友评论

      本文标题:格式化vue配置

      本文链接:https://www.haomeiwen.com/subject/kbuhrltx.html