mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
chore: lint
This commit is contained in:
parent
8e25a02568
commit
88da092fdb
38 changed files with 125 additions and 124 deletions
|
|
@ -115,7 +115,7 @@ module.exports.getCurrentDirName = () => {
|
|||
.replace(/\/$/, '');
|
||||
|
||||
const substr = href.substr(href, href.lastIndexOf('/'));
|
||||
const ret = href.replace(substr + '/', '') || '/';
|
||||
const ret = href.replace(`${substr}/`, '') || '/';
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,6 +72,6 @@ function uploadFile(url, data) {
|
|||
}
|
||||
|
||||
function uploadDir(url) {
|
||||
return DOM.load.put(url + '?dir');
|
||||
return DOM.load.put(`${url}?dir`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ module.exports.getByTag = (tag, element = document) => {
|
|||
* @param Id - id
|
||||
*/
|
||||
module.exports.getById = (id, element = document) => {
|
||||
return element.querySelector('#' + id);
|
||||
return element.querySelector(`#${id}`);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function EventsProto() {
|
|||
switch(type) {
|
||||
default:
|
||||
if (!type.endsWith('element'))
|
||||
throw Error('unknown eventName: ' + type);
|
||||
throw Error(`unknown eventName: ${type}`);
|
||||
|
||||
parseArgs(
|
||||
args[EVENT_NAME],
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const FILES_JSON = 'config|modules';
|
|||
const FILES_HTML = 'file|path|link|pathLink|media';
|
||||
const FILES_HTML_ROOT = 'view/media-tmpl|config-tmpl|upload';
|
||||
const DIR_HTML = '/tmpl/';
|
||||
const DIR_HTML_FS = DIR_HTML + 'fs/';
|
||||
const DIR_HTML_FS = `${DIR_HTML}fs/`;
|
||||
const DIR_JSON = '/json/';
|
||||
const timeout = getTimeoutOnce(2000);
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ function getPath(name, isHTML, isJSON) {
|
|||
}
|
||||
|
||||
function showError(name) {
|
||||
const str = 'Wrong file name: ' + name;
|
||||
const str = `Wrong file name: ${name}`;
|
||||
const error = Error(str);
|
||||
|
||||
throw error;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ module.exports.setProgress = (value, title) => {
|
|||
if (!element)
|
||||
return Images;
|
||||
|
||||
element.setAttribute(DATA, value + '%');
|
||||
element.setAttribute(DATA, `${value}%`);
|
||||
|
||||
if (title)
|
||||
element.title = title;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ module.exports.promptNewFile = async () => {
|
|||
async function promptNew(typeName) {
|
||||
const {Dialog} = DOM;
|
||||
const dir = DOM.getCurrentDirPath();
|
||||
const msg = 'New ' + typeName || 'File';
|
||||
const msg = `New ${typeName}` || 'File';
|
||||
const getName = () => {
|
||||
const name = DOM.getCurrentName();
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ module.exports.getCurrentDirName = () => {
|
|||
.replace(/\/$/, '');
|
||||
|
||||
const substr = href.substr(href, href.lastIndexOf('/'));
|
||||
const ret = href.replace(substr + '/', '') || '/';
|
||||
const ret = href.replace(`${substr}/`, '') || '/';
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
|
@ -457,7 +457,7 @@ module.exports.getFilenames = (files) => {
|
|||
* check storage hash
|
||||
*/
|
||||
module.exports.checkStorageHash = async (name) => {
|
||||
const nameHash = name + '-hash';
|
||||
const nameHash = `${name}-hash`;
|
||||
|
||||
if (typeof name !== 'string')
|
||||
throw Error('name should be a string!');
|
||||
|
|
@ -486,8 +486,8 @@ module.exports.saveDataToStorage = async (name, data, hash) => {
|
|||
|
||||
hash = hash || await DOM.loadCurrentHash();
|
||||
|
||||
const nameHash = name + '-hash';
|
||||
const nameData = name + '-data';
|
||||
const nameHash = `${name}-hash`;
|
||||
const nameData = `${name}-data`;
|
||||
|
||||
await Storage.set(nameHash, hash);
|
||||
await Storage.set(nameData, data);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ module.exports.Markdown = {
|
|||
read: async (url) => {
|
||||
return await sendRequest({
|
||||
method: 'GET',
|
||||
url: '/markdown' + url,
|
||||
url: `/markdown${url}`,
|
||||
imgPosition,
|
||||
notLog: true,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue