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 disableFix secondary option to configuration object #5431

Closed
kuangrs opened this issue Aug 3, 2021 · 3 comments · Fixed by #5460
Closed

Add disableFix secondary option to configuration object #5431

kuangrs opened this issue Aug 3, 2021 · 3 comments · Fixed by #5460
Labels
status: ready to implement is ready to be worked on by someone type: enhancement a new feature that isn't related to rules

Comments

@kuangrs
Copy link
Contributor

kuangrs commented Aug 3, 2021

What is the problem you're trying to solve?

Sometimes we need find error which should not be automatically fixed, or it was automatically fixed by mistake, instead, we want to fix it manually. So if closing autofix by passing property like disableFix in secondaryOptions will be very helpful

What solution would you like to see?

Add support for closing autofix by passing property like disableFix in secondaryOptions

in file lib/lintPostcssResult.js (stylelint version 13.13.1), line 105

fix:
stylelintOptions.fix &&
// Next two conditionals are temporary measures until #2643 is resolved
isFileFixCompatible &&
!postcssResult.stylelint.disabledRanges[ruleName],
change like this

ruleFunction(primaryOption, secondaryOptions, {
  fix:
      // Add support for closing autofix by passing property like `disableFix` in secondaryOptions
      !secondaryOptions.disableFix && 
      stylelintOptions.fix &&
      // Next two conditionals are temporary measures until #2643 is resolved
      isFileFixCompatible &&
      !postcssResult.stylelint.disabledRanges[ruleName],
   newline,
})(postcssRoot, postcssResult),
@jeddy3 jeddy3 added the status: needs clarification triage needs clarification from author label Aug 6, 2021
@jeddy3
Copy link
Member

jeddy3 commented Aug 6, 2021

@kuangrs Thanks for the request and for using the template.

Just to confirm, you'd like to disable autofix on a per rule basis, like the severity secondary option? If so, sounds good to me. We even suggest plugin authors do it.

@kuangrs
Copy link
Contributor Author

kuangrs commented Aug 9, 2021

@kuangrs Thanks for the request and for using the template.

Just to confirm, you'd like to disable autofix on a per rule basis, like the severity secondary option? If so, sounds good to me. We even suggest plugin authors do it.

yes, I'd like to use it like serverity.

@jeddy3 jeddy3 changed the title Add support for closing autofix by passing property like disableFix in secondaryOptions Add disableFix secondary option to configuration object Aug 10, 2021
@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 and removed status: needs clarification triage needs clarification from author labels Aug 10, 2021
@jeddy3
Copy link
Member

jeddy3 commented Aug 10, 2021

Thanks for confirming.

A new disableFix secondary option SGTM.

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

Please branch off v14 rather than master.

@kuangrs kuangrs mentioned this issue Sep 15, 2021
30 tasks
@ybiquitous ybiquitous linked a pull request Sep 15, 2021 that will close this issue
@kuangrs kuangrs closed this as completed Sep 18, 2021
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: enhancement a new feature that isn't related to rules
Development

Successfully merging a pull request may close this issue.

2 participants