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

docs: Update no-irregular-whitespace and fix examples #17626

Merged
merged 1 commit into from Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/src/_data/further_reading_links.json
Expand Up @@ -740,5 +740,12 @@
"logo": "https://v8.dev/favicon.ico",
"title": "RegExp v flag with set notation and properties of strings · V8",
"description": "The new RegExp `v` flag enables `unicodeSets` mode, unlocking support for extended character classes, including Unicode properties of strings, set notation, and improved case-insensitive matching."
},
"https://codepoints.net/U+1680": {
"domain": "codepoints.net",
"url": "https://codepoints.net/U+1680",
"logo": "https://codepoints.net/favicon.ico",
"title": "U+1680 OGHAM SPACE MARK:   – Unicode – Codepoints",
"description": " , codepoint U+1680 OGHAM SPACE MARK in Unicode, is located in the block “Ogham”. It belongs to the Ogham script and is a Space Separator."
}
}
19 changes: 13 additions & 6 deletions docs/src/rules/no-irregular-whitespace.md
Expand Up @@ -4,6 +4,7 @@ rule_type: problem
further_reading:
- https://es5.github.io/#x7.2
- https://web.archive.org/web/20200414142829/http://timelessrepo.com/json-isnt-a-javascript-subset
- https://codepoints.net/U+1680
---


Expand All @@ -16,11 +17,17 @@ A simple fix for this problem could be to rewrite the offending line from scratc

Known issues these spaces cause:

* Ogham Space Mark
* Is a valid token separator, but is rendered as a visible glyph in most typefaces, which may be misleading in source code.
* Mongolian Vowel Separator
* Is no longer considered a space separator since Unicode 6.3. It will result in a syntax error in current parsers when used in place of a regular token separator.
* Line Separator and Paragraph Separator
* These have always been valid whitespace characters and line terminators, but were considered illegal in string literals prior to ECMAScript 2019.
* Zero Width Space
* Is NOT considered a separator for tokens and is often parsed as an `Unexpected token ILLEGAL`
* Is NOT shown in modern browsers making code repository software expected to resolve the visualization
* Line Separator
* Is NOT a valid character within JSON which would cause parse errors
* Is NOT considered a separator for tokens and is often parsed as an `Unexpected token ILLEGAL`.
* Is NOT shown in modern browsers making code repository software expected to resolve the visualization.

In JSON, none of the characters listed as irregular whitespace by this rule may appear outside of a string.

## Rule Details

Expand Down Expand Up @@ -86,7 +93,7 @@ var thing = function /*<NBSP>*/(){
return 'test';
}

var thing = function/*<MVS>*/(){
var thing = function/*<Ogham Space Mark>*/(){
return 'test';
}

Expand Down Expand Up @@ -204,7 +211,7 @@ Examples of additional **correct** code for this rule with the `{ "skipJSXText":
/*eslint-env es6*/

function Thing() {
return <div>text in <NBSP>JSX</div>;
return <div>text in JSX</div>; // <NBSP> before `JSX`
}
```

Expand Down