diff --git a/.eslintrc b/.eslintrc index 4a074c23f..cea6f465d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -20,6 +20,7 @@ "indent": ["off", 4], "keyword-spacing": "error", "linebreak-style": ["error", "unix"], + "no-await-in-loop": "error", "no-caller": "error", "no-catch-shadow": "error", "no-console": "warn", @@ -35,6 +36,7 @@ "no-label-var": "error", "no-lone-blocks": "error", "no-loop-func": "error", + "no-loss-of-precision": "error", "no-multi-str": "error", "no-new": "error", "no-new-func": "error", @@ -42,6 +44,7 @@ "no-octal": "error", "no-octal-escape": "error", "no-process-env": "error", + "no-promise-executor-return": "error", "no-proto": "error", "no-prototype-builtins": "off", "no-return-assign": "off", @@ -50,6 +53,7 @@ "no-sequences": "error", "no-shadow": "off", "no-shadow-restricted-names": "error", + "no-template-curly-in-string": "warn", "no-throw-literal": "error", "no-undef": "error", "no-unneeded-ternary": "error", @@ -57,16 +61,19 @@ "no-unexpected-multiline": "error", "no-unused-vars": "warn", "no-unreachable": "warn", + "no-unreachable-loop": "warn", "no-useless-escape": "off", "no-void": "error", "no-warning-comments": "warn", "no-with": "error", "no-use-before-define": ["off", "nofunc"], + "no-useless-backreference": "warn", + "quotes": ["error", "single"], "radix": ["error", "always"], + "require-atomic-updates": "error", "semi": ["error", "always"], "semi-spacing": "error", "space-unary-ops": "error", - "wrap-regex": "off", - "quotes": ["error", "single"] + "wrap-regex": "off" } } diff --git a/modules/presets/index.js b/modules/presets/index.js index ad69d863d..5d752f380 100644 --- a/modules/presets/index.js +++ b/modules/presets/index.js @@ -240,8 +240,8 @@ export function presetIndex() { // keeplist presets.forEach(p => { - let key; - for (key in p.tags) break; // pick the first tag + const keys = p.tags && Object.keys(p.tags); + const key = keys && keys.length && keys[0]; // pick the first tag if (!key) return; if (ignore.indexOf(key) !== -1) return; @@ -274,8 +274,8 @@ export function presetIndex() { if (d.suggestion || d.replacement || d.searchable === false) return pointTags; // only care about the primary tag - let key; - for (key in d.tags) break; // pick the first tag + const keys = d.tags && Object.keys(d.tags); + const key = keys && keys.length && keys[0]; // pick the first tag if (!key) return pointTags; // if this can be a point @@ -294,8 +294,8 @@ export function presetIndex() { if (d.suggestion || d.replacement || d.searchable === false) return vertexTags; // only care about the primary tag - let key; - for (key in d.tags) break; // pick the first tag + const keys = d.tags && Object.keys(d.tags); + const key = keys && keys.length && keys[0]; // pick the first tag if (!key) return vertexTags; // if this can be a vertex