让vscode按照eslint进行格式化
1.安装eslint依赖
在package.json中用npm安装eslint的依赖
"eslint": "^4.19.1", "eslint-friendly-formatter": "^4.0.1", "eslint-loader": "^2.0.0", "eslint-plugin-html": "^4.0.3",
2.生成eslint配置文件
在项目根目录下建立 .eslintrc.js
文件,复制下面的内容到里面
module.exports = { "env": { "browser": true, "commonjs": true, "es6": true }, "extends": "eslint:recommended", // 在js里面有些时候用到一些全局变量,防止eslint无脑报错 "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly", "process": false }, "parserOptions": { "ecmaVersion": 2018 }, "rules": { "linebreak-style": [ "error", "unix" ], "accessor-pairs": 2, "arrow-spacing": [2, { "before": true, "after": true }], "array-bracket-spacing": [2, "never"], "block-spacing": [2, "always"], "brace-style": [2, "1tbs", { "allowSingleLine": true }], "camelcase": [2, { "properties": "never" }], "comma-dangle": [2, "never"], "comma-spacing": [2, { "before": false, "after": true }], "comma-style": [2, "last"], "constructor-super": 2, "curly": [2, "multi-line"], "dot-location": [2, "property"], "eol-last": 2, "eqeqeq": [2, "allow-null"], "generator-star-spacing": [2, { "before": true, "after": true }], "handle-callback-err": [2, "^(err|error)$"], "indent": [2, 2, { "SwitchCase": 1 }], "jsx-quotes": [2, "prefer-single"], "key-spacing": [2, { "beforeColon": false, "afterColon":
相关推荐
hualala 2020-06-13
tozeroblog 2020-06-09
tozeroblog 2020-06-08
hualala 2020-06-05
hualala 2020-05-29
www你所不知道的 2020-03-06
out有点man 2020-05-07
学知不足业精于勤 2020-04-30
hualala 2020-04-30
out有点man 2020-04-23
coderMozart 2020-04-20
coderMozart 2020-04-17
空谷足音 2020-03-06
tozeroblog 2020-03-06
tozeroblog 2020-02-21
tozeroblog 2020-02-17
hualala 2020-01-23