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

Fix overrides.extends order when including same rules #6658

Closed
kuoruan opened this issue Feb 14, 2023 · 3 comments · Fixed by #6660
Closed

Fix overrides.extends order when including same rules #6658

kuoruan opened this issue Feb 14, 2023 · 3 comments · Fixed by #6660
Labels
status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule

Comments

@kuoruan
Copy link
Contributor

kuoruan commented Feb 14, 2023

What steps are needed to reproduce the bug?

#6380 changes the behaviour of overrides.extends @jasikpark

In following config file, ./a is the last item, it should in the last of the merge array.

But in the pull request

if (b.extends) {
extendsMerger.extends = [...new Set(extendsMerger.extends.concat(b.extends))];
}

./a in first extends is used.

What Stylelint configuration is needed to reproduce the bug?

modules.export = {
  extends: ["./a", "./b"],
  overrides: [
    {
      files: ["*.module.css"],
      extends: ["./c", "./b", "./a"]
    }
  ]
}

How did you run Stylelint?

none

Which version of Stylelint are you using?

15.1.0

What did you expect to happen?

overrides.extends work as expect

What actually happened?

see previous

Does the bug relate to non-standard syntax?

No response

Proposal to fix the bug

No response

@ybiquitous ybiquitous added the status: needs discussion triage needs further discussion label Feb 14, 2023
@ybiquitous
Copy link
Member

@kuoruan Thanks for the report with the template. As you said, it seems overrides.extends should precede over `extends.

But, at the same time, this seems an edge case. Could you tell us your specific situation when you found a behavior, please? If possible, it would be so appreciated if you could provide a minimal repository for the reproduction.

@kuoruan
Copy link
Contributor Author

kuoruan commented Feb 14, 2023

@ybiquitous
Copy link
Member

@kuoruan Thanks for sharing the demo. I understand your pain.

We expect selector-class-pattern should have a custom message defined in ./rules/base.js, but actually it has not:

$ npx stylelint --print-config .stylelintrc.js | grep -A3 'selector-class-pattern'
    "selector-class-pattern": [
      "^([a-z][a-z0-9]*)((-|--|__)[a-z0-9]+)*$",
      {}
    ],
$ npx stylelint src/main.scss

src/main.scss
 1:1  ✖  Expected class selector ".c__a-b" to be kebab-case  selector-class-pattern

1 problem (1 error, 0 warnings)

I've labeled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

@ybiquitous ybiquitous added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule and removed status: needs discussion triage needs further discussion labels Feb 14, 2023
@ybiquitous ybiquitous changed the title The new overrides.extends not work as expect Fix overrides.extends order Feb 14, 2023
@ybiquitous ybiquitous changed the title Fix overrides.extends order Fix overrides.extends order when including same rules Feb 14, 2023
kuoruan added a commit to kuoruan/stylelint that referenced this issue Feb 14, 2023
kuoruan added a commit to kuoruan/stylelint that referenced this issue Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

2 participants