forked from CringeStudios/element-desktop
Merge pull request #197 from vector-im/jryans/rework-linting
Migrate to `eslint-plugin-matrix-org`
This commit is contained in:
commit
7f28e3f1e2
13
.eslintrc.js
13
.eslintrc.js
@ -1,6 +1,12 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
"matrix-org",
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
"plugin:matrix-org/javascript",
|
||||||
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaVersion: 8,
|
ecmaVersion: 2021,
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
es6: true,
|
es6: true,
|
||||||
@ -8,12 +14,7 @@ module.exports = {
|
|||||||
// we also have some browser code (ie. the preload script)
|
// we also have some browser code (ie. the preload script)
|
||||||
browser: true,
|
browser: true,
|
||||||
},
|
},
|
||||||
extends: ["matrix-org"],
|
|
||||||
rules: {
|
rules: {
|
||||||
// js-sdk uses a babel rule which we can't use because we
|
|
||||||
// don't use babel, so remove it & put the original back
|
|
||||||
"babel/no-invalid-this": "off",
|
|
||||||
"no-invalid-this": "error",
|
|
||||||
"quotes": "off",
|
"quotes": "off",
|
||||||
"indent": "off",
|
"indent": "off",
|
||||||
"prefer-promise-reject-errors": "off",
|
"prefer-promise-reject-errors": "off",
|
||||||
|
@ -47,8 +47,9 @@
|
|||||||
"electron-builder-squirrel-windows": "22.10.5",
|
"electron-builder-squirrel-windows": "22.10.5",
|
||||||
"electron-devtools-installer": "^3.1.1",
|
"electron-devtools-installer": "^3.1.1",
|
||||||
"electron-notarize": "^1.0.0",
|
"electron-notarize": "^1.0.0",
|
||||||
"eslint": "7.3.1",
|
"eslint": "7.18.0",
|
||||||
"eslint-config-matrix-org": "^0.1.2",
|
"eslint-config-google": "^0.14.0",
|
||||||
|
"eslint-plugin-matrix-org": "github:matrix-org/eslint-plugin-matrix-org#main",
|
||||||
"find-npm-prefix": "^1.0.2",
|
"find-npm-prefix": "^1.0.2",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
|
@ -499,7 +499,6 @@ ipcMain.on('ipcCall', async function(ev, payload) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const seshatDefaultPassphrase = "DEFAULT_PASSPHRASE";
|
const seshatDefaultPassphrase = "DEFAULT_PASSPHRASE";
|
||||||
async function getOrCreatePassphrase(key) {
|
async function getOrCreatePassphrase(key) {
|
||||||
if (keytar) {
|
if (keytar) {
|
||||||
|
@ -56,10 +56,10 @@ function _t(text, variables = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AppLocalization {
|
class AppLocalization {
|
||||||
static STORE_KEY = "locale"
|
|
||||||
store = null
|
|
||||||
|
|
||||||
constructor({ store, components = [] }) {
|
constructor({ store, components = [] }) {
|
||||||
|
// TODO: Should be static field, but that doesn't parse without Babel
|
||||||
|
this.STORE_KEY = "locale";
|
||||||
|
|
||||||
counterpart.registerTranslations("en", this.fetchTranslationJson("en_EN"));
|
counterpart.registerTranslations("en", this.fetchTranslationJson("en_EN"));
|
||||||
counterpart.setFallbackLocale('en');
|
counterpart.setFallbackLocale('en');
|
||||||
counterpart.setSeparator('|');
|
counterpart.setSeparator('|');
|
||||||
@ -69,8 +69,8 @@ class AppLocalization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.store = store;
|
this.store = store;
|
||||||
if (this.store.has(AppLocalization.STORE_KEY)) {
|
if (this.store.has(this.STORE_KEY)) {
|
||||||
const locales = this.store.get(AppLocalization.STORE_KEY);
|
const locales = this.store.get(this.STORE_KEY);
|
||||||
this.setAppLocale(locales);
|
this.setAppLocale(locales);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class AppLocalization {
|
|||||||
});
|
});
|
||||||
|
|
||||||
counterpart.setLocale(locales);
|
counterpart.setLocale(locales);
|
||||||
this.store.set(AppLocalization.STORE_KEY, locales);
|
this.store.set(this.STORE_KEY, locales);
|
||||||
|
|
||||||
this.resetLocalizedUI();
|
this.resetLocalizedUI();
|
||||||
}
|
}
|
||||||
@ -121,7 +121,6 @@ class AppLocalization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
AppLocalization,
|
AppLocalization,
|
||||||
_t,
|
_t,
|
||||||
|
@ -50,7 +50,6 @@ function writeNativeImage(filePath, img) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onLinkContextMenu(ev, params) {
|
function onLinkContextMenu(ev, params) {
|
||||||
let url = params.linkURL || params.srcURL;
|
let url = params.linkURL || params.srcURL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user