Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

42 linhas
1.9 KiB

há 4 anos
  1. 'use strict';
  2. module.exports = {
  3. env: {
  4. mocha: true,
  5. },
  6. extends: [
  7. './index.js',
  8. 'plugin:mocha/recommended',
  9. ],
  10. plugins: [
  11. 'mocha',
  12. ],
  13. rules: {
  14. 'mocha/no-hooks-for-single-case': 'off',
  15. 'mocha/no-return-from-async': 'error',
  16. // Disabled due to false positives:
  17. // - https://github.com/lo1tuma/eslint-plugin-mocha/issues/274
  18. // - Using a loop to define tests can trigger it unless the logic is trivial.
  19. 'mocha/no-setup-in-describe': 'off',
  20. 'mocha/no-synchronous-tests': 'error',
  21. 'mocha/prefer-arrow-callback': 'error',
  22. // The node/no-unpublished-require rule considers devDependencies to be unpublished. Downgrade
  23. // the severity to warn for test code so that test code can require something from
  24. // devDependencies without causing the lint check to fail. Alternatives:
  25. // - Set it to 'off' for test code. This would silence warnings about "acceptable" uses of
  26. // devDependencies, but it would also hide true bugs.
  27. // - Add test code to .npmignore. This would cause the test code to also be considered
  28. // unpublished, so the rule wouldn't complain about depending on someting that is
  29. // unpublished. Unfortunately, .npmignore is tricky to get right, it can be dangerous (for
  30. // example, it's easy to accidentally publish credentials saved in dot files), and it
  31. // imposes a burden on all users of this config.
  32. // - Parse package.json and add all of the devDependencies to this rule's allowModules
  33. // setting. Example of this approach:
  34. // https://github.com/mysticatea/eslint-plugin-node/issues/47#issuecomment-629777952
  35. // Unfortunately it is not feasible to find the user's package.json so this approach is not
  36. // usable here.
  37. 'node/no-unpublished-require': 'warn',
  38. 'prefer-arrow-callback': 'off',
  39. 'prefer-arrow/prefer-arrow-functions': 'off',
  40. },
  41. };