Skip to content
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

feat(lint): use Date.now() instead of new Date().getTime() #2606

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ module.exports = {
'unicorn/no-useless-switch-case': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/prefer-array-find': 'off',
'unicorn/prefer-date-now': 'off',
'unicorn/prefer-default-parameters': 'off',
'unicorn/prefer-logical-operator-over-ternary': 'off',
'unicorn/prefer-native-coercion-functions': 'off',
Expand Down
10 changes: 5 additions & 5 deletions src/definitions/behaviors/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
? $(window)
: $(this),
moduleSelector = $allModules.selector || '',
time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -537,7 +537,7 @@
done: function (response, textStatus, xhr) {
var
context = this,
elapsedTime = (new Date().getTime() - requestStartTime),
elapsedTime = (Date.now() - requestStartTime),
timeLeft = (settings.loadingDuration - elapsedTime),
translatedResponse = (isFunction(settings.onResponse))
? module.is.expectingJSON() && !settings.rawResponse
Expand Down Expand Up @@ -566,7 +566,7 @@
fail: function (xhr, status, httpMessage) {
var
context = this,
elapsedTime = (new Date().getTime() - requestStartTime),
elapsedTime = (Date.now() - requestStartTime),
timeLeft = (settings.loadingDuration - elapsedTime)
;
timeLeft = (timeLeft > 0)
Expand Down Expand Up @@ -727,7 +727,7 @@
loading: function () {
module.verbose('Adding loading state to element', $context);
$context.addClass(className.loading);
requestStartTime = new Date().getTime();
requestStartTime = Date.now();
},
},

Expand Down Expand Up @@ -949,7 +949,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/behaviors/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$allModules = $(this),
moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -1382,7 +1382,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/behaviors/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -464,7 +464,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/behaviors/visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$allModules = $(this),
moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -1072,7 +1072,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/globals/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

$.site = $.fn.site = function (parameters) {
var
time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -309,7 +309,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var
$allModules = $(this),

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -427,7 +427,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -1435,7 +1435,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$allModules = $(this),
moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -712,7 +712,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/dimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var
$allModules = $(this),

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -519,7 +519,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -3801,7 +3801,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -436,7 +436,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/flyout.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -1181,7 +1181,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -1189,7 +1189,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/nag.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$allModules = $(this),
moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -352,7 +352,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
? 'touchstart'
: 'click',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -1191,7 +1191,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -807,7 +807,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$allModules = $(this),
moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -356,7 +356,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$allModules = $(this),
moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -1129,7 +1129,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var
$allModules = $(this),

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -646,7 +646,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/modules/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

moduleSelector = $allModules.selector || '',

time = new Date().getTime(),
time = Date.now(),
performance = [],

query = arguments[0],
Expand Down Expand Up @@ -907,7 +907,7 @@
previousTime
;
if (settings.performance) {
currentTime = new Date().getTime();
currentTime = Date.now();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
Expand Down
Loading