More linting (object-curly-spacing).

1.1.101
Jorg Knobloch 2020-04-15 12:35:12 +02:00
parent 47226a2ee8
commit 60040aa8de
12 changed files with 43 additions and 44 deletions

View File

@ -62,7 +62,6 @@
"eqeqeq": "off",
"indent": "off",
"max-len": "off",
"no-unused-vars": "off",
"object-curly-spacing": "off"
"no-unused-vars": "off"
}
}

View File

@ -4,7 +4,7 @@
Using docker
```docker build -t <image_tag> . && docker run -v build:/usr/src/app/build <image_tag> ```
Using bash
```zip -r build/pEp4Tb@pEp.security.xpi chrome```
@ -21,19 +21,19 @@ catch syntax errors. After installing with `npm install` just run:
You can run ESLint to check the style guides defined in `.eslintrc.json` with the npm script:
npm run lint
ESLint can auto fix some problems with the option `--fix` but most of them must be fixed manually:
ESLint can auto fix some problems with the option `--fix` but most of them must be fixed manually:
npm run lint --fix
npm run lint -- --fix (on Windows)
## Tests
To run tests first is needed to install all dependencies
To run tests first is needed to install all dependencies
npm install
### Run
npm run test

View File

@ -1,11 +1,11 @@
var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
var { pEp } = ChromeUtils.import("chrome://pEp4Tb/content/modules/pEp.js");
const TbContacts = {
getCardForEmail(emailAddress) {
// copied from msgHdrViewOverlay.js
const books = MailServices.ab.directories;
const result = {book: null, card: null};
const result = { book: null, card: null };
while (!result.card && books.hasMoreElements()) {
const ab = books.getNext().QueryInterface(Ci.nsIAbDirectory);
try {
@ -21,12 +21,12 @@ const TbContacts = {
return result;
},
getpEpIdentity({name, email}) {
getpEpIdentity({ name, email }) {
let card = this.getCardForEmail(email).card;
return new pEp.Identity(email, card && card.UID, name);
},
getpEpOwnIdentity({name, email}) {
getpEpOwnIdentity({ name, email }) {
const identity = new pEp.Identity(email, "pEp_own_userId", name);
identity.me = true;
return identity;

View File

@ -1,5 +1,5 @@
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var {jsmime} = ChromeUtils.import("resource:///modules/jsmime.jsm");
var { jsmime } = ChromeUtils.import("resource:///modules/jsmime.jsm");
var { pEpController } = ChromeUtils.import("chrome://pEp4Tb/content/pEpController.js");
var { TbHelper } = ChromeUtils.import("chrome://pEp4Tb/content/TbHelper.js");
var { TbContacts } = ChromeUtils.import("chrome://pEp4Tb/content/TbContacts.js");

View File

@ -74,7 +74,7 @@ function onLoad() {
.map(fetchData)
.map(([template, promise]) => {
const fragment = new pEpUtils.Fragment(template, document);
promise.then(({data, handlers}) => {
promise.then(({ data, handlers }) => {
fragment
.populate(data)
.attach("click", handlers);

View File

@ -383,7 +383,7 @@ pEp.Message = class {
let opt = [];
// add extra headers
if ("opt_fields" in this) {
opt = this.opt_fields.map(({key, value}) => [key, value]);
opt = this.opt_fields.map(({ key, value }) => [key, value]);
}
return [
["Message-ID", this.id || "No-message-ID"],
@ -393,7 +393,7 @@ pEp.Message = class {
addressesHeaders() {
function getNameAddress(addr) {
return {name: addr.username, email: addr.address};
return { name: addr.username, email: addr.address };
}
const opt = [];

View File

@ -216,7 +216,7 @@ class pEpAdapter {
console.log("pEpAdapter.js: import_key() success: ", response);
if ((typeof (response) === "object") && response.hasOwnProperty("error")) {
throw new Error({code: "PEP-ERROR", message: response.error.message, response});
throw new Error({ code: "PEP-ERROR", message: response.error.message, response });
}
if (response.result.return.hasOwnProperty("status")) {
@ -311,7 +311,7 @@ class pEpAdapter {
console.log("pEpAdapter.js: decrypt_message() success: ", response);
if ((typeof (response) === "object") && response.hasOwnProperty("error")) {
throw new Error({code: "PEP-ERROR", message: response.error.message, response});
throw new Error({ code: "PEP-ERROR", message: response.error.message, response });
}
let decryptedMessage;
@ -343,7 +343,7 @@ class pEpAdapter {
default:
this.log.debug("callPepAdapter: 'decrypt_message' returned with error: ", response);
throw new Error({code: "PEP-ERROR", message: response.error.message, response});
throw new Error({ code: "PEP-ERROR", message: response.error.message, response });
}
}
@ -372,7 +372,7 @@ class pEpAdapter {
let encryptedMessage = {};
if ((typeof (response) === "object") && response.hasOwnProperty("error")) {
throw new Error({code: "PEP-ERROR", message: response.error.message, response});
throw new Error({ code: "PEP-ERROR", message: response.error.message, response });
}
if (response.result.return.hasOwnProperty("status")) {
@ -393,7 +393,7 @@ class pEpAdapter {
default:
this.log.debug("callPepAdapter: 'encrypt' returned with error: ", response);
throw new Error({code: response.result.return.status, message: response});
throw new Error({ code: response.result.return.status, message: response });
}
}

View File

@ -1,6 +1,6 @@
const EXPORTED_SYMBOLS = ["pEpFiles"];
var {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
var { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
class pEpFiles {
initPath(localFileObj, pathStr) {

View File

@ -7,13 +7,13 @@ var { pEpController } = ChromeUtils.import("chrome://pEp4Tb/content/pEpControlle
// Add preferences info (see developer.thunderbird.net/add-ons/updates/tb68).
Preferences.addAll([
{id: "extensions.pEp.storeAllSecurely", type: "bool"},
{id: "extensions.pEp.warnUnencrypted", type: "bool"},
{id: "extensions.pEp.protectSubjects", type: "bool"},
{id: "extensions.pEp.passiveMode", type: "bool"},
{id: "extensions.pEp.pEpSync", type: "bool"},
{id: "extensions.pEp.keyFingerprint", type: "string"},
{id: "extensions.pEp.keyLocation", type: "string"},
{ id: "extensions.pEp.storeAllSecurely", type: "bool" },
{ id: "extensions.pEp.warnUnencrypted", type: "bool" },
{ id: "extensions.pEp.protectSubjects", type: "bool" },
{ id: "extensions.pEp.passiveMode", type: "bool" },
{ id: "extensions.pEp.pEpSync", type: "bool" },
{ id: "extensions.pEp.keyFingerprint", type: "string" },
{ id: "extensions.pEp.keyLocation", type: "string" },
// examples with different types
// { id: "extensions.nameOfAddon.pref2", type: "string" },
// { id: "extensions.nameOfAddon.pref3", type: "int" },
@ -73,7 +73,7 @@ function loadAccounts() {
let id = `mail.identity.${identity.key}.enableEncryption`;
// Get prior value, if any. Default to true.
let value = Services.prefs.getBoolPref(id, true);
Preferences.add({id, type: "bool"});
Preferences.add({ id, type: "bool" });
checkbox.setAttribute("preference", id);
Services.prefs.setBoolPref(id, value);
@ -97,7 +97,7 @@ function loadAccounts() {
let id = `mail.account.${account.key}.storeSecurely`;
// Get prior value, if any. Default to true.
let value = storeAllSecurely ? true : Services.prefs.getBoolPref(id, true);
Preferences.add({id, type: "bool"});
Preferences.add({ id, type: "bool" });
checkbox.setAttribute("preference", id);
Services.prefs.setBoolPref(id, value);
checkbox.setAttribute("disabled", storeAllSecurely);

View File

@ -113,18 +113,18 @@ MimeDecrypt.prototype = {
// so we treat all fields the same.
if (message.from && message.from.address) {
message.from = TbHelper.isOwnIdentity(message.from.address)
? TbContacts.getpEpOwnIdentity({name: message.from.username, email: message.from.address})
: TbContacts.getpEpIdentity({name: message.from.username, email: message.from.address});
? TbContacts.getpEpOwnIdentity({ name: message.from.username, email: message.from.address })
: TbContacts.getpEpIdentity({ name: message.from.username, email: message.from.address });
}
message.to = message.to && message.to.map((addr) => (TbHelper.isOwnIdentity(addr.address)
? TbContacts.getpEpOwnIdentity({name: addr.username, email: addr.address})
: TbContacts.getpEpIdentity({name: addr.username, email: addr.address})));
? TbContacts.getpEpOwnIdentity({ name: addr.username, email: addr.address })
: TbContacts.getpEpIdentity({ name: addr.username, email: addr.address })));
message.cc = message.cc && message.cc.map((addr) => (TbHelper.isOwnIdentity(addr.address)
? TbContacts.getpEpOwnIdentity({name: addr.username, email: addr.address})
: TbContacts.getpEpIdentity({name: addr.username, email: addr.address})));
? TbContacts.getpEpOwnIdentity({ name: addr.username, email: addr.address })
: TbContacts.getpEpIdentity({ name: addr.username, email: addr.address })));
message.bcc = message.bcc && message.bcc.map((addr) => (TbHelper.isOwnIdentity(addr.address)
? TbContacts.getpEpOwnIdentity({name: addr.username, email: addr.address})
: TbContacts.getpEpIdentity({name: addr.username, email: addr.address})));
? TbContacts.getpEpOwnIdentity({ name: addr.username, email: addr.address })
: TbContacts.getpEpIdentity({ name: addr.username, email: addr.address })));
// Decrypt, `pEpController.decryptedPromise` is also used in pepmsghdrview.js.
this.controller.decryptedHeader = this.uri && this.uri.QueryInterface(Ci.nsIMsgMessageUrl).messageHeader;

View File

@ -352,7 +352,7 @@ var pEpComposer = {
"Send Unsecure",
null,
null,
{value: 0},
{ value: 0 },
) === 1);
},

View File

@ -1,6 +1,6 @@
/* global ExtensionCommon */
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var {ExtensionSupport} = ChromeUtils.import("resource:///modules/ExtensionSupport.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { ExtensionSupport } = ChromeUtils.import("resource:///modules/ExtensionSupport.jsm");
const EXTENSION_NAME = "pEp4Tb@pEp.security";