eslint-plugin-turbolinks-event-handling
ESLint plugin to avoid registering vanilla or jquery event listeners multiple times when using turbolinks
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-turbolinks-event-handling
:
$ npm install eslint-plugin-turbolinks-event-handling --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-turbolinks-event-handling
globally.
Usage
Add turbolinks-event-handling
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"turbolinks-event-handling"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"turbolinks-event-handling/jquery-off-before-on": 2,
"turbolinks-event-handling/jquery-use-event-namespaces": 2,
"turbolinks-event-handling/vanilla-addeventlistener-needs-function-reference": 2
}
}