xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

ESLint All In One

ESLint

$ yarn add -D eslint

.eslintrc.{js,yml,json}

优先级

.eslintrc
.eslintrc.js
.eslintrc.yml
.eslintrc.json

{
  // "extends": "airbnb",
  "extends": "eslint:recommended",
  "rules": {
    "semi": ["error", "always"],
    "quotes": ["error", "double"],
    "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
    "no-console": 0,
    "linebreak-style": ["error", "unix"],
    "no-use-before-define": ["off"],
    "comma-dangle": ["error", "never"],
    "global-require": ["off"],
    "import/no-dynamic-require": ["off"]
  },
  "env": {
    "browser": false,
    "es6": true,
    "node": true
  }
}


level

"off" 或 0 - 关闭规则

"warn" 或 1 - 警告

"error" 或 2 - 错误

eslint ignore

.eslintignore

https://www.cnblogs.com/xgqfrms/p/11843237.html

refs

https://eslint.org/docs/user-guide/getting-started

https://cn.eslint.org/docs/user-guide/getting-started

https://www.youtube.com/watch?v=hppJw2REb8g&feature=youtu.be



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


原文地址:https://www.cnblogs.com/xgqfrms/p/13590827.html