Several rules to discover direct and indirect usages of the DOMContentLoaded event.
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install @atlassian/eslint-plugin-onready-checks
:
$ npm install @atlassian/eslint-plugin-onready-checks --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install @atlassian/eslint-plugin-onready-checks
globally.
Add onready-checks
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["@atlassian/onready-checks"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"onready-checks/rule-name": 2
}
}
-
no-ajs-toinit
- Checks for use of theAJS.toInit
function -
no-domcontentloaded-handlers
- Checks for direct use of theDOMContentLoaded
event -
no-jquery-onready
- Checks for use of theDOMContentLoaded
event via jQuery's onReady handling