mthadley / eslint-plugin-sort-destructure-keys

ESLint plugin to check if keys should be sorted in an object pattern.
https://www.npmjs.com/package/eslint-plugin-sort-destructure-keys
ISC License
95 stars 9 forks source link

Add support for ESLint v9 #266

Closed christopherschroer closed 6 months ago

christopherschroer commented 7 months ago

ESlint v9 was recently released

https://eslint.org/blog/2024/04/eslint-v9.0.0-released/

It includes breaking changes for plugins

https://eslint.org/docs/latest/use/migrate-to-9.0.0#breaking-changes-for-plugin-developers

Could support for ESLint v9 be added to this plugin?

ptb commented 7 months ago

I created a PR: https://github.com/mthadley/eslint-plugin-sort-destructure-keys/pull/267

To test it out before it is merged: npm i eslint-plugin-sort-destructure-keys@github:ptb/eslint-plugin-sort-destructure-keys

mthadley commented 6 months ago

Thanks for the help, @ptb! In my testing everything seems to work fine with eslint@9, and so this has been published in 1.6.0.

Marking as resolved, but please let me know if anyone notices any other issues.

denchen commented 6 months ago

Can I just verify how to use this library with ESLint 9. This is what I did, but I'm not sure if this is the proper way

import tsEslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import { rules as sortDestructureKeys } from 'eslint-plugin-sort-destructure-keys';

export default tsEslint.config(
  ...tsEslint.configs.recommended,
  {
    plugins: {
      '@typescript-eslint': tsEslint.plugin,
      react,
      'sort-destructure-keys': {
        rules: sortDestructureKeys,
      },
    }
  }
}
irfanandriansyah1997 commented 5 months ago

Can I just verify how to use this library with ESLint 9. This is what I did, but I'm not sure if this is the proper way

import tsEslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import { rules as sortDestructureKeys } from 'eslint-plugin-sort-destructure-keys';

export default tsEslint.config(
  ...tsEslint.configs.recommended,
  {
    plugins: {
      '@typescript-eslint': tsEslint.plugin,
      react,
      'sort-destructure-keys': {
        rules: sortDestructureKeys,
      },
    }
  }
}

I thought you may try this approach, which works properly on my end.

import tsEslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import eslintPluginSortDestructureKeys from 'eslint-plugin-sort-destructure-keys';

export default tsEslint.config(
  ...tsEslint.configs.recommended,
  {
    plugins: {
      '@typescript-eslint': tsEslint.plugin,
      react,
      'sort-destructure-keys': eslintPluginSortDestructureKeys,
    }
  }
}
ps-20x commented 2 months ago

I thought you may try this approach, which works properly on my end.

import tsEslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import eslintPluginSortDestructureKeys from 'eslint-plugin-sort-destructure-keys';

export default tsEslint.config(
  ...tsEslint.configs.recommended,
  {
    plugins: {
      '@typescript-eslint': tsEslint.plugin,
      react,
      'sort-destructure-keys': eslintPluginSortDestructureKeys,
    }
  }
}

Thanks for your example. I tried this approach but getting the following error: image

chanakya-svt commented 4 weeks ago

@ps-20x Hi, were you able to fix the declaration file error. I am facing the same issue but could not figure out a solution