-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: upgrade lint tools #2720
chore: upgrade lint tools #2720
Conversation
var data = {}; | ||
|
||
var persistPermissions = function (that, form) { | ||
// construct an appropriate data object from the form | ||
data.elementID = $(form) | ||
.find('[name=nodeId]') | ||
.val(); | ||
data.action = 'updatePermissions'; | ||
data.deletable = $(form.deletable).is(':checked'); | ||
data.movable = $(form.movable).is(':checked'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SonarQube caught this could be flattened
@@ -18,15 +18,15 @@ | |||
*/ | |||
var uportal = uportal || {}; | |||
|
|||
(function($, fluid) { | |||
(function ($, fluid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier now adds a space between function and params
if ($.browser.msie) { | ||
if ($.browser.version === '7.0') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these conditions were flattened
@@ -39,7 +39,7 @@ var up = up || {}; | |||
); | |||
|
|||
var tree = {children: []}; | |||
$(results).each(function(idx, result) { | |||
$(results).each(function (index, result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unicorn aims to have abbreviations like idx
, msg
, e
, spelled out in clear English words.
@@ -312,19 +314,19 @@ var up = up || {}; | |||
onUpdatePermissions: null, | |||
}, | |||
listeners: { | |||
onUpdatePermissions: function(element, newPermissions) { | |||
if (!newPermissions.movable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conditions were reversed automatically to avoid negation
|
||
// add the portlet to the cached list | ||
if (!that.state.portlets['portlet.' + portlet.id]) { | ||
that.state.portlets.push(portlet); | ||
that.state.portlets['portlet.' + portlet.id] = | ||
that.state.portlets[that.state.portlets.length - 1]; | ||
that.state.portlets.at(-1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automatically changed to simpler way to access final element
@@ -30,32 +30,32 @@ | |||
* NOTE: Do not change the location of Bootstrap sources lightly; they must | |||
* be included in the uPortal.war package. | |||
*/ | |||
@import url("../../../../webjars/bootstrap/less/bootstrap.less"); | |||
@import "../../../../webjars/bootstrap/less/bootstrap.less"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
less does not require the url
function for imports
@@ -606,18 +623,6 @@ | |||
} | |||
} | |||
|
|||
.active { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.active
was declared in two places this was manually moved to combine them
/** | ||
* Simple function to escape specific HTML characters so they aren't | ||
* a problem. &, quote, and single quote are handled by jQuery so | ||
* only need to deal with < and > | ||
* @param {string} str - unescaped input | ||
* @return {string} escaped output | ||
*/ | ||
function htmlEscape(string_) { | ||
return String(string_).replaceAll('<', '<').replaceAll('>', '>'); | ||
} | ||
|
||
/** | ||
* Helper method for making it a little easier to format the output in the menu | ||
* @param {object} item A JavaScript Object containing the item values | ||
* @return {string} Returns a formatted string that will be injected into the menu | ||
*/ | ||
var formatOutput = function (item) { | ||
return ( | ||
'<a><span class="autocomplete-header">' + | ||
htmlEscape(item.title) + | ||
'</span><br>' + | ||
htmlEscape(item.desc) + | ||
'</a>' | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are pure functions, and were extracted up a level to avoid unnecessary reallocation.
updateCountdown = function() { | ||
var now = new Date().getTime(); | ||
updateCountdown = function () { | ||
var now = Date.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automatically updated, same timestamp, but avoids instantiating a new class to generate it.
c6b710f
to
c001b13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅
Checklist
Description of change
eslint-config-google
which is deprecated by Google📓⚠️ if/when this is merged, please squash merge to avoid unnecessary churn in files.