eslint-plugin-richlab
An ESLint plugin created by RichLab.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-richlab
:
$ npm install eslint-plugin-richlab --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-richlab
globally.
Usage
Add richlab
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
Then configure the rules you want to use under the rules section.
Supported Rules
avoid-ios9-viewport-bug
window.innerWidth
and window.innerHeight
may have unexpected value in iOS9
Mobile Saferi because the bug.
This rule resticts to use window.innerWidth
and window.innerHeight
and
recommends to use document.documentElement.clientWidth
or document.Element.clientHeight
instead of that properties.
var innerWidth = windowinnerWidth; // errorvar innerHeight = windowinnerHeight; // error var innerWidth = documentdocumentElementclientWidth; // not errorvar innerHeight = documentdocumentElementclientHeight; // not error