.eslintrc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {
  2. "extends": [
  3. "standard",
  4. "prettier",
  5. "prettier/standard"
  6. ],
  7. "parserOptions": {
  8. "ecmaVersion": 2018
  9. },
  10. "plugins": [
  11. "mocha",
  12. "chai-expect",
  13. "chai-friendly"
  14. ],
  15. "env": {
  16. "node": true
  17. },
  18. "rules": {
  19. // Swap the no-unused-expressions rule with a more chai-friendly one
  20. "no-unused-expressions": 0,
  21. "chai-friendly/no-unused-expressions": "error"
  22. },
  23. "overrides": [
  24. {
  25. // Test specific rules
  26. "files": ["test/**/*.js"],
  27. "env": {
  28. "mocha": true
  29. },
  30. "globals": {
  31. "expect": true
  32. },
  33. "rules": {
  34. // mocha-specific rules
  35. "mocha/handle-done-callback": "error",
  36. "mocha/no-exclusive-tests": "error",
  37. "mocha/no-global-tests": "error",
  38. "mocha/no-identical-title": "error",
  39. "mocha/no-nested-tests": "error",
  40. "mocha/no-pending-tests": "error",
  41. "mocha/no-skipped-tests": "error",
  42. "mocha/no-mocha-arrows": "error",
  43. // chai-specific rules
  44. "chai-expect/missing-assertion": "error",
  45. "chai-expect/terminating-properties": "error",
  46. // prefer-arrow-callback applies to all callbacks, not just ones in mocha tests.
  47. // we don't enforce this at the top-level - just in tests to manage `this` scope
  48. // based on mocha's context mechanism
  49. "mocha/prefer-arrow-callback": "error"
  50. }
  51. }
  52. ]
  53. }