Eslint configuration file in Vue-cli eslintrc.js detailed

Source: Internet
Author: User

Eslint Introduction

eslint是用来管理和检测js代码风格的工具,可以和编辑器搭配使用,如vscode的eslint插件 当有不符合配置文件内容的代码出现就会报错或者警告

// http://eslint.org/docs/user-guide/configuringModule.exports= {    //This entry is used to tell Eslint that the current profile cannot be looked up to the parentRoottrue,     //This entry is used to specify the Eslint parser, and the parser must conform to the rules, and the Babel-eslint parser is the wrapper on the Babel parser to parse it with EslintParser'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 modeparseroptions: {sourcetype:'Module'    },    //This entry specifies the global variables for the environment, and the following configuration specifies the browser environmentenv: {browser:true,    },    // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style//This 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 mistakesExtends' Standard',    //required to lint *.vue files//This entry is used to provide plug-ins, the plug-in name is omitted eslint-plugin-, the following configuration is used to standardize the HTMLplugins: ['HTML'    ],    //Add your custom rules here//The 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-//The following settings are the main rules, you can set the string can also set the number, the effect is consistent//"Off" 0 close rule//"warn" 1 open warning rules//"Error" 2 open error Rule//Understanding the above, the following code is believed to see clearly    '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    }}

Eslint configuration file in Vue-cli eslintrc.js detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.