mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
chore(cloudcmd) lint
This commit is contained in:
parent
8f466b4c9a
commit
111eba8c31
33 changed files with 139 additions and 155 deletions
|
|
@ -150,7 +150,7 @@ test('current-file: isCurrentFile: no', (t) => {
|
|||
global.DOM = DOM;
|
||||
global.CloudCmd = CloudCmd;
|
||||
|
||||
t.equal(result, expect, 'should equal');
|
||||
t.equal(result, expect);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,7 @@ module.exports.getById = (id, element = document) => {
|
|||
* @param className - className
|
||||
* @param element - element
|
||||
*/
|
||||
module.exports.getByClass = (className, element = document) => {
|
||||
return DOM.getByClassAll(className, element)[0];
|
||||
};
|
||||
module.exports.getByClass = (className, element = document) => DOM.getByClassAll(className, element)[0];
|
||||
|
||||
module.exports.getByDataName = (attribute, element = document) => {
|
||||
const selector = '[' + 'data-name="' + attribute + '"]';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,5 @@ module.exports.clear = () => {
|
|||
list = [];
|
||||
};
|
||||
|
||||
module.exports.get = () => {
|
||||
return list;
|
||||
};
|
||||
module.exports.get = () => list;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ const timeout = getTimeoutOnce(2000);
|
|||
|
||||
module.exports.get = getFile;
|
||||
|
||||
async function getFile(name) {
|
||||
function getFile(name) {
|
||||
const type = itype(name);
|
||||
check(name);
|
||||
|
||||
if (type === 'string')
|
||||
return await getModule(name);
|
||||
return getModule(name);
|
||||
|
||||
if (type === 'array')
|
||||
return Promise.all(name.map(getFile));
|
||||
|
|
@ -35,7 +35,7 @@ function check(name) {
|
|||
throw Error('name could not be empty!');
|
||||
}
|
||||
|
||||
async function getModule(name) {
|
||||
function getModule(name) {
|
||||
const regExpHTML = new RegExp(FILES_HTML + '|' + FILES_HTML_ROOT);
|
||||
const regExpJSON = new RegExp(FILES_JSON);
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ function getPath(name, isHTML, isJSON) {
|
|||
|
||||
function showError(name) {
|
||||
const str = 'Wrong file name: ' + name;
|
||||
const error = new Error(str);
|
||||
const error = Error(str);
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -509,9 +509,7 @@ module.exports.saveDataToStorage = async (name, data, hash) => {
|
|||
return hash;
|
||||
};
|
||||
|
||||
module.exports.getFM = () => {
|
||||
return DOM.getPanel().parentElement;
|
||||
};
|
||||
module.exports.getFM = () => DOM.getPanel().parentElement;
|
||||
|
||||
module.exports.getPanelPosition = (panel) => {
|
||||
panel = panel || DOM.getPanel();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ test('cloudcmd: client: io: replaceHash', (t) => {
|
|||
const result = _replaceHash(url);
|
||||
const expected = '/hello/%23%23%23%23world';
|
||||
|
||||
t.equal(result, expected, 'should equal');
|
||||
t.equal(result, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,7 @@ module.exports = (name, options, callback = options) => {
|
|||
local = [module.local];
|
||||
}
|
||||
|
||||
const localURL = local.map((url) => {
|
||||
return prefix + url;
|
||||
});
|
||||
const localURL = local.map((url) => prefix + url);
|
||||
|
||||
const remoteURL = remoteTmpls.map((tmpl) => {
|
||||
return rendy(tmpl, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue