From 08fac663334474216a438d9d126566b655a113b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouven=20We=C3=9Fling?= Date: Thu, 21 May 2026 21:32:46 +0200 Subject: [PATCH] Migrate from jshint to eslint jshint has been unmainted for several years --- eslint.config.mjs | 20 ++++++++++++++++++++ lib/handlers.js | 4 ++-- lib/index.js | 2 +- package.json | 5 +++-- 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 eslint.config.mjs diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..128cbea --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,20 @@ +import { defineConfig } from "eslint/config"; +import globals from "globals"; + +export default defineConfig([{ + languageOptions: { + globals: { + ...globals.node, + }, + }, + + rules: { + "no-undef": "error", + "no-unused-vars": ["error", { "caughtErrors": "none" }], + "eol-last": "error", + "dot-notation": "error", + "no-empty": ["error", { + allowEmptyCatch: true, + }], + }, +}]); diff --git a/lib/handlers.js b/lib/handlers.js index 97bccfd..51af9a0 100755 --- a/lib/handlers.js +++ b/lib/handlers.js @@ -7,11 +7,11 @@ var _uniq = require('underscore').uniq; // Mitigates prototype pollution and constructor escape attacks. var UNSAFE_PROPERTY_NAMES = Object.create(null); -/* jshint -W069: true */ +/* eslint-disable dot-notation */ UNSAFE_PROPERTY_NAMES['constructor'] = true; UNSAFE_PROPERTY_NAMES['__proto__'] = true; UNSAFE_PROPERTY_NAMES['prototype'] = true; -/* jshint -W069: false */ +/* eslint-enable dot-notation */ function isUnsafePropertyName(name) { return typeof name === 'string' && UNSAFE_PROPERTY_NAMES[name] === true; diff --git a/lib/index.js b/lib/index.js index 4d26d89..4c070f3 100755 --- a/lib/index.js +++ b/lib/index.js @@ -24,7 +24,7 @@ JSONPath.prototype.parent = function(obj, string) { var node = this.nodes(obj, string)[0]; if (node) this._assert_safe_path_keys(node.path); - var key = node.path.pop(); /* jshint unused:false */ + var key = node.path.pop(); /* eslint-disable-line no-unused-vars */ return this.value(obj, node.path); } diff --git a/package.json b/package.json index ad3dfdf..7f31dac 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "author": "david@fmail.co.uk", "scripts": { "prepublishOnly": "node lib/aesprim.js > generated/aesprim-browser.js", - "test": "mocha -u tdd test && jshint lib", + "test": "mocha -u tdd test && eslint lib", "generate": "node bin/generate_parser.js > generated/parser.js" }, "dependencies": { @@ -18,13 +18,14 @@ "./lib/aesprim.js": "./generated/aesprim-browser.js" }, "devDependencies": { + "eslint": "10.4.0", + "globals": "17.6.0", "grunt": "0.4.5", "grunt-browserify": "3.8.0", "grunt-cli": "0.1.13", "grunt-contrib-uglify": "0.9.1", "jison": "0.4.13", "jscs": "1.10.0", - "jshint": "2.6.0", "mocha": "2.1.0" }, "repository": {