Fix missing semicolons

Ensure all statements end with a semicolon.
This commit is contained in:
Hornwitser committed 2020-06-17 20:53:18 +02:00
1 parent 34aaeee354
commit 29f066a191
56 files changed
+242 -242

No files matched your search

+12 -12
View File
@@ -73,7 +73,7 @@ class Config extends events.EventEmitter {
super();
if (!this.constructor._finalized) {
throw new Error(`Cannot instantiate incomplete Config class ${this.constructor.name}`)
throw new Error(`Cannot instantiate incomplete Config class ${this.constructor.name}`);
}
this._groups = new Map();
@@ -177,7 +177,7 @@ class Config extends events.EventEmitter {
*/
group(name) {
if (!this._initialized) {
throw new Error(`${this.constructor.name} instance is uninitialized`)
throw new Error(`${this.constructor.name} instance is uninitialized`);
}
let group = this._groups.get(name);
if (!group) {
@@ -263,7 +263,7 @@ class ConfigGroup {
*/
constructor(serializedGroup) {
if (!this.constructor._finalized) {
throw new Error(`Cannot instantiate incomplete ConfigGroup class ${this.constructor.name}`)
throw new Error(`Cannot instantiate incomplete ConfigGroup class ${this.constructor.name}`);
}
this._fields = new Map();
@@ -287,7 +287,7 @@ class ConfigGroup {
let value = null;
if (typeof def.initial_value === "function") {
value = await def.initial_value()
value = await def.initial_value();
} else if (def.initial_value !== undefined) {
value = def.initial_value;
@@ -368,14 +368,14 @@ class ConfigGroup {
try {
value = JSON.parse(value);
} catch (err) {
throw new InvalidValue(`Error parsing value for ${name}: ${err.message}`)
throw new InvalidValue(`Error parsing value for ${name}: ${err.message}`);
}
}
}
if (value === null) {
if (!def.optional) {
throw new InvalidValue(`Field ${name} cannot be null`)
throw new InvalidValue(`Field ${name} cannot be null`);
}
} else {
@@ -540,11 +540,11 @@ class ConfigGroup {
*/
static define(item) {
if (this._finalized) {
throw new Error(`Cannot define field for ConfigGroup class ${this.name} after it has been finalized`)
throw new Error(`Cannot define field for ConfigGroup class ${this.name} after it has been finalized`);
}
if (basicType(this.groupName) !== "string") {
throw new Error(`Expected ConfigGroup class ${this.name} to have the groupName property set to a string`)
throw new Error(`Expected ConfigGroup class ${this.name} to have the groupName property set to a string`);
}
this._initSubclass();
@@ -556,7 +556,7 @@ class ConfigGroup {
if (!itemKeys.includes(prop)) {
throw new Error(`${prop} is required when defining an field`);
}
})
});
// Validate properties
let validTypes = ["boolean", "string", "number", "object"];
@@ -618,7 +618,7 @@ class ConfigGroup {
let computed = Object.assign({
optional: false,
fullName: `${this.groupName}.${item.name}`,
}, item)
}, item);
if (!computed.optional && computed.initial_value === undefined) {
throw new Error(`Non-optional field ${item.name} needs an initial_value`);
@@ -632,7 +632,7 @@ class ConfigGroup {
*/
static finalize() {
if (basicType(this.groupName) !== "string") {
throw new Error(`Expected ConfigGroup class ${this.name} to have the groupName property set to a string`)
throw new Error(`Expected ConfigGroup class ${this.name} to have the groupName property set to a string`);
}
this._initSubclass();
@@ -672,4 +672,4 @@ module.exports = {
Config,
ConfigGroup,
PluginConfigGroup,
}
};