how can i turn the following alert into an acceptable alert for ESLint?
svg.onerror = function() {
alert("File cannot be loaded");
};
My build fails because apparently i cant use "alert". I want to call this alert when there is an issue loading something. This code works successfully but it does not comply with ESLint.
http://eslint.org/docs/rules/no-alert
how can i modify my code to make it build successfully?
thanks in advance :)
If you think you have a good reason for not observing an eslint setting, then you can disable that specific rule for that specific line by specifying eslint-disable-line
in a comment on the offending line, like so:
svg.onerror = function() {
alert("File cannot be loaded"); // eslint-disable-line no-alert
};
A better solution might be to implement a modal or show an error to the user in another less-intrusive way (eg: toggle visibility of an error element, or use something like Bootstrap's modal).