zoukankan      html  css  js  c++  java
  • vscode格式化配置-settings.jon

    准备扩展:js-beautify-html,prettier,vetur

    {  
        "workbench.colorTheme": "Tiny Light",
        "workbench.iconTheme": "vscode-icons",
    
        "editor.detectIndentation": false,// vscode默认启用了根据文件类型自动设置tabsize的选项
        "editor.tabSize": 4,            // 重新设定tabsize
        
        // ESLint 配置代码检查
        "eslint.format.enable": false,
        "eslint.alwaysShowStatus": false,
        "eslint.quiet": false, // 忽略检查
        "eslint.validate": [
            "javascript",
            "javascriptreact",
            "typescript",
            "typescriptreact",
            "vue-html",
            "html",
            "vue"
        ],
        "eslint.run": "onType",
        "eslint.options": {
            "extensions": [
                ".js",
                ".vue",
            ],
        },
    
        "javascript.format.placeOpenBraceOnNewLineForControlBlocks": false, // 函数左括号{是否换行
        "javascript.format.insertSpaceBeforeFunctionParenthesis": false, // 不让函数(名)和后面的括号之间加个空格
            
        // prettier 格式化配置
        "prettier.arrowParens": "avoid", //(x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
        "prettier.bracketSpacing": true, // 在对象,数组括号与文字之间加空格 "{ foo: bar }"
        "prettier.endOfLine": "auto", // 行尾换行格式
        "prettier.jsxBracketSameLine": false, // 在jsx中把'>' 是否单独放一行
        "prettier.jsxSingleQuote": true,  // 在jsx中使用单引号代替双引号
        "prettier.printWidth": 100,  // 超过最大值换行
        "prettier.singleQuote": true, //使用单引号而不是双引号
        "prettier.semi": true,  //在语句结尾处加分号
        "prettier.tabWidth": 4, // 缩进字节数
        "prettier.trailingComma": "none", //禁止随时添加逗号
        "prettier.useTabs": false, // 缩进不使用tab,使用空格
    
        //.vue文件template格式化支持,并使用js-beautify-html插件
        "vetur.format.defaultFormatter.html": "js-beautify-html",
        "vetur.format.defaultFormatter.js": "prettier",
        "vetur.format.defaultFormatter.less": "prettier",
        "vetur.format.defaultFormatter.css": "prettier",
        "vetur.format.options.tabSize": 4,   //缩进为4
        "vetur.format.options.useTabs": false,
        "vetur.format.defaultFormatterOptions": {
            //js-beautify-html格式化配置
            "js-beautify-html": {
                "wrap_attributes": "force-aligned" // 属性强制换行
            },
            "prettier": {
                "arrowParens": "avoid",    //(x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
                "bracketSpacing": true,  // 在对象,数组括号与文字之间加空格 "{ foo: bar }"
                "endOfLine": "auto",   // 行尾换行格式
                "eslintIntegration": false, //不让prettier使用eslint的代码格式进行校验   
                "jsxBracketSameLine": false, // 在jsx中把'>' 是否单独放一行
                "jsxSingleQuote": false, // 在jsx中使用单引号代替双引号
                "printWidth": 100,    // 超过最大值换行
                "singleQuote": true, //使用单引号而不是双引号
                "semi": true, //在语句结尾处加分号
                "tabWidth": 4,  //缩进字节数
                "trailingComma": "none", //禁止随时添加逗号
                "tslintIntegration": false,  // 不让prettier使用tslint的代码格式进行校验
                "useTabs": false // 缩进不使用tab,使用空格
            }
        },
        // 每一种语言的默认格式化规则
        "[html]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[javascript]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[less]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[css]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "prettier.useEditorConfig": false 
    }
    
  • 相关阅读:
    JS变量的作用域
    使用jquery修改css中带有!important的样式属性
    js异步加载的三种解决方案
    js 停止事件冒泡 阻止浏览器的默认行为(阻止超连接 # )
    【翻译】MongoDB指南/CRUD操作(二)
    【翻译】MongoDB指南/CRUD操作(一)
    【翻译】MongoDB指南/引言
    深入浅出UML类图(一)
    让thinkphp 5 支持pathinfo 的 nginx ,去掉index.php
    linux 常用命令
  • 原文地址:https://www.cnblogs.com/wmt-kilig/p/14928408.html
Copyright © 2011-2022 走看看