mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Updated Airbnb style guide used
The updated style guide made a number of new suggestions, so the config and the code have been updated to reflect them.
This commit is contained in:
+6
-1
@@ -20,4 +20,9 @@ rules:
|
||||
strict:
|
||||
- 2
|
||||
- global
|
||||
guard-for-in: 0
|
||||
guard-for-in: 1
|
||||
no-param-reassign:
|
||||
- 2
|
||||
- props: false
|
||||
arrow-body-style: 1
|
||||
max-len: 1
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
"devDependencies": {
|
||||
"bower": "^1.7.1",
|
||||
"eslint": "^1.10.3",
|
||||
"eslint-config-airbnb": "^2.0.0",
|
||||
"eslint-config-airbnb": "^4.0.0",
|
||||
"fs-extra": "^0.26.2",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "^0.1.13",
|
||||
|
||||
+13
-4
@@ -41,7 +41,7 @@ function compress(sourcePath, destPath) {
|
||||
'a',
|
||||
'-r',
|
||||
destPath,
|
||||
'.' + path.sep + path.join(sourcePath, '*'),
|
||||
path.join('.', sourcePath, '*'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -192,13 +192,22 @@ vulcanize(rootPath);
|
||||
const releasePaths = helpers.getAppReleasePaths(rootPath);
|
||||
for (let i = 0; i < releasePaths.length; ++i) {
|
||||
if (releasePaths[i].label) {
|
||||
createAppArchive(rootPath, releasePaths[i].path, tempPath, path.join(rootPath, 'build', 'LOOT ' + gitDesc + ' (' + releasePaths[i].label + ').7z'));
|
||||
const filename = `LOOT ${gitDesc} (${releasePaths[i].label}).7z`;
|
||||
createAppArchive(rootPath,
|
||||
releasePaths[i].path,
|
||||
tempPath,
|
||||
path.join(rootPath, 'build', filename));
|
||||
} else {
|
||||
createAppArchive(releasePaths[i].path, path.join(rootPath, 'build', 'LOOT ' + gitDesc + '.7z'));
|
||||
createAppArchive(releasePaths[i].path,
|
||||
path.join(rootPath, 'build', `LOOT ${gitDesc}.7z`));
|
||||
}
|
||||
}
|
||||
|
||||
const binaryPaths = helpers.getApiBinaryPaths(rootPath);
|
||||
for (let i = 0; i < binaryPaths.length; ++i) {
|
||||
createApiArchive(rootPath, binaryPaths[i].path, tempPath, path.join(rootPath, 'build', 'LOOT API ' + gitDesc + ' (' + binaryPaths[i].label + ').7z'));
|
||||
const filename = `LOOT API ${gitDesc} (${binaryPaths[i].label}).7z`;
|
||||
createApiArchive(rootPath,
|
||||
binaryPaths[i].path,
|
||||
tempPath,
|
||||
path.join(rootPath, 'build', filename));
|
||||
}
|
||||
|
||||
@@ -40,4 +40,4 @@ helpers.getAppReleasePaths(rootPath).forEach((releasePath) => {
|
||||
output: path.join(outputPath, 'index.html'),
|
||||
input: path.join(rootPath, 'src', 'gui', 'html', 'index.html'),
|
||||
}, runVulcanize);
|
||||
})
|
||||
});
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
getElementInTableRowTemplate(rowTemplateId, elementClass) {
|
||||
const select = document.querySelector('link[rel="import"][href$="editable-table.html"]');
|
||||
if (select) {
|
||||
return select.import.querySelector('#' + rowTemplateId).content.querySelector('.' + elementClass);
|
||||
return select.import.querySelector(`#${rowTemplateId}`).content.querySelector(`.${elementClass}`);
|
||||
}
|
||||
return document.querySelector('#' + rowTemplateId).content.querySelector('.' + elementClass);
|
||||
return document.querySelector(`#${rowTemplateId}`).content.querySelector(`.${elementClass}`);
|
||||
},
|
||||
|
||||
show(elementId) {
|
||||
@@ -34,7 +34,9 @@
|
||||
for (let i = 0; i < table.tBodies[0].rows.length; ++i) {
|
||||
const folderElements = table.tBodies[0].rows[i].getElementsByClassName('folder');
|
||||
if (folderElements.length === 1) {
|
||||
table.setReadOnly(table.tBodies[0].rows[i], ['delete'], folderElements[0].value === gameFolder);
|
||||
table.setReadOnly(table.tBodies[0].rows[i],
|
||||
['delete'],
|
||||
folderElements[0].value === gameFolder);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -33,15 +33,18 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.conflictingPluginNames.length !== 0 && this.conflictingPluginNames.indexOf(plugin.name) === -1) {
|
||||
if (this.conflictingPluginNames.length !== 0
|
||||
&& this.conflictingPluginNames.indexOf(plugin.name) === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.hideMessagelessPlugins && plugin.getCardContent(this).messages.length === 0) {
|
||||
if (this.hideMessagelessPlugins
|
||||
&& plugin.getCardContent(this).messages.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.contentSearchString.length !== 0 && !plugin.getCardContent(this).containsText(this.contentSearchString)) {
|
||||
if (this.contentSearchString.length !== 0
|
||||
&& !plugin.getCardContent(this).containsText(this.contentSearchString)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -57,7 +60,8 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.hideDoNotCleanMessages && message.content.toLowerCase().indexOf(this._doNotCleanString) !== -1) {
|
||||
if (this.hideDoNotCleanMessages
|
||||
&& message.content.toLowerCase().indexOf(this._doNotCleanString) !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
/* Pad CRC string to 8 characters. */
|
||||
return ('00000000' + this._crc.toString(16).toUpperCase()).slice(-8);
|
||||
return (`00000000${this._crc.toString(16).toUpperCase()}`).slice(-8);
|
||||
}
|
||||
|
||||
get tags() {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
persistent: false,
|
||||
onSuccess: resolve,
|
||||
onFailure: (errorCode, errorMessage) => {
|
||||
reject(new Error('Error code: ' + errorCode + '; ' + errorMessage));
|
||||
reject(new Error(`Error code: ${errorCode}; ${errorMessage}`));
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
(function exportModule(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['bower_components/Jed/jed', 'bower_components/jed-gettext-parser/jedGettextParser'], factory);
|
||||
define(['bower_components/Jed/jed',
|
||||
'bower_components/jed-gettext-parser/jedGettextParser'],
|
||||
factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
root.loot = root.loot || {};
|
||||
@@ -19,11 +21,11 @@
|
||||
|
||||
load() {
|
||||
const defaultTranslationData = {
|
||||
'messages': {
|
||||
messages: {
|
||||
'': {
|
||||
'domain': 'messages',
|
||||
'lang': 'en',
|
||||
'plural_forms': 'nplurals=2; plural=(n != 1);',
|
||||
domain: 'messages',
|
||||
lang: 'en',
|
||||
plural_forms: 'nplurals=2; plural=(n != 1);',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -34,7 +36,7 @@
|
||||
translationDataPromise = Promise.resolve(defaultTranslationData);
|
||||
} else {
|
||||
translationDataPromise = new Promise((resolve, reject) => {
|
||||
const url = 'loot://l10n/' + this.locale + '/LC_MESSAGES/loot.mo';
|
||||
const url = `loot://l10n/${this.locale}/LC_MESSAGES/loot.mo`;
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
@@ -53,12 +55,12 @@
|
||||
}
|
||||
|
||||
return translationDataPromise.catch((error) => {
|
||||
console.log('Error loading translation data: ' + error.message); // eslint-disable-line no-console
|
||||
console.log(`Error loading translation data: ${error.message}`); // eslint-disable-line no-console
|
||||
return defaultTranslationData;
|
||||
}).then((result) => {
|
||||
this.jed = new Jed({
|
||||
'locale_data': result,
|
||||
'domain': 'messages',
|
||||
locale_data: result,
|
||||
domain: 'messages',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user