Skip to content

Commit

Permalink
support legacy 'recommended'
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveMBush committed Nov 22, 2024
1 parent 3849043 commit 55f33cd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"],
};

```
Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-plugin-rxjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"],
};

```
Expand Down
18 changes: 10 additions & 8 deletions packages/eslint-plugin-rxjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}

Expand Down
32 changes: 16 additions & 16 deletions packages/eslint-plugin-rxjs/src/lib/configs/recommended.ts
Original file line number Diff line number Diff line change
@@ -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,
};

0 comments on commit 55f33cd

Please sign in to comment.