ESLint plugin to disallow document.write[ln]()
npm install eslint-plugin-document-writeESLint plugin to disallow document.write() and document.writeln().
``bash`
$ npm install --save-dev eslint eslint-plugin-document-write
or
`bash`
$ yarn add --dev eslint eslint-plugin-document-write
Like other ESLint plugins,
- add document-write/no-document-write in the rules."document-write"
- add in the plugins.
`json`
{
// ...
"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.document.write()
For example, you cannot use and document.writeln()in deferred (