Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1.16 KB

no-ready-shorthand.md

File metadata and controls

45 lines (34 loc) · 1.16 KB

no-ready-shorthand

Disallows the .ready method. Prefer $().

📋 This rule is enabled in plugin:no-jquery/deprecated-3.0.

📋 This rule is enabled in plugin:no-jquery/all.

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Rule details

❌ Examples of incorrect code:

$( document ).ready( fn );
$div.ready( fn );
$( 'div' ).first().ready( fn );
$( 'div' ).append( $( 'input' ).ready( fn ) );
$div = $( 'div' ).ready( fn );

✔️ Examples of correct code:

ready( fn );
[].ready( fn );
div.ready( fn );
div.ready;
$.ready( fn );
$( document ).on( 'ready', fn );
$( fn );

🔧 Examples of code fixed by this rule:

$( document ).ready( fn );      /* → */ $( fn );
$div.ready( fn );               /* → */ $( fn );
$( 'div' ).first().ready( fn ); /* → */ $( fn );

Resources