This article explains the VUE-CLI scaffolding root directory file. eslintrc.js
Eslint Introduction
eslint是用来管理和检测js代码风格的工具,可以和编辑器搭配使用,如vscode的eslint插件当有不符合配置文件内容的代码出现就会报错或者警告
Installing Eslint
install eslint --save-devnode_modules\.bin\eslint --init 初始化配置文件,此配置文件配置好之后,vscode编辑器自动识别
Explanation of the VUE-CLI. Eslintrc.js configuration file
Http://eslint.org/docs/user-guide/configuringModule.exports = {This entry is used to tell Eslint that the current profile cannot find root for the parent:TrueThis entry is used to specify the Eslint parser, and the parser must conform to the rules, and the Babel-eslint parser is the wrapper for the Babel parser to parse parser with Eslint:' Babel-eslint ',This entry is used to specify the JavaScript language type and style, sourcetype is used to specify the way JS import, the default is script, here is set to module, refers to a block import method parseroptions: {sourcetype:' Module '},This entry specifies the environment's global variables, and the following configuration specifies the browser environment env: {browser:True,},Https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-styleThis is used to configure the standard JS style, that is, when writing code to write the specification, if you use Vs-code I think should be able to avoid error extends:' Standard ',Required to lint *.vue filesThis entry is used to provide plug-ins, the plug-in name is omitted eslint-plugin-, the following configuration is used to standardize the HTML plugins: [' HTML '],Add your custom rules hereThe following rules are used to set the rule for the canonical code from the plug-in, which must be removed using the prefix eslint-plugin-//mainly has the following setting rules, you can set the string can also set the number, the effect is consistent //"off" and 0 close rule //"Warn", 1 open warning rule //"Error"-2 open Error rule //understand the above, the following code believe also see ' rules ': {//allow Paren-less arrow Functions ' Arrow-parens ': 0, //allow async-await ' generator-star-spacing ': 0 , //allow debugger during development ' No-debugger ': Process.env.NODE_ENV = = = ' production '? 2: 0}}
Article excerpt from https://www.cnblogs.com/ye-hcj/p/7069505.html
Eslint configuration file in Vue-cli eslintrc.js detailed