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
When using MYSQL, triggers are often used, but so...
1. Prerequisites Since I have installed it severa...
transform and translate Transform refers to trans...
Table of contents definition grammar Examples 1. ...
one. Mysql Binlog format introduction Mysql binlo...
This article shares the specific code of the jQue...
During the development process, I often encounter...
Table of contents 1. Object change detection 2. Q...
Table of contents Preface 1. What is a closure? 1...
1. Basic implementation of limit In general, the ...
When using MySQL to run certain statements, a dea...
Core code <!DOCTYPE html> <html lang=&qu...
This article uses examples to explain the Nginx c...
In the previous article, I introduced the detaile...
Let's first look at some simple data: Accordin...