no-alert
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-alert": "error",
},
},
];alert("here!");
confirm("Are you sure?");
prompt("What's your name?", "John Doe");customAlert("Something happened!");
customConfirm("Are you sure?");
customPrompt("Who are you?");
function foo() {
const alert = myCustomLib.customAlert;
alert();
}Examples from the ESLint documentation.
no-alert
eslint
export default [
{
rules: {
"no-alert": "error",
},
},
];no-alert
eslint plugin · restriction
{
"rules": {
"no-alert": "error"
}
}suspicious/noAlert
suspicious · since 2.1.0
{
"linter": {
"rules": {
"suspicious": {
"noAlert": "error"
}
}
}
}Disallow certain properties on certain objects
Enforce consistent brace style for all control statements
Disallow function declarations that contain unsafe references inside loop statements