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

Release: v3.0.0 #90

Open
1 of 7 tasks
azat-io opened this issue Nov 24, 2023 · 6 comments · May be fixed by #113
Open
1 of 7 tasks

Release: v3.0.0 #90

azat-io opened this issue Nov 24, 2023 · 6 comments · May be fixed by #113
Labels
enhancement New feature or request

Comments

@azat-io
Copy link
Owner

azat-io commented Nov 24, 2023

  • Export a function to create a plugin configuration

Related issue: #78

I'm thinking of dropping the export of prebuild configs for flat ESLint config in the next version. Instead, I'd like to export a function to create a config that allows you to specify common settings for all rules and the ability to override settings for individual rules. The API I think will be something like this:

// eslint.config.js
import { perfectionist } from 'eslint-plugin-perfectionist'

export default [
  perfectionist({
    options: {
      type: 'natural',
      order: 'asc',
      'ignore-case': true,
    },
    rules: {
      'sort-imports': {
        type: 'line-length',
        order: 'desc',
      },
      'sort-jsx-props': {
         groups: [
           'multiline',
           'unknown',
           'shorthand'
         ],
      }
      'sort-classes': false,
      'sort-svelte-attributes': false,
    },
  }),
]

Nevertheless, we will not drop recommended configurations for legacy ESLint configs.

  • Improve API for creating custom groups

Related issues: #68, #66, #76

First of all, custom groups will be configured as an array, as priority will be important.

Also, when customizing custom groups, we will give an opportunity to address not only the value, but also the key. I think it will look like this:

// eslint.config.js
import { perfectionist } from 'eslint-plugin-perfectionist'

export default [
  perfectionist({
    // ...
    rules: {
      'sort-imports': {
        'custom-groups': [
          {
            name: 'side-effect-prepare-scripts',
            test: ({ key, value }) => key === null && /^prepare/.test(value)
          },
          {
            name: 'sass',
            test: ({ value }) => value.endsWith('.sass') || value.endsWith('.scss')
          },
          {
            name: 'component-library',
            test: /^@my-company\//
          },
        ],
      },
    },
  }),
]
  • Discard minimatch library in favor of regular expressions

I think there is no point in adding this dependency and we can make do with regular expressions.

  • TypeScript types

See: eslint-types/eslint-define-config#238, eslint-types/eslint-define-config#202

Support ESLint Define Config types

  • Add sort-intersection-types rule

Related issue: #84

  • New documentation website

I would like to create a new website with plugin documentation. I think this site will be written using Astro.

We also plan to add interactive examples of how to use the plugin.

Probably the site will be multilingual.

  • Move to TypeScript ESLint v7

typescript-eslint/typescript-eslint#8346


I would be very happy for you to send your ideas or participate in the discussion of ideas above. Perhaps you have thoughts on how to improve the plugin API and make it more convenient.

Perhaps you have encountered some problems when using the plugin.

@azat-io azat-io added the enhancement New feature or request label Nov 24, 2023
@azat-io azat-io pinned this issue Nov 25, 2023
@Muratovnik
Copy link

Great plugin and thanks for your hard work! Are there any updates about version 3.0?

@azat-io
Copy link
Owner Author

azat-io commented Dec 14, 2023

@Muratovnik Thanks! Work in progress, don't know on release date yet.

@eagerestwolf
Copy link

If I could also ask a favor with the next release. So few plugin authors do this, but could you ship type declarations as well. eslint-stylistic does and it's a godsend. It would make it much easier for writing configs using TS, no need to declare a ton of modules.

@azat-io
Copy link
Owner Author

azat-io commented Dec 16, 2023

@eagerestwolf Yes, I was planning on doing that! Do you use eslint-ts-patch in your projects?

@eagerestwolf
Copy link

@azat-io I do not. I actually have a shared config that I use with an eslint.config.js, although I do ship types with it for VSCode IntelliSense. I'm just currently in the process of dropping prettier and eslint-plugin-import in favor of @eslint-stylistic and this plugin, and I'm also rewriting the config using Typescript and functions instead of plain FlatConfig objects, similar to the rewrite you are working on (and @eslint-stylistic supports).

@TheElegantCoding
Copy link

+1 there are still some issues with the types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants