From f77c52291e5d63b98986229f5c4c0909ec98cb5b Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 23 Jan 2017 14:49:38 +0100 Subject: [PATCH] Enable the `no-empty-pattern`/`no-floating-decimal`/`no-self-compare`/`no-delete-var`/`no-new-object` ESLint rules The following rules required no code changes: http://eslint.org/docs/rules/no-empty-pattern http://eslint.org/docs/rules/no-floating-decimal http://eslint.org/docs/rules/no-delete-var http://eslint.org/docs/rules/no-new-object There was just one change needed in order to enable: http://eslint.org/docs/rules/no-self-compare; which I think helps readability a lot, since that comparison makes no sense until you realize that we push `NaN` onto the `stack` in some cases *and* furthermore that `NaN !== NaN`. --- .eslintrc | 5 +++++ src/core/fonts.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index fa220bd7a..aca4fe1ac 100644 --- a/.eslintrc +++ b/.eslintrc @@ -47,11 +47,13 @@ "eqeqeq": ["error", "always"], "no-caller": "error", "no-else-return": "error", + "no-empty-pattern": "error", "no-eval": "error", "no-extend-native": "error", "no-extra-bind": "error", "no-extra-label": "error", "no-fallthrough": "error", + "no-floating-decimal": "error", "no-global-assign": "error", "no-implied-eval": "error", "no-lone-blocks": "error", @@ -64,6 +66,7 @@ "no-octal": "error", "no-redeclare": "error", "no-self-assign": "error", + "no-self-compare": "error", "no-unused-expressions": "error", "no-unused-labels": "error", "no-useless-call": "error", @@ -76,6 +79,7 @@ // Variables "no-catch-shadow": "error", + "no-delete-var": "error", "no-label-var": "error", "no-shadow-restricted-names": "error", "no-undef-init": "error", @@ -97,6 +101,7 @@ "new-parens": "error", "no-array-constructor": "error", "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0, "maxBOF": 1, }], + "no-new-object": "error", "no-tabs": "error", "no-trailing-spaces": ["error", { "skipBlankLines": false, }], "no-whitespace-before-property": "error", diff --git a/src/core/fonts.js b/src/core/fonts.js index db272718e..796d1f38a 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -2121,7 +2121,7 @@ var Font = (function FontClosure() { op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0; if (op >= 0x71 && op <= 0x75) { n = stack.pop(); - if (n === n) { + if (!isNaN(n)) { stackDelta = -n * 2; } }