chore: lint

This commit is contained in:
coderaiser 2023-01-30 20:33:36 +02:00
parent 8e25a02568
commit 88da092fdb
38 changed files with 125 additions and 124 deletions

View file

@ -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;
};

View file

@ -72,6 +72,6 @@ function uploadFile(url, data) {
}
function uploadDir(url) {
return DOM.load.put(url + '?dir');
return DOM.load.put(`${url}?dir`);
}

View file

@ -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}`);
};
/**

View file

@ -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],

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -133,7 +133,7 @@ module.exports.Markdown = {
read: async (url) => {
return await sendRequest({
method: 'GET',
url: '/markdown' + url,
url: `/markdown${url}`,
imgPosition,
notLog: true,
});