diff --git a/.eslintrc b/.eslintrc deleted file mode 100755 index d69e7ec..0000000 --- a/.eslintrc +++ /dev/null @@ -1,22 +0,0 @@ -{ - "env": { - "node": true, - "es6": true, - "jest": true - }, - "parserOptions": { - "ecmaVersion": 2018 - }, - "plugins": [ - "jest" - ], - "extends": [ - "plugin:jest/recommended", - "standard" - ], - "rules": { - "no-var": 2 - }, - "globals": { - } -} \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 77a0dc8..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "env": { - "node": true, - "es6": true, - "jest": true - }, - "parserOptions": { - "ecmaVersion": 2018 - }, - "extends": "@adobe/eslint-config-aio-lib-config", - "rules": { - "jsdoc/no-defaults": 0 - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b54554d..379644b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ node_modules coverage/ junit.xml package-lock.json +.claude diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..e30b081 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,24 @@ +/* +Copyright 2026 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +const aioLibConfig = require('@adobe/eslint-config-aio-lib-config') +const pluginJest = require('eslint-plugin-jest') + +module.exports = [ + ...aioLibConfig, + pluginJest.configs['flat/recommended'], + { + rules: { + 'jsdoc/no-defaults': 'off' + } + } +] diff --git a/package.json b/package.json index 46c3f83..4115450 100644 --- a/package.json +++ b/package.json @@ -5,24 +5,19 @@ "repository": "adobe/aio-cli-plugin-certificate", "homepage": "https://github.com/adobe/aio-cli-plugin-certificate", "dependencies": { - "@oclif/core": "^1.9.0", + "@oclif/core": "^4.9.0", "debug": "^4.3.3", "fs-extra": "^9.0.0", "node-forge": "^1.3.0" }, "devDependencies": { - "@adobe/eslint-config-aio-lib-config": "^4.0.0", - "eslint": "^8.57.1", - "eslint-config-oclif": "^4.0.0", - "eslint-config-standard": "^17.1.0", - "eslint-plugin-import": "^2.31.0", - "eslint-plugin-jest": "^27.9.0", - "eslint-plugin-jsdoc": "^48.11.0", - "eslint-plugin-n": "^15.7.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.6.0", + "@adobe/eslint-config-aio-lib-config": "^5.0.0", + "eslint": "^9", + "eslint-plugin-jest": "^29", + "eslint-plugin-jsdoc": "^48", "jest": "^29", - "oclif": "^3.2.0", + "neostandard": "^0", + "oclif": "^4.0.0", "stdout-stderr": "^0.1.9" }, "engines": { diff --git a/src/commands/certificate/fingerprint.js b/src/commands/certificate/fingerprint.js index d178c83..0678c45 100644 --- a/src/commands/certificate/fingerprint.js +++ b/src/commands/certificate/fingerprint.js @@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag governing permissions and limitations under the License. */ -const { Command } = require('@oclif/core') +const { Command, Args } = require('@oclif/core') const fs = require('fs-extra') const debug = require('debug')('aio-cli-plugin-certificate:fingerprint') @@ -41,12 +41,11 @@ class FingerprintCommand extends Command { FingerprintCommand.description = 'Compute the fingerprint of a public key certificate for use with Adobe I/O' -FingerprintCommand.args = [ - { - name: 'file', +FingerprintCommand.args = { + file: Args.string({ required: true, description: 'file path to certificate to fingerprint' - } -] + }) +} module.exports = FingerprintCommand diff --git a/src/commands/certificate/verify.js b/src/commands/certificate/verify.js index bdf1eed..baf0cca 100644 --- a/src/commands/certificate/verify.js +++ b/src/commands/certificate/verify.js @@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag governing permissions and limitations under the License. */ -const { Command, Flags } = require('@oclif/core') +const { Command, Flags, Args } = require('@oclif/core') const fs = require('fs-extra') const debug = require('debug')('aio-cli-plugin-certificate:verify') @@ -70,12 +70,11 @@ VerifyCommand.flags = { }) } -VerifyCommand.args = [ - { - name: 'file', +VerifyCommand.args = { + file: Args.string({ required: true, description: 'file path to certificate to verify' - } -] + }) +} module.exports = VerifyCommand diff --git a/test/commands/certificate/fingerprint.test.js b/test/commands/certificate/fingerprint.test.js index 407755d..af05fff 100644 --- a/test/commands/certificate/fingerprint.test.js +++ b/test/commands/certificate/fingerprint.test.js @@ -49,10 +49,11 @@ test('description', async () => { }) test('args', async () => { - const arg = TheCommand.args[0] - expect(arg.name).toBeDefined() + expect(Object.keys(TheCommand.args)[0]).toBeDefined() }) +const mockConfig = { runHook: jest.fn().mockResolvedValue({ successes: [], failures: [] }) } + describe('instance methods - mock forge', () => { let CommandUnderTest, command, handleError, mockFS, mockForge jest.isolateModules(() => { @@ -63,7 +64,7 @@ describe('instance methods - mock forge', () => { }) beforeEach(() => { - command = new CommandUnderTest([]) + command = new CommandUnderTest([], mockConfig) handleError = jest.spyOn(command, 'error') }) @@ -103,7 +104,7 @@ describe('instance methods - real forge', () => { }) beforeEach(() => { - command = new CommandUnderTest([]) + command = new CommandUnderTest([], mockConfig) handleError = jest.spyOn(command, 'error') }) diff --git a/test/commands/certificate/generate.test.js b/test/commands/certificate/generate.test.js index 94163b6..53d548b 100644 --- a/test/commands/certificate/generate.test.js +++ b/test/commands/certificate/generate.test.js @@ -23,11 +23,13 @@ test('description', async () => { expect(TheCommand.description).toBeDefined() }) +const mockConfig = { runHook: jest.fn().mockResolvedValue({ successes: [], failures: [] }) } + describe('instance methods', () => { let command, handleError beforeEach(() => { - command = new TheCommand([]) + command = new TheCommand([], mockConfig) handleError = jest.spyOn(command, 'error') }) diff --git a/test/commands/certificate/verify.test.js b/test/commands/certificate/verify.test.js index e902c3d..81bb0d7 100644 --- a/test/commands/certificate/verify.test.js +++ b/test/commands/certificate/verify.test.js @@ -31,15 +31,16 @@ test('description', async () => { }) test('args', async () => { - const arg = TheCommand.args[0] - expect(arg.name).toBeDefined() + expect(Object.keys(TheCommand.args)[0]).toBeDefined() }) +const mockConfig = { runHook: jest.fn().mockResolvedValue({ successes: [], failures: [] }) } + describe('instance methods', () => { let command, handleError beforeEach(() => { - command = new TheCommand([]) + command = new TheCommand([], mockConfig) handleError = jest.spyOn(command, 'error') })