Eslint configuration file in Vue-cli eslintrc.js detailed

Source: Internet
Author: User

This article explains the VUE-CLI scaffolding root directory file. eslintrc.js
    1. Eslint Introduction

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

      install eslint --save-devnode_modules\.bin\eslint --init 初始化配置文件,此配置文件配置好之后,vscode编辑器自动识别
    3. 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

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.