.eslintrc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // this file was auto-generated, do not edit it directly.
  2. // instead run bin/update_build_scripts from
  3. // https://github.com/sharelatex/sharelatex-dev-environment
  4. {
  5. "extends": [
  6. "eslint:recommended",
  7. "standard",
  8. "prettier"
  9. ],
  10. "parserOptions": {
  11. "ecmaVersion": 2020
  12. },
  13. "plugins": [
  14. "mocha",
  15. "chai-expect",
  16. "chai-friendly"
  17. ],
  18. "env": {
  19. "node": true,
  20. "mocha": true
  21. },
  22. "rules": {
  23. // Swap the no-unused-expressions rule with a more chai-friendly one
  24. "no-unused-expressions": 0,
  25. "chai-friendly/no-unused-expressions": "error",
  26. // Do not allow importing of implicit dependencies.
  27. "import/no-extraneous-dependencies": "error"
  28. },
  29. "overrides": [
  30. {
  31. // Test specific rules
  32. "files": ["test/**/*.js"],
  33. "globals": {
  34. "expect": true
  35. },
  36. "rules": {
  37. // mocha-specific rules
  38. "mocha/handle-done-callback": "error",
  39. "mocha/no-exclusive-tests": "error",
  40. "mocha/no-global-tests": "error",
  41. "mocha/no-identical-title": "error",
  42. "mocha/no-nested-tests": "error",
  43. "mocha/no-pending-tests": "error",
  44. "mocha/no-skipped-tests": "error",
  45. "mocha/no-mocha-arrows": "error",
  46. // chai-specific rules
  47. "chai-expect/missing-assertion": "error",
  48. "chai-expect/terminating-properties": "error",
  49. // prefer-arrow-callback applies to all callbacks, not just ones in mocha tests.
  50. // we don't enforce this at the top-level - just in tests to manage `this` scope
  51. // based on mocha's context mechanism
  52. "mocha/prefer-arrow-callback": "error"
  53. }
  54. },
  55. {
  56. // Backend specific rules
  57. "files": ["app/**/*.js", "app.js", "index.js"],
  58. "rules": {
  59. // don't allow console.log in backend code
  60. "no-console": "error",
  61. // Do not allow importing of implicit dependencies.
  62. "import/no-extraneous-dependencies": ["error", {
  63. // Do not allow importing of devDependencies.
  64. "devDependencies": false
  65. }]
  66. }
  67. }
  68. ]
  69. }