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

Add declaration-block-no-redundant-longhand-properties autofix #3304

Closed
imvetri opened this issue May 11, 2018 · 4 comments · Fixed by #6580
Closed

Add declaration-block-no-redundant-longhand-properties autofix #3304

imvetri opened this issue May 11, 2018 · 4 comments · Fixed by #6580
Assignees
Labels
good first issue is good for newcomers status: wip is being worked on by someone type: new autofix a new autofix for an existing rule

Comments

@imvetri
Copy link

imvetri commented May 11, 2018

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

stylelint --fix should convert redundant longhand properties to shorthand

Which rule, if any, is this issue related to?

declaration-block-no-redundant-longhand-properties

What CSS is needed to reproduce this issue?

Following will throw error

  a {
    padding-top: 1px;
    padding-right: 2px;
    padding-bottom: 3px;
    padding-left: 4px; 
}

What stylelint configuration is needed to reproduce this issue?

e.g.

{
  "rules": {
    "declaration-block-no-redundant-longhand-properties": [true, {
        "severity": "warning"
    }],
  }
}

Which version of stylelint are you using?

e.g. 9.2.0

How are you running stylelint: CLI, PostCSS plugin, Node API?

This should work despite the method chose to run stylelint

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

No

What did you expect to happen?

  a {
    padding-top: 1px;
    padding-right: 2px;
    padding-bottom: 3px;
    padding-left: 4px; 
}

should convert above to following

a {
  padding: 1px 2px 3px 4px;
}

What actually happened (e.g. what warnings or errors you are getting)?

No fix currently available

Further notes: Currently this is being discussed in #3068. But that has lot of other rules, so creating a separate one for this rule in case I could write a fix.

@jeddy3 jeddy3 changed the title Add an option to fix declaration-block-no-redundant-longhand-properties rules Add auto to declaration-block-no-redundant-longhand-properties May 16, 2018
@jeddy3 jeddy3 added good first issue is good for newcomers greenkeeper type: new autofix a new autofix for an existing rule labels May 16, 2018
@jeddy3
Copy link
Member

jeddy3 commented May 16, 2018

Currently this is being discussed in #3068.

I've removed this rule from the list in that issue.

But that has lot of other rules, so creating a separate one for this rule in case I could write a fix.

Good idea. Good luck writing the fix too!

@jeddy3 jeddy3 changed the title Add auto to declaration-block-no-redundant-longhand-properties Add autofix to declaration-block-no-redundant-longhand-properties May 16, 2018
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone and removed greenkeeper labels Jun 4, 2018
@jeddy3 jeddy3 changed the title Add autofix to declaration-block-no-redundant-longhand-properties Add declaration-block-no-redundant-longhand-properties autofix Dec 1, 2022
@mattxwang
Copy link
Member

I know #3326 was closed due to inactivity; is there still interest in writing this autofix? I maintain just-the-docs, and we embarrassingly made a mistake manually fixing this rule (just-the-docs/just-the-docs#1123 and just-the-docs/just-the-docs#1104).

If so, I'd be happy to take a stab at implementing it. I can first base my solution off of @imvetri's existing PR (#3326), unless there have been any developments in utilities/blueprints since then that would make more sense to look at?

@imvetri
Copy link
Author

imvetri commented Jan 9, 2023

@mattxwang can you confirm if you are also facing the same issue I reported in this comment #3326 (comment)

I didn't continue because I was clueless why I was getting inconsistent evaluation value (I had a suspect on the runner than on my code). feel free to tag me if you also face the same issue.

@mattxwang
Copy link
Member

mattxwang commented Jan 17, 2023

Hey @imvetri, I'm not able to reproduce the flakiness of context.fix - after doing the bare minimum to context.fix to work (add the argument, add meta.fixable, docs, etc.), I can check for context.fix and it's seen by the rule.\

Edit: see #6580

@jeddy3 jeddy3 added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone labels Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue is good for newcomers status: wip is being worked on by someone type: new autofix a new autofix for an existing rule
Development

Successfully merging a pull request may close this issue.

4 participants