noAlert
Ta treść nie jest jeszcze dostępna w Twoim języku.
Summary
Section titled “Summary”- Rule available since: 
v2.1.0 - Diagnostic Category: 
lint/suspicious/noAlert - This rule doesn’t have a fix.
 - The default severity of this rule is information.
 - Sources:
- Same as 
no-alert 
 - Same as 
 
How to configure
Section titled “How to configure”{  "linter": {    "rules": {      "suspicious": {        "noAlert": "error"      }    }  }}Description
Section titled “Description”Disallow the use of alert, confirm, and prompt.
JavaScript’s alert, confirm, and prompt functions are widely considered to be obtrusive
as UI elements and should be replaced by a more appropriate custom UI implementation.
Furthermore, alert is often used while debugging code, which should be removed before
deployment to production.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”alert("here!");code-block.js:1:1 lint/suspicious/noAlert ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ℹ Unexpected alert
  
  > 1 │ alert(“here!”);
      │ ^^^^^^^^^^^^^^
    2 │ 
  
  ℹ The alert function is considered to be obtrusive. Replace it with a custom UI implementation.
  
confirm("Are you sure?");code-block.js:1:1 lint/suspicious/noAlert ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ℹ Unexpected confirm
  
  > 1 │ confirm(“Are you sure?”);
      │ ^^^^^^^^^^^^^^^^^^^^^^^^
    2 │ 
  
  ℹ The confirm function is considered to be obtrusive. Replace it with a custom UI implementation.
  
prompt("What's your name?", "John Doe");code-block.js:1:1 lint/suspicious/noAlert ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ℹ Unexpected prompt
  
  > 1 │ prompt(“What’s your name?”, “John Doe”);
      │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 │ 
  
  ℹ The prompt function is considered to be obtrusive. Replace it with a custom UI implementation.
  
customAlert("Something happened!");customConfirm("Are you sure?");customPrompt("Who are you?");function foo() {    const alert = myCustomLib.customAlert;    alert();}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.