.eslintrc 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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": 2018
  12. },
  13. "plugins": [
  14. "mocha",
  15. "chai-expect",
  16. "chai-friendly"
  17. ],
  18. "env": {
  19. "node": true,
  20. "mocha": true
  21. },
  22. "rules": {
  23. // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
  24. // START of temporary overrides
  25. "array-callback-return": "off",
  26. "no-dupe-else-if": "off",
  27. "no-var": "off",
  28. "no-empty": "off",
  29. "node/handle-callback-err": "off",
  30. "no-loss-of-precision": "off",
  31. "node/no-callback-literal": "off",
  32. "node/no-path-concat": "off",
  33. "prefer-regex-literals": "off",
  34. // END of temporary overrides
  35. // Swap the no-unused-expressions rule with a more chai-friendly one
  36. "no-unused-expressions": 0,
  37. "chai-friendly/no-unused-expressions": "error",
  38. // Do not allow importing of implicit dependencies.
  39. "import/no-extraneous-dependencies": "error"
  40. },
  41. "overrides": [
  42. {
  43. // Test specific rules
  44. "files": ["test/**/*.js"],
  45. "globals": {
  46. "expect": true
  47. },
  48. "rules": {
  49. // mocha-specific rules
  50. "mocha/handle-done-callback": "error",
  51. "mocha/no-exclusive-tests": "error",
  52. "mocha/no-global-tests": "error",
  53. "mocha/no-identical-title": "error",
  54. "mocha/no-nested-tests": "error",
  55. "mocha/no-pending-tests": "error",
  56. "mocha/no-skipped-tests": "error",
  57. "mocha/no-mocha-arrows": "error",
  58. // chai-specific rules
  59. "chai-expect/missing-assertion": "error",
  60. "chai-expect/terminating-properties": "error",
  61. // prefer-arrow-callback applies to all callbacks, not just ones in mocha tests.
  62. // we don't enforce this at the top-level - just in tests to manage `this` scope
  63. // based on mocha's context mechanism
  64. "mocha/prefer-arrow-callback": "error"
  65. }
  66. },
  67. {
  68. // Backend specific rules
  69. "files": ["app/**/*.js", "app.js", "index.js"],
  70. "rules": {
  71. // don't allow console.log in backend code
  72. "no-console": "error",
  73. // Do not allow importing of implicit dependencies.
  74. "import/no-extraneous-dependencies": ["error", {
  75. // Do not allow importing of devDependencies.
  76. "devDependencies": false
  77. }]
  78. }
  79. }
  80. ]
  81. }