设置ESLint
作者:互联网
设置ESLint
-
安装组件
npm i eslint prettier eslint-config-prettier eslint-plugin-prettier eslint-config-airbnb eslint-plugin-node eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react --save-dev
-
设置规则
控制off,warn,error
具体参数设置可以参考官方文档,报错的时候vscode有直接跳转的{ "extends": ["airbnb", "prettier", "plugin:node/recommended"], "plugins": ["prettier"], "rules": { "prettier/prettier": ["error", {}], "spaced-comment": "off", "no-console": ["warn", { "allow": ["log"], "no-semi": true }], "consistent-return": "off", "func-names": "off", "object-shorthand": "off", "no-process-exit": "off", "no-param-reassign": "off", "no-return-await": "off", "no-underscore-dangle": "off", "class-methods-use-this": "off", "prefer-destructuring": ["error", { "object": true, "array": false }], "no-unused-vars": ["error", { "argsIgnorePattern": "req|res|next|val|err" }] } }
标签:off,no,eslint,plugin,prettier,设置,error,ESLint 来源: https://www.cnblogs.com/kihyunBlog/p/16399012.html