From 2cea492868975c86104c5feb0f6347368f20f5e5 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Sat, 8 Mar 2025 17:21:41 -0800 Subject: [PATCH] refactor: fix lint errors No change to logic. This fixes some lint errors. This is technically a breaking change because we're dropping official support for node v4 (although the real breaking change will come after this when I update shelljs). For some reason the old eslint-wrapper wasn't actually reporting lint errors (there were several on the main branch). I'm not going to debug this since we can just delete the wrapper entirely. --- .eslintrc.json | 2 ++ .github/workflows/main.yml | 1 - index.js | 3 ++- package.json | 4 ++-- scripts/eslint-wrapper.js | 14 -------------- test/test.js | 2 +- 6 files changed, 7 insertions(+), 19 deletions(-) delete mode 100755 scripts/eslint-wrapper.js diff --git a/.eslintrc.json b/.eslintrc.json index 300153e..3c61636 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,6 +16,8 @@ "prefer-template": 0, "func-names": 0, "import/no-extraneous-dependencies": ["error", {"devDependencies": true}], + "import/order": 0, + "no-restricted-globals": 0, "new-cap": [2, { "capIsNewExceptions": [ "ShellString" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb5cced..0b24a98 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,6 @@ jobs: fail-fast: false matrix: node-version: - - 4 - 6 - 8 - 10 diff --git a/index.js b/index.js index 1fd93c3..3e1c87f 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,7 @@ var plugin = require('shelljs/plugin'); // Require whatever modules you need for your project var opener = require('opener'); var fs = require('fs'); + var pathExistsSync = function (filePath) { try { fs.accessSync(filePath); @@ -32,7 +33,7 @@ function open(options, fileName) { // Register the new plugin as a ShellJS command plugin.register('open', open, { - cmdOptions: {}, // There are no supported options for this command + cmdOptions: {}, // There are no supported options for this command }); // Optionally, you can export the implementation of the command like so: diff --git a/package.json b/package.json index 4c2ebe5..5d2ed8e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "posttest": "npm run lint", "test": "mocha", - "lint": "node scripts/eslint-wrapper.js", + "lint": "eslint .", "changelog": "shelljs-changelog", "release:major": "shelljs-release major", "release:minor": "shelljs-release minor", @@ -43,6 +43,6 @@ "opener": "^1.4.1" }, "engines": { - "node": ">=4" + "node": ">=6" } } diff --git a/scripts/eslint-wrapper.js b/scripts/eslint-wrapper.js deleted file mode 100755 index 5e9d332..0000000 --- a/scripts/eslint-wrapper.js +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env node - -var exec = require('child_process').exec; - -// var version = process.version; -var version = process.version.substr(1).split('.'); -if (parseInt(version[0], 10) >= 4) { - exec('eslint .', { stdio: 'inherit' }, function (code) { - process.exit(code); - }); -} else { - console.log('Linting is only supported on node v4+'); - process.exit(0); -} diff --git a/test/test.js b/test/test.js index f6bb620..d986049 100644 --- a/test/test.js +++ b/test/test.js @@ -27,7 +27,7 @@ var pluginOpen = require('..'); * want to use ShellJS like this normally): */ var shell = require('shelljs'); // recommended -require('shelljs/global'); // not recommended +require('shelljs/global'); // not recommended /* * Now, require whichever other modules you want to require: