Explorar el Código

Merge pull request #5518 from overleaf/jpa-no-empty

[misc] fix eslint violations for no-empty

GitOrigin-RevId: 8fc1688ac28ccf29b830ba43cd6091e64b5e3b07
Jakob Ackermann hace 5 años
padre
commit
5862359ff0

+ 0 - 1
services/chat/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/clsi/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/contacts/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/docstore/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/document-updater/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 3 - 1
services/document-updater/app/js/sharejs/text-composable.js

@@ -77,7 +77,9 @@ const checkOp = function (op) {
 exports._makeAppend = makeAppend = op =>
 exports._makeAppend = makeAppend = op =>
   function (component) {
   function (component) {
     if (component === 0 || component.i === '' || component.d === '') {
     if (component === 0 || component.i === '' || component.d === '') {
-    } else if (op.length === 0) {
+      return
+    }
+    if (op.length === 0) {
       return op.push(component)
       return op.push(component)
     } else if (
     } else if (
       typeof component === 'number' &&
       typeof component === 'number' &&

+ 3 - 1
services/document-updater/app/js/sharejs/text-tp2.js

@@ -216,7 +216,9 @@ type._append = append = function (op, component) {
     component.i === 0 ||
     component.i === 0 ||
     component.d === 0
     component.d === 0
   ) {
   ) {
-  } else if (op.length === 0) {
+    return
+  }
+  if (op.length === 0) {
     return op.push(component)
     return op.push(component)
   } else {
   } else {
     const last = op[op.length - 1]
     const last = op[op.length - 1]

+ 3 - 1
services/document-updater/app/js/sharejs/types/text-composable.js

@@ -78,7 +78,9 @@ const checkOp = function (op) {
 moduleExport._makeAppend = makeAppend = op =>
 moduleExport._makeAppend = makeAppend = op =>
   function (component) {
   function (component) {
     if (component === 0 || component.i === '' || component.d === '') {
     if (component === 0 || component.i === '' || component.d === '') {
-    } else if (op.length === 0) {
+      return
+    }
+    if (op.length === 0) {
       return op.push(component)
       return op.push(component)
     } else if (
     } else if (
       typeof component === 'number' &&
       typeof component === 'number' &&

+ 3 - 1
services/document-updater/app/js/sharejs/types/text-tp2.js

@@ -216,7 +216,9 @@ type._append = append = function (op, component) {
     component.i === 0 ||
     component.i === 0 ||
     component.d === 0
     component.d === 0
   ) {
   ) {
-  } else if (op.length === 0) {
+    return
+  }
+  if (op.length === 0) {
     return op.push(component)
     return op.push(component)
   } else {
   } else {
     const last = op[op.length - 1]
     const last = op[op.length - 1]

+ 0 - 1
services/filestore/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/notifications/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/real-time/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/spelling/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",

+ 0 - 1
services/track-changes/.eslintrc

@@ -22,7 +22,6 @@
   "rules": {
   "rules": {
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
     // START of temporary overrides
     // START of temporary overrides
-    "no-empty": "off",
     "node/handle-callback-err": "off",
     "node/handle-callback-err": "off",
     "no-loss-of-precision": "off",
     "no-loss-of-precision": "off",
     "node/no-callback-literal": "off",
     "node/no-callback-literal": "off",