From 9660ca53afc488f90db8b1f26e0e4b5fa2da3373 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 16 Jul 2023 09:24:14 +0200 Subject: [PATCH] Enable more ESLint `unicorn` plugin rules - `prefer-array-some`, which didn't require any code changes; please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-some.md - `prefer-modern-math-apis`, which should be fine given the currently supported browsers; please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-math-apis.md --- .eslintrc | 2 ++ package-lock.json | 38 ++++++++++++++------------------------ package.json | 2 +- src/core/function.js | 2 +- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/.eslintrc b/.eslintrc index 21a274d6b..54d490b7b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -65,12 +65,14 @@ "unicorn/prefer-array-flat": "error", "unicorn/prefer-array-flat-map": "error", "unicorn/prefer-array-index-of": "error", + "unicorn/prefer-array-some": "error", "unicorn/prefer-at": "error", "unicorn/prefer-date-now": "error", "unicorn/prefer-dom-node-append": "error", "unicorn/prefer-dom-node-remove": "error", "unicorn/prefer-logical-operator-over-ternary": "error", "unicorn/prefer-modern-dom-apis": "error", + "unicorn/prefer-modern-math-apis": "error", "unicorn/prefer-negative-index": "error", "unicorn/prefer-optional-catch-binding": "error", "unicorn/prefer-regexp-test": "error", diff --git a/package-lock.json b/package-lock.json index e4f1ab12b..eec3e94d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "eslint-plugin-no-unsanitized": "^4.0.2", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-sort-exports": "^0.8.0", - "eslint-plugin-unicorn": "^47.0.0", + "eslint-plugin-unicorn": "^48.0.0", "globals": "^13.20.0", "gulp": "^4.0.2", "gulp-postcss": "^9.0.1", @@ -6417,12 +6417,12 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "47.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-47.0.0.tgz", - "integrity": "sha512-ivB3bKk7fDIeWOUmmMm9o3Ax9zbMz1Bsza/R2qm46ufw4T6VBFBaJIR1uN3pCKSmSXm8/9Nri8V+iUut1NhQGA==", + "version": "48.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-48.0.0.tgz", + "integrity": "sha512-8fk/v3p1ro34JSVDBEmtOq6EEQRpMR0iTir79q69KnXFZ6DJyPkT3RAi+ZoTqhQMdDSpGh8BGR68ne1sP5cnAA==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.19.1", + "@babel/helper-validator-identifier": "^7.22.5", "@eslint-community/eslint-utils": "^4.4.0", "ci-info": "^3.8.0", "clean-regexp": "^1.0.0", @@ -6433,10 +6433,9 @@ "lodash": "^4.17.21", "pluralize": "^8.0.0", "read-pkg-up": "^7.0.1", - "regexp-tree": "^0.1.24", + "regexp-tree": "^0.1.27", "regjsparser": "^0.10.0", - "safe-regex": "^2.1.1", - "semver": "^7.3.8", + "semver": "^7.5.4", "strip-indent": "^3.0.0" }, "engines": { @@ -6446,7 +6445,7 @@ "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" }, "peerDependencies": { - "eslint": ">=8.38.0" + "eslint": ">=8.44.0" } }, "node_modules/eslint-plugin-unicorn/node_modules/builtin-modules": { @@ -6509,19 +6508,10 @@ "jsesc": "bin/jsesc" } }, - "node_modules/eslint-plugin-unicorn/node_modules/safe-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-2.1.1.tgz", - "integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==", - "dev": true, - "dependencies": { - "regexp-tree": "~0.1.1" - } - }, "node_modules/eslint-plugin-unicorn/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -16962,9 +16952,9 @@ } }, "node_modules/regexp-tree": { - "version": "0.1.24", - "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.24.tgz", - "integrity": "sha512-s2aEVuLhvnVJW6s/iPgEGK6R+/xngd2jNQ+xy4bXNDKxZKJH6jpPHY6kVeVv1IeLCHgswRj+Kl3ELaDjG6V1iw==", + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", + "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", "dev": true, "bin": { "regexp-tree": "bin/regexp-tree" diff --git a/package.json b/package.json index b98028451..ae6aaae92 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "eslint-plugin-no-unsanitized": "^4.0.2", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-sort-exports": "^0.8.0", - "eslint-plugin-unicorn": "^47.0.0", + "eslint-plugin-unicorn": "^48.0.0", "globals": "^13.20.0", "gulp": "^4.0.2", "gulp-postcss": "^9.0.1", diff --git a/src/core/function.js b/src/core/function.js index c7d4c7dd8..edee2558a 100644 --- a/src/core/function.js +++ b/src/core/function.js @@ -718,7 +718,7 @@ class PostScriptEvaluator { break; case "log": a = stack.pop(); - stack.push(Math.log(a) / Math.LN10); + stack.push(Math.log10(a)); break; case "lt": b = stack.pop();