You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.5 KiB

3 years ago
  1. ## Configuring the ESLint Plugin
  2. ### If you haven't already, add ESLint to your project
  3. ```sh
  4. npm install --save-dev eslint
  5. ```
  6. ### Add the plugin
  7. ```sh
  8. npm install --save-dev eslint-plugin-you-dont-need-lodash-underscore
  9. ```
  10. ### Add the plugin to your .eslintrc.js file
  11. ```js
  12. "plugins": ["you-dont-need-lodash-underscore"],
  13. ```
  14. If you already have plugins installed, just add to the array.
  15. ```js
  16. "plugins": ["react", "you-dont-need-lodash-underscore"],
  17. ```
  18. ### Now configure your plugin.
  19. You can enable or disable individual rules.
  20. ```js
  21. "rules": {
  22. "you-dont-need-lodash-underscore/for-each": "error",
  23. "you-dont-need-lodash-underscore/concat": "warn",
  24. "you-dont-need-lodash-underscore/map": "off",
  25. ...
  26. }
  27. ```
  28. To save the trouble of configuring each rule individually, you can start by extending one of the
  29. default configurations, and then override individual rules as desired.
  30. ```js
  31. "extends" : ["plugin:you-dont-need-lodash-underscore/compatible"],
  32. ```
  33. The following options are available:
  34. - you-dont-need-lodash-underscore:all-warn (all rules set to warn)
  35. - you-dont-need-lodash-underscore:all (all rules set to error)
  36. - you-dont-need-lodash-underscore:compatible-warn (rules in which the native implementation is perfectly compatible with the _ one are set to warn, the rest are disabled)
  37. - you-dont-need-lodash-underscore:compatible (rules in which the native implementation is perfectly compatible with _ one are set to error, the rest are set to warn)
  38. For more information, see the [ESLint documentation](http://eslint.org/docs/user-guide/configuring).