Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions demos/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"root": true,

"extends": "../ui/.eslintrc.json"
}
1 change: 1 addition & 0 deletions demos/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals window, document */
( function() {
"use strict";

// Find the script element
var scripts = document.getElementsByTagName( "script" );
Expand Down
9 changes: 3 additions & 6 deletions tests/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@
},

"rules": {
"strict": [ "error", "function" ],

// The following rule is relaxed due to too many violations:
"no-unused-vars": [ "error", { "vars": "all", "args": "after-used" } ],

// Too many violations:
"max-len": "off"
"max-len": "off",
"no-unused-vars": "off",
"strict": "off" // ideally, `[ "error", "function" ]`
},

"globals": {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/dialog/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ QUnit.test( "destroy", function( assert ) {
assert.equal( $( ".ui-widget-overlay" ).length, 0, "overlay does not exist" );
assert.equal( $( document ).data( "ui-dialog-overlays" ), undefined, "ui-dialog-overlays equals the number of open overlays" );

element = $( "#dialog1" ).dialog( { modal: true } ),
element = $( "#dialog1" ).dialog( { modal: true } );
element2 = $( "#dialog2" ).dialog( { modal: true } );
assert.equal( $( ".ui-widget-overlay" ).length, 2, "overlays created when dialogs are open" );
assert.equal( $( document ).data( "ui-dialog-overlays" ), 2, "ui-dialog-overlays equals the number of open overlays" );
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/droppable/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ QUnit.test( "element types", function( assert ) {
var typeName = typeNames[ i ],
el = $( document.createElement( typeName ) ).appendTo( "body" );

( typeName === "table" && el.append( "<tr><td>content</td></tr>" ) );
if ( typeName === "table" ) {
el.append( "<tr><td>content</td></tr>" );
}
el.droppable();
testHelper.shouldDrop( assert );
el.droppable( "destroy" );
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/droppable/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ QUnit.test( "enable", function( assert ) {
assert.equal( el.droppable( "option", "disabled" ), false, "disabled option setter" );
testHelper.shouldDrop( assert );

expected = $( "<div></div>" ).droppable(),
expected = $( "<div></div>" ).droppable();
actual = expected.droppable( "enable" );
assert.equal( actual, expected, "enable is chainable" );
} );
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/slider/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ QUnit.test( "mouse based interaction part two: when handles overlap", function(
start: function( event, ui ) {
assert.equal( handles.index( ui.handle ), 0, "leftmost handle activated when overlapping at maximum" );
}
} ),
handles = element.find( ".ui-slider-handle" );
} );
handles = element.find( ".ui-slider-handle" );
handles.eq( 0 ).simulate( "drag", { dx: -10 } );
element.slider( "destroy" );

element = $( "#slider1" )
.slider( {
values: [ 19, 20 ]
} ),
handles = element.find( ".ui-slider-handle" );
} );
handles = element.find( ".ui-slider-handle" );
handles.eq( 0 ).simulate( "drag", { dx: 10 } );
element.one( "slidestart", function( event, ui ) {
assert.equal( handles.index( ui.handle ), 0, "left handle activated if left was moved last" );
Expand All @@ -145,8 +145,8 @@ QUnit.test( "mouse based interaction part two: when handles overlap", function(
element = $( "#slider1" )
.slider( {
values: [ 19, 20 ]
} ),
handles = element.find( ".ui-slider-handle" );
} );
handles = element.find( ".ui-slider-handle" );
handles.eq( 1 ).simulate( "drag", { dx: -10 } );
element.one( "slidestart", function( event, ui ) {
assert.equal( handles.index( ui.handle ), 1, "right handle activated if right was moved last (#3467)" );
Expand All @@ -159,8 +159,8 @@ QUnit.test( "mouse based interaction part two: when handles overlap", function(
min: 0,
max: 100,
values: [ 0, 50 ]
} ),
handles = element.find( ".ui-slider-handle" );
} );
handles = element.find( ".ui-slider-handle" );

element.slider( "option", { values: [ 100, 100 ] } );
handles.eq( 0 ).simulate( "drag", { dx: -10 } );
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/sortable/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ QUnit.test( "enable", function( assert ) {

testHelper.sort( assert, $( "li", el )[ 0 ], 0, 44, 2, ".sortable('option', 'disabled', false)" );

expected = $( "<div></div>" ).sortable(),
expected = $( "<div></div>" ).sortable();
actual = expected.sortable( "enable" );
assert.equal( actual, expected, "enable is chainable" );
} );
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/tooltip/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ define( [
timers = jQuery.timers;

jQuery.fx.stop();
var x = false;

for ( index = timers.length; index--; ) {
x = true;
timer = timers[ index ];
timer.anim.stop();
timers.splice( index, 1 );
Expand Down
2 changes: 2 additions & 0 deletions ui/core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// This file is deprecated in 1.12.0 to be removed in 1.13
( function() {
"use strict";

define( [
"jquery",
"./data",
Expand Down
1 change: 1 addition & 0 deletions ui/effect.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ if ( $.uiBackCompat !== false ) {
// Firefox incorrectly exposes anonymous content
// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
try {
// eslint-disable-next-line no-unused-expressions
active.id;
} catch ( e ) {
active = document.body;
Expand Down
2 changes: 1 addition & 1 deletion ui/widgets/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ $.widget( "ui.autocomplete", {
var editable = element.prop( "contentEditable" );

if ( editable === "inherit" ) {
return this._isContentEditable( element.parent() );
return this._isContentEditable( element.parent() );
}

return editable === "true";
Expand Down
8 changes: 5 additions & 3 deletions ui/widgets/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2220,10 +2220,12 @@ $.fn.datepicker = function( options ) {
apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
}
return this.each( function() {
typeof options === "string" ?
$.datepicker[ "_" + options + "Datepicker" ].
apply( $.datepicker, [ this ].concat( otherArgs ) ) :
if ( typeof options === "string" ) {
$.datepicker[ "_" + options + "Datepicker" ]
.apply( $.datepicker, [ this ].concat( otherArgs ) );
} else {
$.datepicker._attachDatepicker( this, options );
}
} );
};

Expand Down
14 changes: 9 additions & 5 deletions ui/widgets/draggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ $.widget( "ui.draggable", $.ui.mouse, {
this.originalPageY = event.pageY;

//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
if ( o.cursorAt ) {
this._adjustOffsetFromHelper( o.cursorAt );
}

//Set a containment if given in the options
this._setContainment();
Expand Down Expand Up @@ -1119,12 +1121,13 @@ $.ui.plugin.add( "draggable", "snap", {
!$.contains( inst.snapElements[ i ].item.ownerDocument,
inst.snapElements[ i ].item ) ) {
if ( inst.snapElements[ i ].snapping ) {
( inst.options.snap.release &&
if ( inst.options.snap.release ) {
inst.options.snap.release.call(
inst.element,
event,
$.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
) );
);
}
}
inst.snapElements[ i ].snapping = false;
continue;
Expand Down Expand Up @@ -1195,13 +1198,14 @@ $.ui.plugin.add( "draggable", "snap", {
}

if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
( inst.options.snap.snap &&
if ( inst.options.snap.snap ) {
inst.options.snap.snap.call(
inst.element,
event,
$.extend( inst._uiHash(), {
snapItem: inst.snapElements[ i ].item
} ) ) );
} ) );
}
}
inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );

Expand Down
4 changes: 3 additions & 1 deletion ui/widgets/droppable.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ $.widget( "ui.droppable", {

this._addToManager( o.scope );

o.addClasses && this._addClass( "ui-droppable" );
if ( o.addClasses ) {
this._addClass( "ui-droppable" );
}

},

Expand Down
4 changes: 3 additions & 1 deletion ui/widgets/resizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,9 @@ $.widget( "ui.resizable", $.ui.mouse, {

_propagate: function( n, event ) {
$.ui.plugin.call( this, n, [ event, this.ui() ] );
( n !== "resize" && this._trigger( n, event, this.ui() ) );
if ( n !== "resize" ) {
this._trigger( n, event, this.ui() );
}
},

plugins: {},
Expand Down