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

indentation rule needs multiple passes and never stabilize #6514

Closed
mvorisek opened this issue Dec 9, 2022 · 3 comments
Closed

indentation rule needs multiple passes and never stabilize #6514

mvorisek opened this issue Dec 9, 2022 · 3 comments
Labels
syntax: less relates to Less and Less-like syntax

Comments

@mvorisek
Copy link

mvorisek commented Dec 9, 2022

What steps are needed to reproduce the bug?

  1. checkout https://github.com/fomantic/Fomantic-UI/tree/5e12443467d77a71628731900d8fb27bffcb6739
  2. run yarn install
  3. run npx stylelint "**/*.{css,less}" --fix

What Stylelint configuration is needed to reproduce the bug?

only 1 rule indentation: 4

for complete config/packages, see fomantic/Fomantic-UI@5e12443 commit

How did you run Stylelint?

npx stylelint "**/*.{css,less}" --fix

Which version of Stylelint are you using?

latest / 14.16.0

What did you expect to happen?

indentation files in all files to 4 spaces and when stylelint is run for 2nd time, no file changes

What actually happened?

stylelint currently fixes one file line when in each block per --fix run (for example in src/definitions/collections/form.less file)

and in some files like src/definitions/collections/message.less it does add more spaces in each run even wrongly:

image

Does the bug relate to non-standard syntax?

yes, with LESS

Proposal to fix the bug

No response

@mvorisek mvorisek changed the title eslint needs multiple passes and never stabilize indentation rule needs multiple passes and never stabilize Dec 9, 2022
@jeddy3
Copy link
Member

jeddy3 commented Dec 10, 2022

@mvorisek Thanks for the report and for using the template.

indentation rule needs multiple passes and never stabilize

This is one of the reasons we'll be deprecating this rule in the next major release.

I recommend following the WIP migration guide, i.e. adopt Prettier alongside Stylelint. Stylelint will help you avoid errors and enforce (non-whitespace) conventions while Prettier will pretty-print the whitespace from the AST based on the length of each line.

Alternatively, if you want to continue using Stylelint for whitespace you can port the rule to the plugin and fix the bug there.

@mvorisek
Copy link
Author

One question - the src/definitions/collections/message.less problem I touched above turned out to be a bug corrupting the code.

see https://github.com/fomantic/Fomantic-UI/pull/2592/commits commits, /wo the 2nd commit when stylelint is run with --fix, the stylelint indentation rule was removing a colon

the fix on our side was to ignore the problematic line with stylelint-disable-line comment like fomantic/Fomantic-UI@c59da08#diff-bfa7b5eb95ceab9fa6ad897327d60daffa9ec42c14dfef4e62022933809a9a7aR38

can this issue receive an official bugfix?

@jeddy3
Copy link
Member

jeddy3 commented Dec 10, 2022

can this issue receive an official bugfix?

We've frozen the deprecated rules so that we can focus on standard CSS and modernising our codebase. The interplay between the indentation rule and the PostCSS Less custom syntax is non-trivial. You can port the rule to the plugin and try fixing the bug there, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syntax: less relates to Less and Less-like syntax
Development

No branches or pull requests

3 participants