0.0.5 • Published 2 months ago

eslint-plugin-event v0.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

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.

0.0.5

2 months ago

0.0.4

2 months ago

0.0.3

4 months ago

0.0.2

5 months ago

0.0.1

5 months ago