Open JounQin opened 2 years ago
Besides, how to comment without a new line?
Besides, how to comment without a new line?
I think currently inline comment at the end of line is supported, see https://github.com/lsdsjy/prettier-plugin-stylus/blob/main/tests/comment/comment.styl#L2 for an example.
@lsdsjy
shadow(offset-x, args...) // prettier-ignore
box-shadow offset-x args
margin-top offset-x
results
$ stylelint . --cache -f verbose
undefined
error Command failed with exit code 1
shadow(offset-x, args...) { // prettier-ignore
box-shadow offset-x args
margin-top offset-x
}
results:
tests/test.styl
7:1 ✖ Expected 'pythonic' (i.e. indentation-based) stylus/pythonic
7:15 ✖ Replace "...)·{" with ")⏎·" prettier/prettier
9:10 ✖ Delete "⏎}" prettier/prettier
1 source checked
/Users/JounQin/Workspaces/GitHub/configs/tests/test.styl
3 problems found
severity level "error": 3
stylus/pythonic: 1
prettier/prettier: 2
I think we should come up with a specification of prettier-ignore
comments first.
Prettier says A JavaScript comment of // prettier-ignore will exclude the next node in the abstract syntax tree from formatting.
, while it says nothing in the CSS section. If we follow the same definition for JavaScript, then your example is fine because it just ignores the box-shadow ...
declaration.
(I tried Prettier playground for CSS and it seems to follow the same definition.)
If we agree to follow the same definition as described above, I will try to implement it.
@lsdsjy I think you're right here, // prettier-ignore
is for next node, not inline comment.
So there is never comment without new line.