ESLint plugin
This project is maintained by iliubinskii
ESLint plugin / no-restricted-syntax
Disallows AST syntax (an extended version of ESLint core rule).
module.exports = {
plugins: ["misc"],
rules: {
"misc/no-restricted-syntax": [
"error",
{
ignoreSelector: string | string[],
message: string,
replacement: string,
search: string,
selector: string | string[]
}
]
}
};
| Option | Description | Default | | :—– | :———- | :—— |
ignoreSelector |
Allowed AST elements (AST selectors) | [] |
message |
Custom message | - |
replacement |
Replacement | - |
search |
Search term for replacement (regular expression) | - |
selector |
Disallowed AST elements (AST selectors) | - |
/*
eslint misc/no-restricted-syntax: [
error,
{
selector: "Identifier",
ignoreSelector: "Identifier[name=y]",
}
]
*/
const x = 1;
/*
eslint misc/no-restricted-syntax: [
error,
{
selector: "Identifier",
ignoreSelector: "Identifier[name=y]",
}
]
*/
const y = 1;