Disallows the .data
/.removeData
/.hasData
methods and $.data
/$.removeData
/$.hasData
utilies. Prefer WeakMap
.
📋 This rule is enabled in plugin:no-jquery/all
.
❌ Examples of incorrect code:
$.data( elem, 'foo' );
$( 'div' ).data( 'foo', 'bar' );
$div.data( 'foo' );
$( 'div' ).first().data( 'foo', 'bar' );
$( 'div' ).append( $( 'input' ).data( 'foo' ) );
$.removeData( elem, 'foo' );
$( 'div' ).removeData( 'foo' );
$div.removeData( 'foo' );
$.hasData( elem );
✔️ Examples of correct code:
data();
[].data();
div.data();
div.data;
removeData();
[].removeData();
div.removeData();
div.removeData;
hasData();
[].hasData();
div.hasData();
div.hasData;