until-destroy icon indicating copy to clipboard operation
until-destroy copied to clipboard

Eslint v9 update

Open elcreator opened this issue 11 months ago • 2 comments

Current eslint v9 didn't support old config to use recommended rule rxjs/no-unsafe-takeuntil.

This is how to fix it using the fork https://github.com/DaveMBush/eslint-plugin-rxjs :

npm i --save-dev @smarttools/eslint-plugin-rxjs

import rxjs from '@smarttools/eslint-plugin-rxjs';
export default [
...
  {
    languageOptions: {
      parserOptions: {
        projectService: true,
        tsconfigRootDir: import.meta.dirname
      },
    },
  },
  {
    files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
    // Override or add rules here
    plugins: {
      rxjs,
    },
    rules: {},
  },
  {
    files: ['**/*.ts'],
    rules: {
      'rxjs/no-unsafe-takeuntil': [
        'error',
        {
          alias: ['untilDestroyed']
        }
      ],
  },

elcreator avatar Mar 10 '25 22:03 elcreator

and here is fix for second rule of this repo (prefer-takeuntil):

npm i @rxlint/eslint-plugin-angular --save-dev

import rxjsAngular from '@rxlint/eslint-plugin-angular';
...
    plugins: {
...
      '@rxlint-angular': rxjsAngular
    },
...
    rules: {
...
      '@rxlint-angular/prefer-takeuntil': [
        'error',
        {
          alias: ['untilDestroyed'],
        },
      ],
...
    },

elcreator avatar Mar 16 '25 14:03 elcreator

@arturovt @NetanelBasal eslint 8 EOL passed 4 months ago and documentation https://github.com/ngneat/until-destroy?tab=readme-ov-file#eslint-rules didn't cover this fact. Rules are just incompatible with eslint9+ config format (without fixes above).

elcreator avatar Mar 16 '25 14:03 elcreator