eslint-plugin-rxjs

An upgrade of eslint-plugin-rxjs to support modern TypeScript and ESLint. ie, Flat Config as well as legacy config.
Since some rules have better implementations in other more generic ESLint packages, they have been removed and noted here as to the appropriate replacements.
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:
npm install @typescript-eslint/parser --save-dev
Install the package using npm:
npm install @smarttools/eslint-plugin-rxjs --save-dev
Configure the parser
and the parserOptions
for ESLint. Here, I use a .eslintrc.js
file for the configuration:
Flat Config
const rxjs = require('@smarttools/eslint-plugin-rxjs');
module.exports = [{
files: ['**/*'],
plugins: {
rxjs,
},
},{
files: ['**/*.ts'],
// languageOptions here
rules: {
'rxjs/no-async-subscribe': 'error',
...etc.
},
}];
Legacy Config
const { join } = require("path");
module.exports = {
parser: "@typescript-eslint/parser",
// parserOptions here
plugins: ["@smarttools/rxjs"],
extends: [],
rules: {
"@smarttools/rxjs/no-async-subscribe": "error",
...etc.
}
};
Or, using the recommended
configuration:
Note: The recommended configuration uses rules that require type checking. You will need to supply the parsing options as specified in the TypeScript ESLint documentation.
Flat Config
const rxjs = require('@smarttools/eslint-plugin-rxjs');
module.exports = [
rxjs.configs.recommended,
{
files: ['**/*.ts'],
plugins: {
rxjs,
},
},
// additional rules
];
Legacy Config
const { join } = require("path");
module.exports = {
parser: "@typescript-eslint/parser",
// parserOptions here
extends: ["plugin:@smarttools/rxjs/recommended-legacy"],
};
Rules
The package includes the following rules.
Rules marked with ✅ are recommended and rules marked with 🔧 have fixers.