Skip to content

Commit

Permalink
Build: Enable ESLint one-var rule for var declarations in browser code
Browse files Browse the repository at this point in the history
Node.js code is written more & more commonly in ES6+ so it doesn't make sense
to enable it there. There are many violations in test code so it's disabled
there as well.

Closes gh-4615
  • Loading branch information
mgol committed Mar 2, 2020
1 parent 364476c commit 4a7fc85
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .eslintrc-browser.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},

"rules": {
"one-var": ["error", {"var": "always"}],
"strict": ["error", "function"]
}
}
3 changes: 2 additions & 1 deletion dist/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

"rules": {
// That is okay for the built version
"no-multiple-empty-lines": "off"
"no-multiple-empty-lines": "off",
"one-var": "off"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions src/css/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var reliableTrDimensionsVal;
// IE/Edge misreport `getComputedStyle` of table rows with width/height
// set in CSS while `offset*` properties report correct values.
support.reliableTrDimensions = function() {
var table, tr, trChild;
var table, tr, trChild, trStyle;
if ( reliableTrDimensionsVal == null ) {
table = document.createElement( "table" );
tr = document.createElement( "tr" );
Expand All @@ -23,7 +23,7 @@ support.reliableTrDimensions = function() {
.appendChild( tr )
.appendChild( trChild );

var trStyle = window.getComputedStyle( tr );
trStyle = window.getComputedStyle( tr );
reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;

documentElement.removeChild( table );
Expand Down
7 changes: 4 additions & 3 deletions src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,12 @@ jQuery.event = {

dispatch: function( nativeEvent ) {

// Make a writable jQuery.Event from the native event object
var event = jQuery.event.fix( nativeEvent );

var i, j, ret, matched, handleObj, handlerQueue,
args = new Array( arguments.length ),

// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( nativeEvent ),

handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};

Expand Down
1 change: 1 addition & 0 deletions test/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"brace-style": "off",
"key-spacing": "off",
"camelcase": "off",
"one-var": "off",
"strict": "off",

// Not really too many - waiting for autofix features for these rules
Expand Down

0 comments on commit 4a7fc85

Please sign in to comment.