当前位置:网站首页>. eslintrc. JS configuration

. eslintrc. JS configuration

2022-06-26 07:56:00 Forge ahead and have a bright future

/**
*  Configuration files can have a hierarchical structure   Inheritable 
*  To code, you need to first convert the source code into an abstract syntax tree ( There will be a space in the following AST  and  babel)
*/

module.exports = {
   root:true,// Root profile 
   extends:'airbnb', //  Enable extends  Inherit , Inherited from  airbnb, You need to put it up  root Comment out 
   parser:'babel-eslint',
   parserOptions:{
       sourceType:'module',
       ecmaVersion:2015
   },
   env:{
       browser:true, // window.a
       node:true
   },
   // Enabled code checking rules and respective error levels 
   // Check the code first , If it is found to be incorrect , Will try to fix , If the repair is successful , Carry on 
   rules:{
       "indent":["erroe",2],// Indent style , Close as false
       "quotes":"off",// Type of quotation marks 
       "no-console":"off" // No use console.log
   }
}

aribnb It's a collection of rules , In the end are all eslint use

1、 We can still do that VScode install eslint Use with plug-ins , Configure automatic repair

vscode Can be generated automatically settings.js file

Configure automatic repair

 

2、 On the newline character problem solving

  open webpack Of eslint To configure , Turn off line breaks

 3、webpack read eslint package ,eslint Package read configuration file

原网站

版权声明
本文为[Forge ahead and have a bright future]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202170607492818.html