Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upThe "no-irregular-whitespace" rule prevents proper typography in comments outside English. #430
Comments
This comment has been minimized.
This comment has been minimized.
One very nice thing is that you can search your codebase for the definition of the function by searching for Can you show an example of something that breaks? The following works for me: // hello ; world |
This comment has been minimized.
This comment has been minimized.
|
@LinusU I think he's discussing special whitespace, like the non-breaking space character. |
feross
added
the
question
label
Feb 19, 2016
This comment has been minimized.
This comment has been minimized.
In actual code comments, there's no issue because you explicitly control where the line breaks happen. I assume you're referring to annotated source a la underscore. I think you can fix this trivially with a regular expression after you generate the docs. That would allow us to keep this helpful rule in place for the 99.99% of cases where it actually catches issues. |
This comment has been minimized.
This comment has been minimized.
|
I'm a little surprised that this rule does not allow it in comments. Especially since its mentioned in the source: https://github.com/eslint/eslint/blob/master/lib/rules/no-irregular-whitespace.js#L2 In the meantime, its possible to disable it in individual files by putting this at the top: /*eslint-disable no-irregular-whitespace*/Will this work for you? |
This comment has been minimized.
This comment has been minimized.
|
Hey Dan, Indeed the source says so, but if you look closely, they strip in-string Will send a PR upstream. Thanks for your time! On Mon, Feb 22, 2016, at 05:07, Dan Flettre wrote:
Christophe Porteneuve Links: |
This comment has been minimized.
This comment has been minimized.
|
FYI, this is in eslint/eslint#5367 |
tdd
closed this
Feb 22, 2016
This comment has been minimized.
This comment has been minimized.
|
Thanks @tdd! |
This comment has been minimized.
This comment has been minimized.
|
Hey @Flet, @feross and team. So this got dealt with in eslint/eslint#5367, which is on track for inclusion in the next ESLint release. However, to avoid making it a breaking change, it's subjected to a When ESLint releases a new version with that option in, I would like to make a PR here to use the latest ESLint and turn this option on for the rule. Does that sound good to you? |
tdd
reopened this
Mar 2, 2017
This comment has been minimized.
This comment has been minimized.
|
Hey @feross, following up on our discussion on Twitter, we hadn't closed the loop on this: I had done the work upstream in ESLint to make the rule accept an option for this ( I believe it would be great if Standard would default to adding See the issue I still get with 9.0 on a simple code with proper-French commenting: Best, |
feross
added
enhancement
and removed
question
labels
Mar 2, 2017
feross
added this to the
standard v11 milestone
Mar 2, 2017
This comment has been minimized.
This comment has been minimized.
|
Sounds good, I added this to the v11 milestone. |

tdd commentedFeb 19, 2016
Hey there,
So I moved to Standard, and am advocating it. It finally got me to jump ship on semicolons, and I use this despite the "space before function decl/expr opening parens" rule, which I find fugly.
So thanks a ton for this cool tool!
But… The
no-irregular-whitespacerule is messing with my comments. I'm a trainer among other things, and many of my codebases are for teaching purposes, with my audience being mostly French. In French, double punctuation marks (;,:,!and?) take a non-breakable space before them. French quotes («and») also use such spaces inside them.But because of this rule, I can't use such spaces in my comment texts. So either I collapse these spaces, which looks and feels very weird to any French reader, or I use regular spaces, with the virtual guarantee that at least some of these will get wrapped at the beginning of lines in annotated code, looking terrible.
Isn't there a way to relax this rule for comment text? I can't find this relaxing mode in ESLint, but perhaps you know of a way? I get the rule inside code (and btw, it's relaxed within String literals), but inside comments? Who gives a damn?
Best,