From 364b664db50e3534ed7c4f05c1f2e7df8d1b730c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Fri, 26 Nov 2021 16:52:22 +0100 Subject: [PATCH 1/3] chore(CI): support testing against multiple ESLint versions --- .github/workflows/CI.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 11e402c9..40f36c99 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,13 +6,12 @@ jobs: main: strategy: matrix: - node: [10.12, 10, 12.0, 12, 14, 15] + eslint: [7] + node: [10.12, 10, 12.0, 12, 14, 16] runs-on: ubuntu-latest steps: - name: 🛑 Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ secrets.GITHUB_TOKEN }} + uses: styfle/cancel-workflow-action@0.9.1 - name: ⬇️ Checkout repo uses: actions/checkout@v2 @@ -22,10 +21,13 @@ jobs: with: node-version: ${{ matrix.node }} - - name: 📥 Download deps + - name: 📥 Download dependencies uses: bahmutov/npm-install@v1 with: useLockFile: false + - name: 📥 Install ESLint v${{ matrix.eslint }} + run: npm install eslint@${{ matrix.eslint }} + - name: ▶️ Run test script run: npm run test -- --runInBand From 7ac06ac3aef4efa288917babff41649cc52fef53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Mon, 6 Dec 2021 22:44:09 +0100 Subject: [PATCH 2/3] feat: drop Node 10 support BREAKING CHANGE: Requires Node@^12.22.0 || ^14.17.0 || >=16.0.0 --- .github/workflows/CI.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 40f36c99..f547602e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: eslint: [7] - node: [10.12, 10, 12.0, 12, 14, 16] + node: [12.22.0, 12, 14.17.0, 14, 16] runs-on: ubuntu-latest steps: - name: 🛑 Cancel Previous Runs diff --git a/package.json b/package.json index 0db58113..ad9aaf83 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "eslint": "^7.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "license": "ISC", "lint-staged": { From 32e9c7e13bf054ec48ef9e1f53fef8fbf26b1931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Mon, 6 Dec 2021 22:33:12 +0100 Subject: [PATCH 3/3] chore: update `eslint-plugin-eslint-plugin` to latest --- package-lock.json | 73 ++++++++++++++++++++++++++---- package.json | 4 +- rules/always-return.js | 1 + rules/avoid-new.js | 1 + rules/catch-or-return.js | 25 ++++++++++ rules/no-callback-in-promise.js | 14 ++++++ rules/no-native.js | 1 + rules/no-nesting.js | 1 + rules/no-new-statics.js | 1 + rules/no-promise-in-callback.js | 1 + rules/no-return-in-finally.js | 1 + rules/no-return-wrap.js | 11 +++++ rules/param-names.js | 1 + rules/prefer-await-to-callbacks.js | 1 + rules/prefer-await-to-then.js | 1 + rules/valid-params.js | 1 + 16 files changed, 126 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index f07a5c43..3073cf09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,13 +5,13 @@ "requires": true, "packages": { "": { - "version": "5.0.0", + "version": "5.1.0", "license": "ISC", "devDependencies": { "doctoc": "^2.0.0", "eslint": "^7.23.0", "eslint-config-prettier": "^8.1.0", - "eslint-plugin-eslint-plugin": "^3.0.0", + "eslint-plugin-eslint-plugin": "^4.0.2", "eslint-plugin-jest": "^24.3.4", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", @@ -2733,15 +2733,46 @@ } }, "node_modules/eslint-plugin-eslint-plugin": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-4.0.2.tgz", + "integrity": "sha512-EUNNLrWvwQ7QU6GGYWGMw7IHGSIGDn5GCbnQlzFHH5ypgL1gR9Fk0dUnOpzyPaI+OLc6rAs7Askv+IPFUKJdOQ==", + "dev": true, + "dependencies": { + "eslint-utils": "^3.0.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/eslint-plugin-eslint-plugin/node_modules/eslint-utils": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-3.0.0.tgz", - "integrity": "sha512-KGBjaO3BErr47Swsf3gBWNOyJFYCCjpzfiZUWdqX6XSI+IFRpnDZy44GxjhxmOuThEi3eRh9HzkW7NLNw4SM1Q==", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "/~https://github.com/sponsors/mysticatea" }, "peerDependencies": { - "eslint": "^7.0.0" + "eslint": ">=5" + } + }, + "node_modules/eslint-plugin-eslint-plugin/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" } }, "node_modules/eslint-plugin-jest": { @@ -6360,6 +6391,7 @@ "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, "bin": { "uuid": "bin/uuid" @@ -6555,6 +6587,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", + "deprecated": "some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added", "dev": true, "dependencies": { "@cnakazawa/watch": "^1.0.3", @@ -10592,11 +10625,31 @@ } }, "eslint-plugin-eslint-plugin": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-3.0.0.tgz", - "integrity": "sha512-KGBjaO3BErr47Swsf3gBWNOyJFYCCjpzfiZUWdqX6XSI+IFRpnDZy44GxjhxmOuThEi3eRh9HzkW7NLNw4SM1Q==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-4.0.2.tgz", + "integrity": "sha512-EUNNLrWvwQ7QU6GGYWGMw7IHGSIGDn5GCbnQlzFHH5ypgL1gR9Fk0dUnOpzyPaI+OLc6rAs7Askv+IPFUKJdOQ==", "dev": true, - "requires": {} + "requires": { + "eslint-utils": "^3.0.0", + "estraverse": "^5.2.0" + }, + "dependencies": { + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } }, "eslint-plugin-jest": { "version": "24.3.4", diff --git a/package.json b/package.json index ad9aaf83..fdbefa14 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "doctoc": "^2.0.0", "eslint": "^7.23.0", "eslint-config-prettier": "^8.1.0", - "eslint-plugin-eslint-plugin": "^3.0.0", + "eslint-plugin-eslint-plugin": "^4.0.2", "eslint-plugin-jest": "^24.3.4", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", @@ -35,7 +35,7 @@ "jest": "^26.6.3", "jest-runner-eslint": "^0.10.0", "lint-staged": "^10.5.4", - "prettier": "^2.2.1" + "prettier": "2.2.1" }, "peerDependencies": { "eslint": "^7.0.0" diff --git a/rules/always-return.js b/rules/always-return.js index 51068497..2e703561 100644 --- a/rules/always-return.js +++ b/rules/always-return.js @@ -62,6 +62,7 @@ module.exports = { docs: { url: getDocsUrl('always-return'), }, + schema: [], }, create(context) { // funcInfoStack is a stack representing the stack of currently executing diff --git a/rules/avoid-new.js b/rules/avoid-new.js index e6032f75..2763cf8b 100644 --- a/rules/avoid-new.js +++ b/rules/avoid-new.js @@ -13,6 +13,7 @@ module.exports = { docs: { url: getDocsUrl('avoid-new'), }, + schema: [], }, create(context) { return { diff --git a/rules/catch-or-return.js b/rules/catch-or-return.js index ba2d6677..c5f31e14 100644 --- a/rules/catch-or-return.js +++ b/rules/catch-or-return.js @@ -18,6 +18,31 @@ module.exports = { messages: { terminationMethod: 'Expected {{ terminationMethod }}() or return', }, + schema: [ + { + type: 'object', + properties: { + allowFinally: { + type: 'boolean', + }, + allowThen: { + type: 'boolean', + }, + terminationMethod: { + oneOf: [ + { type: 'string' }, + { + type: 'array', + items: { + type: 'string', + }, + }, + ], + }, + }, + additionalProperties: false, + }, + ], }, create(context) { const options = context.options[0] || {} diff --git a/rules/no-callback-in-promise.js b/rules/no-callback-in-promise.js index 5e58f245..1d03ddb3 100644 --- a/rules/no-callback-in-promise.js +++ b/rules/no-callback-in-promise.js @@ -19,6 +19,20 @@ module.exports = { messages: { callback: 'Avoid calling back inside of a promise.', }, + schema: [ + { + type: 'object', + properties: { + exceptions: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + additionalProperties: false, + }, + ], }, create(context) { return { diff --git a/rules/no-native.js b/rules/no-native.js index 7ad996eb..23878ddd 100644 --- a/rules/no-native.js +++ b/rules/no-native.js @@ -32,6 +32,7 @@ module.exports = { messages: { name: '"{{name}}" is not defined.', }, + schema: [], }, create(context) { /** diff --git a/rules/no-nesting.js b/rules/no-nesting.js index 98a1750b..7e780253 100644 --- a/rules/no-nesting.js +++ b/rules/no-nesting.js @@ -15,6 +15,7 @@ module.exports = { docs: { url: getDocsUrl('no-nesting'), }, + schema: [], }, create(context) { return { diff --git a/rules/no-new-statics.js b/rules/no-new-statics.js index 16b177b9..6ad01618 100644 --- a/rules/no-new-statics.js +++ b/rules/no-new-statics.js @@ -10,6 +10,7 @@ module.exports = { url: getDocsUrl('no-new-statics'), }, fixable: 'code', + schema: [], }, create(context) { return { diff --git a/rules/no-promise-in-callback.js b/rules/no-promise-in-callback.js index 01674236..4411cf76 100644 --- a/rules/no-promise-in-callback.js +++ b/rules/no-promise-in-callback.js @@ -15,6 +15,7 @@ module.exports = { docs: { url: getDocsUrl('no-promise-in-callback'), }, + schema: [], }, create(context) { return { diff --git a/rules/no-return-in-finally.js b/rules/no-return-in-finally.js index f70fa01f..fb4702cc 100644 --- a/rules/no-return-in-finally.js +++ b/rules/no-return-in-finally.js @@ -9,6 +9,7 @@ module.exports = { docs: { url: getDocsUrl('no-return-in-finally'), }, + schema: [], }, create(context) { return { diff --git a/rules/no-return-wrap.js b/rules/no-return-wrap.js index 1e3af65a..b603ebdf 100644 --- a/rules/no-return-wrap.js +++ b/rules/no-return-wrap.js @@ -45,6 +45,17 @@ module.exports = { resolve: 'Avoid wrapping return values in Promise.resolve', reject: 'Expected throw instead of Promise.reject', }, + schema: [ + { + type: 'object', + properties: { + allowReject: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ], }, create(context) { const options = context.options[0] || {} diff --git a/rules/param-names.js b/rules/param-names.js index fdf1b73b..de93c343 100644 --- a/rules/param-names.js +++ b/rules/param-names.js @@ -8,6 +8,7 @@ module.exports = { docs: { url: getDocsUrl('param-names'), }, + schema: [], }, create(context) { return { diff --git a/rules/prefer-await-to-callbacks.js b/rules/prefer-await-to-callbacks.js index db76f703..87aee7a8 100644 --- a/rules/prefer-await-to-callbacks.js +++ b/rules/prefer-await-to-callbacks.js @@ -11,6 +11,7 @@ module.exports = { messages: { error: 'Avoid callbacks. Prefer Async/Await.', }, + schema: [], }, create(context) { function checkLastParamsForCallback(node) { diff --git a/rules/prefer-await-to-then.js b/rules/prefer-await-to-then.js index bb6e0c4b..2828cdda 100644 --- a/rules/prefer-await-to-then.js +++ b/rules/prefer-await-to-then.js @@ -13,6 +13,7 @@ module.exports = { docs: { url: getDocsUrl('prefer-await-to-then'), }, + schema: [], }, create(context) { /** Returns true if node is inside yield or await expression. */ diff --git a/rules/valid-params.js b/rules/valid-params.js index ea185bd9..c01c333a 100644 --- a/rules/valid-params.js +++ b/rules/valid-params.js @@ -11,6 +11,7 @@ module.exports = { 'Ensures the proper number of arguments are passed to Promise functions', url: getDocsUrl('valid-params'), }, + schema: [], }, create(context) { return {