Skip to content

Firefly III: a personal finances manager

Fix eslint issues.

James Cole90d459b87b07
diff --git a/resources/assets/v3/js/boot/bootstrap.js b/resources/assets/v3/js/boot/bootstrap.js
index 63e687051f..908622f977 100644
--- a/resources/assets/v3/js/boot/bootstrap.js
+++ b/resources/assets/v3/js/boot/bootstrap.js
@@ -108,7 +108,7 @@ getFreshVariable('lastActivity').then((serverValue) => {
});
for (let i = 0; i < hints.length; i++) {
- if (hints.hasOwnProperty(i)) {
+ if (Object.hasOwn(hints,i)) {
let hint = hints[i];
let buttons = [];
@@ -138,13 +138,12 @@ getFreshVariable('lastActivity').then((serverValue) => {
);
}
-
let step = {
// id: 'example-step',
text: hint.text,
buttons: buttons
};
- if (hint.hasOwnProperty('element')) {
+ if (Object.hasOwn(hint, 'element')) {
step.attachTo = {
element: hint.element,
on: hint.position
diff --git a/resources/assets/v3/js/shared/draw-chart.js b/resources/assets/v3/js/shared/draw-chart.js
index 1996650db2..2d5ab449c5 100644
--- a/resources/assets/v3/js/shared/draw-chart.js
+++ b/resources/assets/v3/js/shared/draw-chart.js
@@ -70,7 +70,7 @@ function drawSingleCurrencyLineChart(url, holder, anonymous) {
let currency = all.currency;
- let yAxisCallback = function (value, index, ticks) {
+ let yAxisCallback = function (value) {
if (anonymous) {
value = '0';
}
diff --git a/resources/assets/v3/js/store/get-variable.js b/resources/assets/v3/js/store/get-variable.js
index 3c4f17994b..1eead2a1ec 100644
--- a/resources/assets/v3/js/store/get-variable.js
+++ b/resources/assets/v3/js/store/get-variable.js
@@ -27,7 +27,7 @@ export function getVariable(name, defaultValue = null) {
// currently unused, window.X can be used by the blade template
// to make things available quicker than if the store has to grab it through the API.
// then again, it's not that slow.
- if (validCache && window.hasOwnProperty(name)) {
+ if (validCache && Object.hasOwn(window, name)) {
console.log('Returning "'+name+'" from window: ' + window[name]);
return Promise.resolve(window[name]);
}
@@ -43,6 +43,7 @@ export function getVariable(name, defaultValue = null) {
console.log('Returning "'+name+'" from server: ' + parseResponse(name, response));
return Promise.resolve(parseResponse(name, response));
}).catch((error) => {
+ console.log(error);
if('' === defaultValue) {
// do not try to store empty strings.
return Promise.resolve(defaultValue);
diff --git a/resources/assets/v3/js/store/get-variables.js b/resources/assets/v3/js/store/get-variables.js
index adebb878c6..a34dbf3170 100644
--- a/resources/assets/v3/js/store/get-variables.js
+++ b/resources/assets/v3/js/store/get-variables.js
@@ -35,7 +35,7 @@ export function getVariables(preferences) {
// currently unused, window.X can be used by the blade template
// to make things available quicker than if the store has to grab it through the API.
// then again, it's not that slow.
- if (validCache && window.hasOwnProperty(name)) {
+ if (validCache && Object.hasOwn(window, name)) {
// console.log('Returning "' + name + '" from window: ' + window[name]);
chain = chain.then(() => {
@@ -91,7 +91,7 @@ export function getVariables(preferences) {
export function parseResponses(response) {
let result = {}
for (let i in response.data.data) {
- if (response.data.data.hasOwnProperty(i)) {
+ if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
result[current.attributes.name] = current.attributes.data;
window.store.set(current.attributes.name, current.attributes.data);
diff --git a/resources/assets/v3/js/store/store.js b/resources/assets/v3/js/store/store.js
index 88fafed7fb..9d3f46b0e5 100644
--- a/resources/assets/v3/js/store/store.js
+++ b/resources/assets/v3/js/store/store.js
@@ -18,9 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-let engine = require('store/src/store-engine')
+import engine from 'store/src/store-engine';
+import storages from 'store/storages/all';
+import plugins from 'store/plugins/observe';
-let storages = require('store/storages/all')
-let plugins = [require('store/plugins/observe')]
-
-module.exports = engine.createStore(storages, plugins)
+export default engine.createStore(storages, plugins)
diff --git a/resources/assets/v3/js/support/cleanup-cache.js b/resources/assets/v3/js/support/cleanup-cache.js
index 217d471b13..b82203f91e 100644
--- a/resources/assets/v3/js/support/cleanup-cache.js
+++ b/resources/assets/v3/js/support/cleanup-cache.js
@@ -18,7 +18,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {format} from "date-fns";
import store from "store";
function cleanupCache() {
diff --git a/resources/assets/v3/js/support/get-cache-key.js b/resources/assets/v3/js/support/get-cache-key.js
index adedf73b49..563aca9b88 100644
--- a/resources/assets/v3/js/support/get-cache-key.js
+++ b/resources/assets/v3/js/support/get-cache-key.js
@@ -29,7 +29,7 @@ function getCacheKey(string, params) {
let newParams = {lastActivity: lastActivity, key: string};
for (const key in params) {
- if (params.hasOwnProperty(key)) {
+ if (Object.hasOwn(params, key)) {
if(params[key] === null || params[key] === undefined) {
newParams[key] = '';
continue;
diff --git a/resources/assets/v3/js/util/format-money.js b/resources/assets/v3/js/util/format-money.js
index 576a693bbe..8ccbe6ae8d 100644
--- a/resources/assets/v3/js/util/format-money.js
+++ b/resources/assets/v3/js/util/format-money.js
@@ -18,7 +18,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {format} from "date-fns";
export default function (amount, currencyCode) {
if( (typeof amount !== 'number' && typeof amount !== 'string') || isNaN(amount)) {
diff --git a/resources/assets/v3/vite.config.js b/resources/assets/v3/vite.config.js
index a22b8ef924..a841acbe5a 100644
--- a/resources/assets/v3/vite.config.js
+++ b/resources/assets/v3/vite.config.js
@@ -23,7 +23,7 @@ import laravel from 'laravel-vite-plugin';
import manifestSRI from 'vite-plugin-manifest-sri';
import fs from "fs";
-export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
+export default defineConfig(({command}) => {
let https = null;
if (command === 'serve') {
https = {