no-irregular-whitespace
eslint
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"no-irregular-whitespace": "error",
},
},
];const thing = function() /*<NBSP>*/{
return 'test';
}
const foo = function( /*<NBSP>*/){
return 'test';
}
const bar = function /*<NBSP>*/(){
return 'test';
}
const baz = function /*<Ogham Space Mark>*/(){
return 'test';
}
const qux = function() {
return 'test'; /*<ENSP>*/
}
const quux = function() {
return 'test'; /*<NBSP>*/
}
const item = function() {
// Description <NBSP>: some descriptive text
}
/*
Description <NBSP>: some descriptive text
*/
// …const thing = function() {
return ' <NBSP>thing';
}
const foo = function() {
return '<ZWSP>thing';
}
const bar = function() {
return 'th <NBSP>ing';
}function thing() {
// Description <NBSP>: some descriptive text
}
/*
Description <NBSP>: some descriptive text
*/function thing() {
return / <NBSP>regexp/;
}Examples from the ESLint documentation.
no-irregular-whitespace
eslint
export default [
{
rules: {
"no-irregular-whitespace": "error",
},
},
];no-irregular-whitespace
eslint plugin · correctness
{
"rules": {
"no-irregular-whitespace": "error"
}
}suspicious/noIrregularWhitespace
suspicious · since 1.9.0
{
"linter": {
"rules": {
"suspicious": {
"noIrregularWhitespace": "error"
}
}
}
}Disallow irregular whitespace in .vue files
Disallow this/super before calling super() in constructors
Disallow negating the left operand of relational operators
Disallow unnecessary boolean casts
Disallow using an async function as a Promise executor