https://github.com/phanect/eslint-plugin-document-write
ESLint plugin to disallow document.write() and document.writeln()
https://github.com/phanect/eslint-plugin-document-write
Last synced: 3 months ago
JSON representation
ESLint plugin to disallow document.write() and document.writeln()
- Host: GitHub
- URL: https://github.com/phanect/eslint-plugin-document-write
- Owner: phanect
- License: mit
- Created: 2020-03-15T04:58:06.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-10-23T06:23:58.000Z (over 4 years ago)
- Last Synced: 2025-10-04T09:32:20.583Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-document-write
ESLint plugin to disallow `document.write()` and `document.writeln()`.
## Install
```bash
$ npm install --save-dev eslint eslint-plugin-document-write
```
or
```bash
$ yarn add --dev eslint eslint-plugin-document-write
```
## Usage
Like other ESLint plugins,
- add `document-write/no-document-write` in the `rules`.
- add `"document-write"` in the `plugins`.
```json
{
// ...
"rules": {
"document-write/no-document-write": "error"
},
"plugins": [ "document-write" ]
}
```
## Why
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 (``) and asynchronous (`<script async ...>`) scripts.
See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/write#Notes) for other limitations.
## License
[MIT](http://vjpr.mit-license.org)