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 fixed field to Result object #4664

Open
audunolsen opened this issue Mar 30, 2020 · 3 comments
Open

Add fixed field to Result object #4664

audunolsen opened this issue Mar 30, 2020 · 3 comments
Labels
status: ask to implement ask before implementing as may no longer be relevant type: enhancement a new feature that isn't related to rules

Comments

@audunolsen
Copy link

What is the problem you're trying to solve?

Fix option makes me lazy and doesn't help me become a better coder, because I cannot
see what I did wrong. I want stylelint to raise my awareness of good styling practises while simultaneously speeding up my productivity.

What solution would you like to see?

A fixed field in the result object, or alternatively have each warnings-entry have a "fixed" key.

This would allow me to have logs which may look like

_colors.sass
⚠ 4:7 Expected single space before "{" [fixed]
✖︎ 7:9 Expected a trailing semicolon    [fixed]
@audunolsen audunolsen changed the title result object should inlcude a "fixed" field Result object should inlcude a "fixed" field Mar 30, 2020
@audunolsen
Copy link
Author

Here's a workaround for people interested, only drawback is that it call's the linter two times on the same file/code.

let [
  {results : [{warnings}]},
  {results : [{warnings: afterFix}]}    
] = await Promise.all([
  lint(options),
  lint(Object.assign(options, {fix: true}))
]);
    
for (entry of warnings) if (!afterFix
  .map(e => JSON.stringify(e))
  .includes(JSON.stringify(entry))
) entry.fixed = true;

Screenshot 2020-03-31 04 15 37

@jeddy3 jeddy3 changed the title Result object should inlcude a "fixed" field Include fixed field in Result object Apr 4, 2020
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: enhancement a new feature that isn't related to rules labels Apr 4, 2020
@jeddy3
Copy link
Member

jeddy3 commented Apr 4, 2020

@audunolsen Thanks for the request, outlining your use case and using the template.

I didn't think is architecturally achievable right now, but that may change when we revisit the way rules report their fixable violations to address #4203 and #2643. That is a sizeable piece of work that no one has found time to tackle yet.

I'll label this issue as an enhancement. It is also linked to those issues so that, hopefully, any solution to them will also factor in this use case.

@jeddy3 jeddy3 changed the title Include fixed field in Result object Add fixed field to Result object Jan 19, 2022
Copy link
Contributor

This issue is older than one month. Please ask before opening a pull request, as it may no longer be relevant.

@github-actions github-actions bot added status: ask to implement ask before implementing as may no longer be relevant and removed status: ready to implement is ready to be worked on by someone labels Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ask to implement ask before implementing as may no longer be relevant type: enhancement a new feature that isn't related to rules
Development

No branches or pull requests

2 participants