Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

69 рядки
2.2 KiB

3 роки тому
  1. [![NPM Version](https://img.shields.io/npm/v/eslint-plugin-mocha.svg?style=flat)](https://www.npmjs.org/package/eslint-plugin-mocha)
  2. [![GitHub Actions status](https://github.com/lo1tuma/eslint-plugin-mocha/workflows/CI/badge.svg)](https://github.com/lo1tuma/eslint-plugin-mocha/actions)
  3. [![Coverage Status](https://img.shields.io/coveralls/lo1tuma/eslint-plugin-mocha/master.svg?style=flat)](https://coveralls.io/r/lo1tuma/eslint-plugin-mocha)
  4. [![Peer Dependencies](http://img.shields.io/david/peer/lo1tuma/eslint-plugin-mocha.svg?style=flat)](https://david-dm.org/lo1tuma/eslint-plugin-mocha#info=peerDependencies&view=table)
  5. [![NPM Downloads](https://img.shields.io/npm/dm/eslint-plugin-mocha.svg?style=flat)](https://www.npmjs.org/package/eslint-plugin-mocha)
  6. # eslint-plugin-mocha
  7. ESLint rules for [mocha](http://mochajs.org/).
  8. ## Install and configure
  9. This plugin requires ESLint `4.0.0` or later.
  10. ```bash
  11. npm install --save-dev eslint-plugin-mocha
  12. ```
  13. Then add a reference to this plugin and selected rules in your eslint config:
  14. ```json
  15. {
  16. "plugins": [
  17. "mocha"
  18. ]
  19. }
  20. ```
  21. ### Plugin Settings
  22. This plugin supports the following settings, which are used by multiple rules:
  23. * `additionalCustomNames`: This allows rules to check additional function names when looking for suites or test cases. This might be used with a custom Mocha extension, such as [`ember-mocha`](https://github.com/switchfly/ember-mocha)
  24. **Example:**
  25. ```json
  26. {
  27. "rules": {
  28. "mocha/no-skipped-tests": "error",
  29. "mocha/no-exclusive-tests": "error"
  30. },
  31. "settings": {
  32. "mocha/additionalCustomNames": [
  33. { "name": "describeModule", "type": "suite", "interfaces": [ "BDD" ] },
  34. { "name": "testModule", "type": "testCase", "interfaces": [ "TDD" ] }
  35. ]
  36. }
  37. }
  38. ```
  39. ### Recommended config
  40. This plugin exports a recommended config that enforces good practices.
  41. Enable it with the extends option:
  42. ```json
  43. {
  44. "extends": [
  45. "plugin:mocha/recommended"
  46. ]
  47. }
  48. ```
  49. See [Configuring Eslint](http://eslint.org/docs/user-guide/configuring) on [eslint.org](http://eslint.org) for more info.
  50. ## Rules documentation
  51. The documentation of the rules [can be found here](docs/rules).