初始化

  1. npx eslint --init
  2. How would you like to use ESLint? · problems
  3. What type of modules does your project use? · esm
  4. Which framework does your project use? · vue
  5. Does your project use TypeScript? · No / Yes
  6. Where does your code run? · browser, node
  7. What format do you want your config file to be in? · JavaScript

生成的文件配置文件:

  1. module.exports = {
  2. "env": {
  3. "browser": true,
  4. "es2021": true,
  5. "node": true
  6. },
  7. "extends": [
  8. "eslint:recommended",
  9. "plugin:vue/vue3-essential"
  10. ],
  11. "parserOptions": {
  12. "ecmaVersion": "latest",
  13. "sourceType": "module"
  14. },
  15. "plugins": [
  16. "vue"
  17. ],
  18. "rules": {
  19. }
  20. }

参考文章