Skip to content

Commit ce0d2b2

Browse files
feat(recommended-legacy)!: remove config (#363)
- ESLint v10 does not support eslintrc - Simplify migration guide in README
1 parent 484f8b6 commit ce0d2b2

File tree

5 files changed

+15
-83
lines changed

5 files changed

+15
-83
lines changed

.eslint-doc-generatorrc.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@
22

33
/** @type {import('eslint-doc-generator').GenerateOptions} */
44
export default {
5-
ignoreConfig: [
6-
'recommended-legacy',
7-
],
85
};

README.md

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
[![NPM version](https://img.shields.io/npm/v/eslint-plugin-rxjs-x.svg)](https://www.npmjs.com/package/eslint-plugin-rxjs-x)
55
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/JasonWeinzierl/eslint-plugin-rxjs-x/badge)](https://scorecard.dev/viewer/?uri=github.com/JasonWeinzierl/eslint-plugin-rxjs-x)
66

7+
> [!NOTE]
8+
> Forked from [`eslint-plugin-rxjs`](https://github.com/cartant/eslint-plugin-rxjs)
9+
> as the original repository seems [no longer maintained](https://github.com/cartant/eslint-plugin-rxjs/issues/127).
10+
711
This ESLint plugin is intended to prevent issues with [RxJS 7](https://github.com/ReactiveX/rxjs/tree/7.x).
812

913
Most of these rules require TypeScript typed linting and are indicated as such below.
@@ -39,60 +43,17 @@ See [typescript-eslint's Getting Started](https://typescript-eslint.io/getting-s
3943

4044
Additionally, consider if the `rxjsX.configs.strict` shared config is right for your project.
4145

42-
## Legacy Migration Guide from `eslint-plugin-rxjs`
46+
## Notable Changes from `eslint-plugin-rxjs`
47+
48+
1. eslintrc is not supported.
49+
2. The namespace of this plugin is `rxjs-x` instead of `rxjs`.
50+
- e.g. if your ESLint config had `"rxjs/no-subject-value": "error"`, replace it with `"rxjs-x/no-subject-value": "error"`.
51+
- e.g. if your project had inline comments like `// eslint-disable-next-line rxjs/no-async-subscribe`, replace them with `// eslint-disable-next-line rxjs-x/no-async-subscribe`.
52+
3. `rxjs/no-ignored-observable` is replaced with `rxjs-x/no-floating-observable`.
4353

4454
> [!TIP]
4555
> A complete description of all changes from `eslint-plugin-rxjs` are documented in the [CHANGELOG](CHANGELOG.md) file.
4656

47-
This project started as a fork of [`eslint-plugin-rxjs`](https://github.com/cartant/eslint-plugin-rxjs)
48-
but is still compatible with the eslintrc configuration format.
49-
50-
> [!WARNING]
51-
> eslintrc compatibility will be removed in v1.
52-
> Users are highly encouraged to upgrade to ESLint's flat configuration format.
53-
> See: [https://eslint.org/docs/latest/use/configure/migration-guide]
54-
55-
1. Install `eslint-plugin-rxjs-x` using your preferred package manager.
56-
2. If you previously used the `plugin:rxjs/recommended` shared config,
57-
replace it with `plugin:rxjs-x/recommended-legacy`:
58-
59-
```diff
60-
"extends": [
61-
"plugin:@typescript-eslint/recommended",
62-
- "plugin:rxjs/recommended",
63-
+ "plugin:rxjs-x/recommended-legacy",
64-
],
65-
```
66-
67-
3. If you previously did _not_ use a shared config,
68-
then replace the `rxjs` plugin to your `plugins` block:
69-
70-
```diff
71-
"plugins": [
72-
"@typescript-eslint",
73-
- "rxjs",
74-
+ "rxjs-x",
75-
],
76-
```
77-
78-
- Note: this is unnecessary if you are using the `recommended-legacy` shared config.
79-
4. In your `rules` blocks, replace the namespace `rxjs` with `rxjs-x` for all rules:
80-
81-
```diff
82-
"rules": {
83-
- "rxjs/no-subject-value": "error",
84-
+ "rxjs-x/no-subject-value": "error",
85-
},
86-
```
87-
88-
- Note: if your project has inline comments (e.g. `eslint-disable-next-line`) referencing `rxjs` rules, you must update the namespace there too.
89-
5. If you previously used `rxjs/no-ignored-observable`, consider replacing it with `rxjs-x/no-floating-observables`. `no-ignored-observable` will be removed in v1.
90-
91-
```diff
92-
- 'rxjs/no-ignored-observable': 'error',
93-
+ 'rxjs-x/no-floating-observables': 'error',
94-
```
95-
9657
## Configs
9758

9859
<!-- begin auto-generated configs list -->

src/configs/recommended.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export const createRecommendedConfig = (
1111
},
1212
} satisfies Linter.Config);
1313

14-
export const createLegacyRecommendedConfig = () => ({
15-
...baseConfig,
16-
plugins: ['rxjs-x'] as const,
17-
} satisfies Linter.LegacyConfig);
18-
1914
const baseConfig = {
2015
rules: {
2116
'rxjs-x/no-async-subscribe': 'error',

src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { TSESLint } from '@typescript-eslint/utils';
22
import type { ESLint, Rule } from 'eslint';
33
import { name, version } from '../package.json';
4-
import { createLegacyRecommendedConfig, createRecommendedConfig } from './configs/recommended';
4+
import { createRecommendedConfig } from './configs/recommended';
55
import { createStrictConfig } from './configs/strict';
66

77
import { banObservablesRule } from './rules/ban-observables';
@@ -109,9 +109,8 @@ const plugin = {
109109
const rxjsX = {
110110
...plugin,
111111
configs: {
112-
'recommended': createRecommendedConfig(plugin),
113-
'strict': createStrictConfig(plugin),
114-
'recommended-legacy': createLegacyRecommendedConfig(),
112+
recommended: createRecommendedConfig(plugin),
113+
strict: createStrictConfig(plugin),
115114
},
116115
} satisfies ESLint.Plugin;
117116

tests/configs/recommended.test.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest';
2-
import { createLegacyRecommendedConfig, createRecommendedConfig } from '../../src/configs/recommended';
2+
import { createRecommendedConfig } from '../../src/configs/recommended';
33

44
describe('recommended', () => {
55
const mockPlugin = {};
@@ -20,23 +20,3 @@ describe('recommended', () => {
2020
expect(config.name).toEqual('rxjs-x/recommended');
2121
});
2222
});
23-
24-
describe('recommended-legacy', () => {
25-
const config = createLegacyRecommendedConfig();
26-
27-
it('should add the rxjs-x plugin', () => {
28-
expect(config.plugins).toEqual(['rxjs-x']);
29-
});
30-
31-
it('should use the defaults of each rule', () => {
32-
expect(config.rules).instanceOf(Object);
33-
for (const ruleEntry of Object.values(config.rules)) {
34-
expect(ruleEntry).toEqual('error');
35-
}
36-
});
37-
38-
it('should have no other properties', () => {
39-
const allowedKeys = ['rules', 'plugins'];
40-
expect(Object.keys(config)).toEqual(allowedKeys);
41-
});
42-
});

0 commit comments

Comments
 (0)