1
0
mirror of https://github.com/chylex/Firefox-SCsCC.git synced 2025-04-09 16:15:43 +02:00

upgrade packages & fix lint errors

This commit is contained in:
sarics 2020-01-12 15:11:57 +01:00
parent c6998e6b44
commit 058f549afd
7 changed files with 3023 additions and 4038 deletions

6984
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,19 +19,19 @@
"build": "npm-run-all clean build:webpack build:web-ext"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/core": "^7.8.0",
"@babel/preset-env": "^7.8.0",
"babel-loader": "^8.0.6",
"copy-webpack-plugin": "^5.0.3",
"cross-env": "^5.2.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-import": "^2.18.2",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^6.0.3",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.0",
"npm-run-all": "^4.1.5",
"rimraf": "^2.6.3",
"web-ext": "^3.1.1",
"webpack": "^4.36.1",
"webpack-cli": "^3.3.6",
"rimraf": "^3.0.0",
"web-ext": "^4.0.0",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"xregexp": "^4.2.4"
}
}

View File

@ -54,13 +54,12 @@ const openOptionsTab = () => openTab('options/options.html');
const openPopupTab = () => openTab('popup/popup.html');
window.openOptionsPage = () =>
browser.runtime.openOptionsPage()
.catch((err) => {
onError(err);
window.openOptionsPage = () => browser.runtime.openOptionsPage()
.catch((err) => {
onError(err);
openOptionsTab();
});
openOptionsTab();
});
// get storage
@ -71,7 +70,7 @@ browser.storage.local.get()
if (storage.preferences && Object.keys(storage.preferences).length === Object.keys(preferences).length) {
({ preferences } = storage);
} else {
preferences = Object.assign({}, preferences, storage.preferences || {});
preferences = { ...preferences, ...storage.preferences || {} };
newStorage.preferences = preferences;
}
@ -126,7 +125,7 @@ const checkCurrRate = (currRate, fromCurr, toCurr) => {
showNotification(fromCurr, toCurr, oldValue, currRate.value);
}
const newCurrRates = Object.assign({}, currRates, { [reqKey]: currRate });
const newCurrRates = { ...currRates, [reqKey]: currRate };
browser.storage.local.set({ currRates: newCurrRates });
}
};

View File

@ -10,7 +10,7 @@ const getTxtMatch = (txt) => {
// on getCurrRate request complete
const reqComplete = (request, currRates, reqKey) => {
const currRate = currRates[reqKey] ? Object.assign({}, currRates[reqKey]) : {};
const currRate = currRates[reqKey] ? { ...currRates[reqKey] } : {};
if (request && request.status === 200) {
currRate.updatedAt = Date.now();

View File

@ -14,11 +14,10 @@ export default (onMutation) => {
const observer = new MutationObserver(checkMutations);
return {
observe: () =>
observer.observe(document.body, {
childList: true,
subtree: true,
}),
observe: () => observer.observe(document.body, {
childList: true,
subtree: true,
}),
disconnect: () => observer.disconnect(),
};

View File

@ -1,18 +1,17 @@
const styleElem = document.createElement('style');
styleElem.textContent =
'data.scscc {\n' +
' padding: 0 2px !important;\n' +
' color: inherit !important;\n' +
' white-space: pre !important;\n' +
' border-width: 0 1px !important;\n' +
' border-style: dotted !important;\n' +
' border-color: inherit !important;\n' +
' cursor: help !important;\n' +
'}\n' +
'data.scscc:hover {\n' +
' background-color: red !important;\n' +
' color: white !important;\n' +
'}';
styleElem.textContent = 'data.scscc {\n'
+ ' padding: 0 2px !important;\n'
+ ' color: inherit !important;\n'
+ ' white-space: pre !important;\n'
+ ' border-width: 0 1px !important;\n'
+ ' border-style: dotted !important;\n'
+ ' border-color: inherit !important;\n'
+ ' cursor: help !important;\n'
+ '}\n'
+ 'data.scscc:hover {\n'
+ ' background-color: red !important;\n'
+ ' color: white !important;\n'
+ '}';
export default {
add: () => {

View File

@ -9,7 +9,7 @@ const onChange = ({ target }) => {
if (Object.keys(changedPrefs).length) {
browser.storage.local.get('preferences')
.then((storage) => {
browser.storage.local.set({ preferences: Object.assign({}, storage.preferences, changedPrefs) });
browser.storage.local.set({ preferences: { ...storage.preferences, ...changedPrefs } });
});
}
};