Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs]: How to use in flat config? #301

Open
rakleed opened this issue Nov 3, 2024 · 3 comments
Open

[docs]: How to use in flat config? #301

rakleed opened this issue Nov 3, 2024 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@rakleed
Copy link

rakleed commented Nov 3, 2024

Please add to README information about how to use your plugin in flat config. Now it has information only about usage with eslintrc which is deprecated in ESLint 9.

@viveklbs
Copy link

viveklbs commented Nov 3, 2024

can i pick this up?
i am already testing it out in v9.14.0

@viveklbs
Copy link

viveklbs commented Nov 3, 2024

@rakleed it should look something like this

module.exports = {
  files: ["**/*.js"],
  plugins: {
    "sort-destructure-keys": require("eslint-plugin-sort-destructure-keys"),
  },
  rules: {
    "sort-destructure-keys/sort-destructure-keys": [
      "error",
      { caseSensitive: true },
    ],
  },
};

@rakleed
Copy link
Author

rakleed commented Nov 3, 2024

I was able to get the plugin to work based on the information in #266 (comment), but it would be nice for that information to be in the README. If you do PR, that will be great.

By the way, here is my simplified config for ESM:

import sortDestructureKeys from 'eslint-plugin-sort-destructure-keys';

export default [
  {
    files: ['**/*.js', '**/*.jsx'],
    plugins: {
      'sort-destructure-keys': sortDestructureKeys,
    },
    rules: {
      'sort-destructure-keys/sort-destructure-keys': 'error',
    },
  },
];

As an example of documentation for ESM and CJS, you can look at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/readme.md#usage-eslintconfigjs

@mthadley mthadley added help wanted Extra attention is needed good first issue Good for newcomers labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants