1. Description eslint helps us check whether the code is standardized. This article uses Prettier rules (as well as 2. Download related dependency packages 3. Configuration file .eslintrc.js (there are other ways to configure rules)Create a new file .eslintrc.js in the project root directory with the following content (you can configure it according to your needs): module.exports = { root: true, // Only apply this rule to the current project parserOptions: { "parser": "babel-eslint", "sourceType": 'module', // set to "module", "script" (default) // "ecmaVersion": 6 // Enable es6 syntax, do not automatically enable es6 global variables}, parser: "vue-eslint-parser", // To identify .vue files, you need to download eslint-plugin-vue // The environment you want to enable env: { "browser": true, "node": true, "es6": true }, //Inherit plugin rules extends: [ "eslint:recommended", // Start the default rule marked as "√" "plugin:prettier/recommended" // Rules written by others, dependent on package eslint-config-***, here is the prettier rule], // Configure the list of plugin names. Plugin names may omit the 'eslint-plugin- ' prefix. plugins: [ 'vue', // eslint-plugin-vue 'prettier' // eslint-plugin-prettier ], // Custom rules have the highest priority "rules": { "no-console": 0 } } 4. Automatically format code when saving in vscode (version 1.44.0) configurationDownload the eslint plugin for vscode, open the settings.json file, and add:
The configuration of other versions may be slightly different. For example, the configuration shown in the figure will take effect on version 1.36.1. 5. Add scripts command in package.json: eslint detects and automatically fixes eslintignore is the file ignored during configuration detection 6. Close eslint verification for the project Here we take vue-cli3 and above as an example. Just add the following configuration in 7. eslint Chinese documentationhttps://eslint.bootcss.com/docs/user-guide/getting-started SummarizeThis article ends here. I hope it can be helpful to you. I also hope that you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: In html, set the scroll bar to automatically display when the content in the div exceeds
>>: Thoughts on copy_{to, from}_user() in the Linux kernel
Preface: In MySQL, the master-slave architecture ...
The mobile version of the website should at least...
1. Use the transform attribute to display the ima...
This article uses examples to describe the basic ...
CEP - Complex Event Processing. The payment has n...
CSS3 syntax: (1rem = 100px for a 750px design) @m...
This article shares the specific code for React t...
Students who make websites often find that some n...
The default port number of the Windows server rem...
Ⅰ. Problem description: Use html+css to implement...
Maybe I started to think wrongly, and my descript...
Prerequisite: Mac, zsh installed, mysql downloade...
Table of contents Preface Demand Analysis Mysql u...
DOCTYPE Doctype is used to tell the browser which...
Table of contents How to operate Operation proces...