eslint-plugin-rxjs-angular icon indicating copy to clipboard operation
eslint-plugin-rxjs-angular copied to clipboard

ESLint v9 support

Open json-derulo opened this issue 1 year ago • 11 comments

ESLint v9 has been released recently. This plugin has a peer dependency to ESLint ^8.0.0 and causes peer dependency conflicts with ESLint v9.

json-derulo avatar Apr 17 '24 10:04 json-derulo

Also, this plugin doesn't send context information correctly to ESLint 9, causing "parserOptions.project" to be empty.

e-oz avatar Jul 19 '24 08:07 e-oz

@cartant: do you have a plan how you wish to proceed with all the recent changes? (flat config, takeuntildestroyed, ...). Since not too much happened here for quite some time, might it be an option to integrate and update the three rules in https://github.com/angular-eslint/angular-eslint ? I am just thinking out loud and I have no idea what JamesHenry would say to that

schreibse avatar Jul 20 '24 00:07 schreibse

I got the plugin working in ESLint v9 with the help of the @eslint/compat package:

import { fixupPluginRules } from '@eslint/compat';
import rxjsAngular from 'eslint-plugin-rxjs-angular';

export default tseslint.config(
  {
    files: ['**/*.ts'],
    plugins: {
      'rxjs-angular': fixupPluginRules(rxjsAngular),
    },
  },
);

Additionally I needed to add a npm override to silence the peer dependency error.

json-derulo avatar Aug 01 '24 14:08 json-derulo

Didn't work for me :( And now here is ESLint 10 ;)

e-oz avatar Aug 01 '24 15:08 e-oz

Seems like the "correct" approach would be to use fixupConfigRules(). This worked for us;


const eslint = require('@eslint/js');
const tseslint = require('typescript-eslint');
const eslintrc = require('@eslint/eslintrc');
const { fixupConfigRules } = require('@eslint/compat');

const compat = new eslintrc.FlatCompat({
    baseDirectory: __dirname,
});

module.exports = [
    {
        files: ['**/*.ts'],
        languageOptions: {
            parserOptions: {
                project: true,
                tsconfigRootDir: __dirname,
            },
        },
        extends: [
            eslint.configs.recommended,
            ...tseslint.configs.recommendedTypeChecked,
            ...fixupConfigRules(compat.extends('plugin:rxjs/recommended')),
        ],
        rules: {
            // `eslint-plugin-rxjs` overrides
            'rxjs/no-implicit-any-catch': 0,
            'rxjs/no-subject-value': 'error',
        },
    }
]

oBusk avatar Aug 06 '24 13:08 oBusk

I don't understand how you can call "patching" a correct approach. It's just a temporary patch.

e-oz avatar Aug 07 '24 10:08 e-oz

I don't understand how you can call "patching" a correct approach. It's just a temporary patch.

To make it work right now of course, not as a permantent solution

oBusk avatar Aug 07 '24 11:08 oBusk