eslint-plugin-perfectionist icon indicating copy to clipboard operation
eslint-plugin-perfectionist copied to clipboard

Feature: implement ignore-pattern based on word before, not object name

Open rtatarinov opened this issue 10 months ago • 0 comments

What rule do you want to change?

ignore-inline-pattern

Describe the problem

I have the following problem. When I use for example effector library (store managment) I have a strict order in the specific cases. For example:

import { sample } from "effector";

sample({
      clock: event,
      source: $store,
      filter: isNotNil,
      fn: (sourceData => sourceData.id,
      target: effectFx,
});

This is a right ordering in the sample operator from effector. But it conflicts with asc ordering from sort-objects The library allows to ignore-pattern for any object with specific name/file name. But I don't use name at all. So, the following implementation doesn't work:

"perfectionist/sort-objects": [
       "error",
        {
             "order": "asc",
             "type": "natural",
             "ignore-pattern": ["sample(*"]
        }
  ],

Proposal Implement inline code cheching by regex to check symbol by symbol string and exclude anything matches the specific pattern

Code example

"perfectionist/sort-objects": [
            "error",
            {
                "order": "asc",
                "type": "natural",
                "ignore-inline-pattern": ["sample(*"]
            }
],

Additional comments

No response

Validations

  • [X] Read the docs.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

rtatarinov avatar Apr 25 '24 09:04 rtatarinov