stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Fix use of unicode symbols in formatters for native Windows cmd

Open XhmikosR opened this issue 4 years ago • 7 comments

What steps are needed to reproduce the bug?

  1. Run stylelint on Windows 10 native cmd (haven't tried 11)

What Stylelint configuration is needed to reproduce the bug?

Doesn't matter as long as you get an error or one of the symbols here:

https://github.com/stylelint/stylelint/blob/e3615618321833fe4b0b57c065416da977c87def/lib/formatters/stringFormatter.mjs#L34-L39

How did you run Stylelint?

stylelint "**/*.{css,scss}" --cache --cache-location .cache/.stylelintcache --rd

Which version of Stylelint are you using?

14.1.0

What did you expect to happen?

The characters should show properly

What actually happened?

image

Does the bug relate to non-standard syntax?

No response

Proposal to fix the bug

No response

XhmikosR avatar Nov 25 '21 20:11 XhmikosR

@XhmikosR Thank you for creating this issue. This limitation has been introduced by the log-symbols package refactoring (PR #5562).

A solution is adding the fallback symbols like log-symbols does:

https://github.com/sindresorhus/log-symbols/blob/6aea9853e1fb85a437f868d0ef400ce122c08c1d/index.js#L11-L16

but the is-unicode-supported logic also seems necessary for adding the fallback. (is-unicode-supported is pure ESM... 😓 )

Do you have any thoughts?

ybiquitous avatar Nov 26 '21 00:11 ybiquitous

Not sure TBH. I'd use an existent package, personally, even if it's an older version.

That being said, it seems someone wrongfully ignored the failures on Windows 😛: https://github.com/stylelint/stylelint/blob/main/lib/formatters/tests/prepareFormatterOutput.js

These failures there were valid and it's the same reason for this issue.

XhmikosR avatar Nov 26 '21 12:11 XhmikosR

I'm not sure about Windows, but how many people use Stylint on the native cmd (not supporting Unicode)? Is it worth adding dependencies or logic?

Also, it seems good to fix lib/formatters/__tests__/prepareFormatterOutput.js if we could avoid CI failures for Windows.

ybiquitous avatar Nov 26 '21 16:11 ybiquitous

There would be no failures if the issue I reported didn't exist.

When something is broken, we shouldn't work around it in tests, but try to fix it instead.

XhmikosR avatar Nov 27 '21 07:11 XhmikosR

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

github-actions[bot] avatar Jan 22 '24 10:01 github-actions[bot]