Skip to content

feat: add no-multiple-whitespace rule#370

Open
Ericlm wants to merge 5 commits into
francoismassart:v3from
Ericlm:master
Open

feat: add no-multiple-whitespace rule#370
Ericlm wants to merge 5 commits into
francoismassart:v3from
Ericlm:master

Conversation

@Ericlm

@Ericlm Ericlm commented Oct 26, 2024

Copy link
Copy Markdown

Whitespace automatic removal

Description

This PR implements a new rule called no-multiple-whitespace which removes unnecessary whitespaces between classes.

Closes #263

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) -> maybe, if added to the default configuration
  • This change requires a documentation update

How Has This Been Tested?

I added a corresponding no-multiple-whitespace test file.

Test Configuration:

  • OS + version: macOS 15.0.1 (24A348)
  • NPM version: 10.8.3
  • Node version: 22.6.0

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@akaGooddevil

Copy link
Copy Markdown

Hello @Ericlm, thanks for this patch. It seems working; any plans to release it?

@Ericlm Ericlm marked this pull request as ready for review December 13, 2024 17:35
@forfalsket

Copy link
Copy Markdown

Any updates on this? would be nice to have 😄

@Ericlm

Ericlm commented Jan 7, 2025

Copy link
Copy Markdown
Author

@francoismassart What do you think of this rule?

@YoussefNassar

Copy link
Copy Markdown

This rule is needed. can't wait :)

@Omar-Elmassry

Copy link
Copy Markdown

very needed rule thanks for your efforts @Ericlm
any plans on merging this pr ? @francoismassart

@francoismassart

Copy link
Copy Markdown
Owner

Hi,
there is one issue with this feature: it will return false positive on multines usages such as with ctl calls...

e.g.

ctl(`
  sm:w-6
  w-8
  container
  w-12
  flex
  lg:w-4
`);

Maybe you should detect if the current classlist contains new lines or carriages return and handle theses cases.

@Ericlm

Ericlm commented Jan 18, 2025

Copy link
Copy Markdown
Author

Maybe you should detect if the current classlist contains new lines or carriages return and handle theses cases.

I handled the case by returning if the classNames contains any line break/carriage return. It won't remove spaces around classes in this syntax, as it may contains leading whitespaces. At best, it could remove trailing whitespaces I think. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Automatic whitespace removal

7 participants