eslint-plugin-event
v0.0.5
Published
检查vue3中的监听事件
Downloads
8
Maintainers
Readme
eslint-plugin-event
Check the monitored events to see if they are unbound in the same file. It is still in the experimental stage, please use it carefully
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-event
:
npm install eslint-plugin-event --save-dev
Usage
Recommend
Add event
to the plugins section of your .eslintrc
configuration file.
{
extends: [
'plugin:eslint-plugin-event/recommended'
],
}
You can customize the rules you need.
// recommended
{
rules: {
"event/addEventListener-named-functions": "error",
"event/removeEventListener-named-functions": "error",
// "event/on-named-functions": "error",
"event/off-named-functions": "error",
"event/unbind-event": "error",
"event/listener-unbind-event": ["error", {'isVue3': true}],
"event/need-clear-timeout": "error",
"event/need-clear-interval": "error",
"event/disconnect-observer": "error",
"event/custom-event": [ "off",
{
eventsHandlers: [
{
listener: [ // api.[xxx]listener.on[xxxx]
{key: "api", type: 'equal', ignoreCase: false},
{key: "listener", type: 'suffix'},
{key: "on", type: 'prefix'},
],
dispose: {key: 'dispose|unbind', type: 'prefix'}
}
],
}
],
},
}
Rules
TODO: Run eslint-doc-generator to generate the rules list.