Update eslint to support new JS syntax

I'm already using nullish coalescing (??) and optional chaining (?.)

and fix the little bits of lint (I don't have many linter rules enabled yet)
main
Isaiah Odhner 2021-08-02 23:32:03 -04:00
parent ac68c8827b
commit 0472a47c24
5 changed files with 1140 additions and 1164 deletions

View File

@ -1,7 +1,7 @@
module.exports = {
"env": {
"browser": true,
"es6": true
"es2020": true,
},
"extends": "eslint:recommended",
"globals": {
@ -160,9 +160,6 @@ module.exports = {
"set_theme": "writable",
*/
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-undef": 0, // FOR NOW OKAY? there are just tons of globals at the moment
"no-unused-vars": 0, // ditto

2288
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -69,7 +69,7 @@
"cypress-image-snapshot": "^4.0.1",
"electron": "^11.2.3",
"electron-debug": "^3.2.0",
"eslint": "6.4.0",
"eslint": "^7.32.0",
"live-server": "^1.2.1",
"npm-run-all": "^4.1.5",
"onchange": "^7.1.0",

View File

@ -64,7 +64,10 @@ try {
if (localStorage[language_storage_key]) {
accepted_languages.unshift(localStorage[language_storage_key]);
}
} catch (error) {}
} catch (error) {
// if there's no localStorage access, you can still configure the language via system settings, theoretically
// TODO: also via URL?
}
var language_to_default_region = {
aa: 'ET',
@ -1077,7 +1080,7 @@ function load_language(language) {
// current_language = prev_language;
// });
const src = `localization/${language}/localizations.js`;
document.write(`<script src="${src}"><\/script>`);
document.write(`<script src="${src}"></${""/*(avoiding ending script tag if inlined in HTML)*/}script>`);
}
// JSONP callback
function loaded_localizations(language, mapping) {

View File

@ -1066,7 +1066,7 @@ function show_file_format_errors({ as_image_error, as_palette_error }) {
'`': '&#x60;',
'=': '&#x3D;',
};
const escape_html = (string) => String(string).replace(/[&<>"'`=\/]/g, (s) => entity_map[s]);
const escape_html = (string) => String(string).replace(/[&<>"'`=/]/g, (s) => entity_map[s]);
const uppercase_first = (string) => string.charAt(0).toUpperCase() + string.slice(1);
const only_palette_error = as_palette_error && !as_image_error; // update me if there are more error types