From 55f33cd5c3f69044fbb965fb8c66b252f8897ffe Mon Sep 17 00:00:00 2001 From: Dave Bush Date: Fri, 22 Nov 2024 15:57:16 -0500 Subject: [PATCH] support legacy 'recommended' --- README.md | 4 ++- packages/eslint-plugin-rxjs/README.md | 4 ++- packages/eslint-plugin-rxjs/src/index.ts | 18 ++++++----- .../src/lib/configs/recommended.ts | 32 +++++++++---------- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 14c298d..388845c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ The tests have been upgraded to use standard TypeScript and ESLint test helpers. All existing unit tests pass. +This plugin now works with both Flat Config and Legacy Config. Pay attention to the example below. + ## Install Install the ESLint TypeScript parser using npm: @@ -88,7 +90,7 @@ const { join } = require("path"); module.exports = { parser: "@typescript-eslint/parser", // parserOptions here - extends: ["plugin:@smarttools/rxjs/recommended"], + extends: ["plugin:@smarttools/rxjs/recommended-legacy"], }; ``` diff --git a/packages/eslint-plugin-rxjs/README.md b/packages/eslint-plugin-rxjs/README.md index 14c298d..388845c 100644 --- a/packages/eslint-plugin-rxjs/README.md +++ b/packages/eslint-plugin-rxjs/README.md @@ -10,6 +10,8 @@ The tests have been upgraded to use standard TypeScript and ESLint test helpers. All existing unit tests pass. +This plugin now works with both Flat Config and Legacy Config. Pay attention to the example below. + ## Install Install the ESLint TypeScript parser using npm: @@ -88,7 +90,7 @@ const { join } = require("path"); module.exports = { parser: "@typescript-eslint/parser", // parserOptions here - extends: ["plugin:@smarttools/rxjs/recommended"], + extends: ["plugin:@smarttools/rxjs/recommended-legacy"], }; ``` diff --git a/packages/eslint-plugin-rxjs/src/index.ts b/packages/eslint-plugin-rxjs/src/index.ts index 5d230bd..b37305e 100644 --- a/packages/eslint-plugin-rxjs/src/index.ts +++ b/packages/eslint-plugin-rxjs/src/index.ts @@ -103,16 +103,18 @@ const plugin: Linter.Plugin = { if (plugin.configs) { Object.assign(plugin.configs, { - recommended: [ - { - plugins: { - rxjs: plugin, - }, - rules: { - ...recommended.rules, + recommended: { + plugins: [{ + '@smarttools/rxjs': { + meta, + rules, }, + }], + rules: { + ...recommended.rules, }, - ], + }, + 'recommended-legacy': recommended, }); } diff --git a/packages/eslint-plugin-rxjs/src/lib/configs/recommended.ts b/packages/eslint-plugin-rxjs/src/lib/configs/recommended.ts index e95c5a2..d538bde 100644 --- a/packages/eslint-plugin-rxjs/src/lib/configs/recommended.ts +++ b/packages/eslint-plugin-rxjs/src/lib/configs/recommended.ts @@ -1,22 +1,22 @@ import { Linter } from '@typescript-eslint/utils/ts-eslint'; export = { - plugins: ['rxjs'], + plugins: ['@smarttools/rxjs'], rules: { - 'rxjs/no-async-subscribe': 'error', - 'rxjs/no-create': 'error', - 'rxjs/no-ignored-notifier': 'error', - 'rxjs/no-ignored-replay-buffer': 'error', - 'rxjs/no-ignored-takewhile-value': 'error', - 'rxjs/no-implicit-any-catch': 'error', - 'rxjs/no-index': 'error', - 'rxjs/no-internal': 'error', - 'rxjs/no-nested-subscribe': 'error', - 'rxjs/no-redundant-notify': 'error', - 'rxjs/no-sharereplay': ['error', { allowConfig: true }], - 'rxjs/no-subject-unsubscribe': 'error', - 'rxjs/no-unbound-methods': 'error', - 'rxjs/no-unsafe-subject-next': 'error', - 'rxjs/no-unsafe-takeuntil': 'error', + '@smarttools/rxjs/no-async-subscribe': 'error', + '@smarttools/rxjs/no-create': 'error', + '@smarttools/rxjs/no-ignored-notifier': 'error', + '@smarttools/rxjs/no-ignored-replay-buffer': 'error', + '@smarttools/rxjs/no-ignored-takewhile-value': 'error', + '@smarttools/rxjs/no-implicit-any-catch': 'error', + '@smarttools/rxjs/no-index': 'error', + '@smarttools/rxjs/no-internal': 'error', + '@smarttools/rxjs/no-nested-subscribe': 'error', + '@smarttools/rxjs/no-redundant-notify': 'error', + '@smarttools/rxjs/no-sharereplay': ['error', { allowConfig: true }], + '@smarttools/rxjs/no-subject-unsubscribe': 'error', + '@smarttools/rxjs/no-unbound-methods': 'error', + '@smarttools/rxjs/no-unsafe-subject-next': 'error', + '@smarttools/rxjs/no-unsafe-takeuntil': 'error', } as Linter.RulesRecord, };