-
-
Notifications
You must be signed in to change notification settings - Fork 928
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 stylelint-disable commands support to autofix #2643
Comments
I think it is bug, should be respected by default. |
I think it also ignore |
I know why I have no idea what to do with |
@hudochenkov maybe create util |
I came up to another problem. Disabled ranges assigned before file linted/fixed. For rules which altered lines (change empty lines, add line endings), disabled ranges might be incorrect after few fixes. Even after fixes within one rule. This problem affects every rule. Because if user has rule with fixing which changes lines, then every rule after this rule will have incorrect disabled ranges. |
@hudochenkov Thanks for digging deeper. I suspect there are going to be some significant hurdles to overcome with this issue. As such, I suggest we push on with |
Agree. We should not close this issue, to not forget about this problem.
I think we should add a note somewhere about this caveat. And suggested strategy: if user is using |
@hudochenkov can we learn how it does |
@evilebottnawi of course we can. But I have a feeling that it won't help us, because of differences in architecture and approaches. Also I remember something from discussions, when we were discussing how to do autofixing. ESLint make multiple runs until everything is fixed and violations verified. And it also has some ranges for autofixing or something, that recalculated constantly. I might be mistaken about the last one. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Stylelint also fix-breaks calc() functions as it removes units of values that need it (see stylelint/stylelint#3037). It also auto-fixes it (and hence breaks it then): stylelint/stylelint#2643, so we have to disable the whole rule for now. In order to be able to add comments to the stylelint config I moved it to a .js file.
This comment was marked as off-topic.
This comment was marked as off-topic.
Respecting these comments is precisely what requires building the new suggested API to provides a fixer callback instead of running the fixing logic directly in the rule, so that the fixing logic could be run only when rules are not ignored. |
This issue is older than one month. Please ask before opening a pull request, as it may no longer be relevant. |
Iv refactored a rule to do just that.
is this issue ready to implement? |
@ybiquitous is this issue ready to be implemented? |
Yes, I think creating a PoC has no problem. We could evaluate this feature by the PoC. |
This comment was marked as spam.
This comment was marked as spam.
Sorry to be insistent, but I won't make the same mistake thrice. |
Yes, this is ready to implement. To clarify this problem, I just created a reproducible demo: a {
/* stylelint-disable */
width: 0px;
/* stylelint-enable */
height: 0px;
/* ^^ this "px" unit should be removed by autofix, but it isn't actually.
*/
} // .stylelintrc.json
{
"rules": {
"length-zero-no-unit": true
}
} |
I have a file that has
/* stylelint-disable */
/* stylelint-enable */
wrapped around it but when using--fix
it tries to format this file and breaks it quite bad.--fix
Before
After
A few of the issues:
;;
onL38
;
onL92
(I imagine this is where the;;
comes fromConfig
The config is pretty huge but i don't think it's the problem here
7.11.0
CLI through
lint-staged
alpha-value-notation
at-rule-empty-line-before
at-rule-no-vendor-prefix
color-function-notation
color-hex-length
comment-empty-line-before
comment-whitespace-inside
custom-property-empty-line-before
declaration-block-no-duplicate-properties
declaration-block-no-redundant-longhand-properties
declaration-empty-line-before
font-family-name-quotes
font-weight-notation
function-calc-no-unspaced-operator
function-name-case
function-url-quotes
hue-degree-notation
import-notation
keyframe-selector-notation
length-zero-no-unit
lightness-notation
media-feature-name-no-vendor-prefix
media-feature-range-notation
property-no-vendor-prefix
rule-empty-line-before
selector-attribute-quotes
selector-no-vendor-prefix
selector-not-notation
selector-pseudo-element-colon-notation
selector-type-case
shorthand-property-no-redundant-values
value-keyword-case
value-no-vendor-prefix
The text was updated successfully, but these errors were encountered: