diff --git a/.eslintrc b/.eslintrc index 7935df591..6550a91ee 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,9 @@ { "extends": ["@readme/eslint-config"], "root": true, + "parserOptions": { + "ecmaVersion": 2020 + }, "rules": { /** * Because our command classes have a `run` method that might not always call `this` we need to diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e81dae27..a68fd6121 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x] + node-version: [14.x, 16.x] steps: - uses: actions/checkout@v2.4.0 diff --git a/bin/rdme b/bin/rdme index 271337723..274ca3db3 100755 --- a/bin/rdme +++ b/bin/rdme @@ -20,7 +20,7 @@ require('../src')(process.argv.slice(2)) 'support@readme.io' )}.`; - if (err && 'message' in err) { + if (err?.message) { message = err.message; } diff --git a/package-lock.json b/package-lock.json index 950803b40..fc8bfec83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "prettier": "^2.4.1" }, "engines": { - "node": "^12 || ^14 || ^16" + "node": "^14 || ^16" } }, "node_modules/@actions/core": { diff --git a/package.json b/package.json index 29395b063..5059fa1c9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "MIT", "author": "ReadMe (https://readme.com)", "engines": { - "node": "^12 || ^14 || ^16" + "node": "^14 || ^16" }, "bin": { "rdme": "bin/rdme" @@ -23,7 +23,8 @@ "oas", "apidoc", "microservice", - "documentation" + "documentation", + "readme" ], "repository": { "type": "git", diff --git a/src/lib/apiError.js b/src/lib/apiError.js index c022cde65..4f41b48b1 100644 --- a/src/lib/apiError.js +++ b/src/lib/apiError.js @@ -4,7 +4,7 @@ module.exports = class extends Error { // Special handling to for fetch `res` arguments where `res.error` will contain our API error response. if (typeof res === 'object') { - if ('error' in res && typeof res.error === 'object') { + if (typeof res?.error === 'object') { err = res.error; } else { err = res; @@ -20,7 +20,7 @@ module.exports = class extends Error { // If we returned help info in the API, show it otherwise don't render out multiple empty lines as we sometimes // throw `Error('non-api custom error message')` instances and catch them with this class. - if ('help' in err) { + if (err?.help) { this.message = [err.message, '', err.help].join('\n'); } else { this.message = err.message; diff --git a/src/lib/prompts.js b/src/lib/prompts.js index bda79f372..d5c1ead64 100644 --- a/src/lib/prompts.js +++ b/src/lib/prompts.js @@ -148,7 +148,7 @@ exports.createVersionPrompt = (versionList, opts, isUpdate) => [ name: 'is_stable', message: 'Would you like to make this version the main version for this project?', skip() { - return opts.main || (isUpdate && isUpdate.is_stable); + return opts.main || isUpdate?.is_stable; }, }, {