Просмотр исходного кода

Merge pull request #3505 from overleaf/as-reenable-lint-rules

Reenable some lint rules

GitOrigin-RevId: 42d891f24b7ab101308adcf8f31cccf7ac229a59
Timothée Alby 5 лет назад
Родитель
Сommit
4faa6dde0d

+ 21 - 16
services/web/.eslintrc

@@ -39,31 +39,30 @@
     }
   },
   "rules": {
-    "node/no-callback-literal": "off",
-    "node/no-deprecated-api": "off",
-    "node/handle-callback-err": "off",
-    "node/no-path-concat": "off",
-    "no-prototype-builtins": "off",
     // Swap the no-unused-expressions rule with a more chai-friendly one
     "no-unused-expressions": "off",
-    "no-unused-vars": "off",
+    "chai-friendly/no-unused-expressions": "error",
+
+    // Disable some rules after upgrading ESLint
+    // TODO: re-enable and fix
+    "no-prototype-builtins": "off",
     "no-var": "off",
     "prefer-const": "off",
     "prefer-regex-literals": "off",
-    "react/jsx-curly-brace-presence": ["error", {
-      "props": "never",
-      "children": "never"
-    }],
+    "array-callback-return": "off",
+    "no-unreachable-loop": "off",
+    "no-loss-of-precision": "off",
+
+    "node/no-callback-literal": "off",
+    "node/no-deprecated-api": "off",
+    "node/handle-callback-err": "off",
+    "node/no-path-concat": "off",
+
     "react/display-name": "off",
     "react/no-unescaped-entities": "off",
     "react/no-unused-prop-types": "off",
     "react/jsx-no-target-blank": "off",
-    "react/jsx-handler-names": "off",
-    "array-callback-return": "off",
-    "no-empty": "off",
-    "no-unreachable-loop": "off",
-    "no-loss-of-precision": "off",
-    "chai-friendly/no-unused-expressions": "error"
+    "react/jsx-handler-names": "off"
   },
   "overrides": [
     // NOTE: changing paths may require updating them in the Makefile too.
@@ -128,6 +127,12 @@
         // Prevent usage of legacy string refs
         "react/no-string-refs": "error",
 
+        // Prevent curly braces around strings (as they're unnecessary)
+        "react/jsx-curly-brace-presence": ["error", {
+          "props": "never",
+          "children": "never"
+        }],
+
         // Fix conflict between prettier & standard by overriding to prefer
         // double quotes
         "jsx-quotes": ["error", "prefer-double"],

+ 1 - 2
services/web/frontend/js/ide/editor/directives/aceEditor/track-changes/TrackChangesManager.js

@@ -93,8 +93,7 @@ class TrackChangesManager {
   }
 
   onChangeScroll() {
-    if (this._scrollTimeout != null) {
-    } else {
+    if (this._scrollTimeout == null) {
       return (this._scrollTimeout = setTimeout(() => {
         this.recalculateVisibleEntries()
         this.$scope.$apply()