Disallows the .size
method. Prefer .length
.
📋 This rule is enabled in plugin:no-jquery/deprecated-1.8
.
📋 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.
❌ Examples of incorrect code:
$( 'div' ).size();
$div.size();
$( 'div' ).first().size();
$( 'div' ).append( $( 'input' ).size() );
✔️ Examples of correct code:
size();
[].size();
div.size();
div.size;
🔧 Examples of code fixed by this rule:
$( 'div' ).size(); /* → */ $( 'div' ).length;
$div.size(); /* → */ $div.length;
$( 'div' ).first().size(); /* → */ $( 'div' ).first().length;
$( 'div' ).append( $( 'input' ).size() ); /* → */ $( 'div' ).append( $( 'input' ).length );