ESLint plugin to disallow document.write() and document.writeln().
$ npm install --save-dev eslint eslint-plugin-document-writeor
$ yarn add --dev eslint eslint-plugin-document-writeLike other ESLint plugins,
- add
document-write/no-document-writein therules. - add
"document-write"in theplugins.
{
// ...
"rules": {
"document-write/no-document-write": "error"
},
"plugins": [ "document-write" ]
}There are a lot of limitation in document.write() and document.writeln() in recent browsers.
For example, you cannot use document.write() and document.writeln()in deferred (<script defer ...>) and asynchronous (<script async ...>) scripts.
See MDN for other limitations.