Skip to content

Commit a1239cd

Browse files
lint
1 parent 04fe42c commit a1239cd

File tree

5 files changed

+31
-34
lines changed

5 files changed

+31
-34
lines changed

src/fileSystem/internalFs.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,19 @@ const internalFs = {
6363
const name = filename.split("/").pop();
6464

6565
return new Promise((resolve, reject) => {
66-
if(udata === undefined || udata == null){
67-
reject("udata is null")
66+
if (udata === undefined || udata == null) {
67+
reject("udata is null");
6868
}
6969

70-
let data
71-
if (udata instanceof ArrayBuffer || Object.prototype.toString.call(udata) === "[object ArrayBuffer]") {
72-
const decoder = new TextDecoder('utf-8');
70+
let data;
71+
if (
72+
udata instanceof ArrayBuffer ||
73+
Object.prototype.toString.call(udata) === "[object ArrayBuffer]"
74+
) {
75+
const decoder = new TextDecoder("utf-8");
7376
data = decoder.decode(udata);
74-
}else{
75-
data = udata
77+
} else {
78+
data = udata;
7679
}
7780

7881
reject = setMessage(reject);
@@ -105,11 +108,10 @@ const internalFs = {
105108
*/
106109

107110
delete(filename) {
108-
console.log("deletion skipped")
109-
return
111+
console.log("deletion skipped");
112+
return;
110113
return new Promise((resolve, reject) => {
111114
console.log("Deleting " + filename);
112-
113115

114116
Filesystem.stat({ path: filename })
115117
.then((stats) => {
@@ -143,8 +145,8 @@ const internalFs = {
143145
.then((readFileResult) => {
144146
const encoder = new TextEncoder();
145147
const buffer = encoder.encode(readFileResult.data).buffer;
146-
147-
resolve({data : buffer})
148+
149+
resolve({ data: buffer });
148150
})
149151
.catch((error) => {
150152
console.error(
@@ -161,7 +163,7 @@ const internalFs = {
161163
reject = setMessage(reject);
162164
Filesystem.readFile({ path: filename, encoding: Encoding.UTF8 })
163165
.then((readFileResult) => {
164-
resolve({data : readFileResult.data})
166+
resolve({ data: readFileResult.data });
165167
})
166168
.catch((error) => {
167169
console.error(
@@ -173,7 +175,6 @@ const internalFs = {
173175
});
174176
},
175177

176-
177178
/**
178179
* Rename a file or directory
179180
* @param {string} url
@@ -218,9 +219,7 @@ const internalFs = {
218219
recursive: true,
219220
})
220221
.then(() => {
221-
console.log(
222-
`Created ${path}/${dirname}`,
223-
);
222+
console.log(`Created ${path}/${dirname}`);
224223
Filesystem.stat({ path: `${path}/${dirname}` })
225224
.then((stats) => resolve(stats.url))
226225
.catch(reject);
@@ -507,7 +506,7 @@ function createFs(url) {
507506
return files;
508507
},
509508
async readFile(encoding) {
510-
console.log("fs read "+url)
509+
console.log("fs read " + url);
511510
let { data } = await internalFs.readFile(url, encoding);
512511

513512
if (encoding) {

src/lib/acode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export default class Acode {
189189

190190
let purchaseToken;
191191
let product;
192-
const pluginUrl = `${PLUGIN_DIR}/${pluginId}`
192+
const pluginUrl = `${PLUGIN_DIR}/${pluginId}`;
193193
fsOperation(`${pluginUrl}/plugin.json`)
194194
.readFile()
195195
.catch(() => {

src/lib/installPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default async function installPlugin(
2929
purchaseToken,
3030
isDependency,
3131
) {
32-
console.log(`Installing ${name}`)
32+
console.log(`Installing ${name}`);
3333
if (!isDependency) {
3434
loaderDialog = loader.create(name || "Plugin", strings.installing, {
3535
timeout: 6000,
@@ -49,7 +49,7 @@ export default async function installPlugin(
4949
window.log("error", error);
5050
}
5151

52-
console.log("installing -------------------------")
52+
console.log("installing -------------------------");
5353
if (!/^(https?|file|content):/.test(id)) {
5454
pluginUrl = Url.join(
5555
constants.API_BASE,

src/lib/loadPlugin.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Page from "components/page";
22
import fsOperation from "fileSystem";
3+
import internalFs from "fileSystem/internalFs";
34
import Url from "utils/Url";
45
import helpers from "utils/helpers";
56
import actionStack from "./actionStack";
6-
import internalFs from "fileSystem/internalFs";
77

88
export default async function loadPlugin(pluginId, justInstalled = false) {
9-
const baseUrl = Url.join(PLUGIN_DIR, pluginId)
9+
const baseUrl = Url.join(PLUGIN_DIR, pluginId);
1010

11-
console.log("Base url "+baseUrl)
11+
console.log("Base url " + baseUrl);
1212

1313
const cacheFile = Url.join(CACHE_STORAGE, pluginId);
1414

@@ -26,16 +26,14 @@ export default async function loadPlugin(pluginId, justInstalled = false) {
2626
}
2727

2828
return new Promise((resolve, reject) => {
29-
30-
if(pluginId === undefined){
31-
console.error("Skiping loading plugin with undefined id")
32-
reject("Skiping loading plugin with undefined id")
33-
return
29+
if (pluginId === undefined) {
30+
console.error("Skipping loading plugin with undefined id");
31+
reject("Skipping loading plugin with undefined id");
32+
return;
3433
}
3534

36-
37-
const data = internalFs.readStringFile(mainUrl).data
38-
35+
const data = internalFs.readStringFile(mainUrl).data;
36+
3937
const $script = <script dangerouslySetInnerHTML={{ __html: data }} />;
4038

4139
$script.onerror = (error) => {

src/lib/loadPlugins.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default async function loadPlugins(loadOnlyTheme = false) {
5252

5353
// Load plugins concurrently
5454
const loadPromises = pluginsToLoad.map(async (pluginDir) => {
55-
console.log("loading")
55+
console.log("loading");
5656
const pluginId = Url.basename(pluginDir.url);
5757

5858
if (loadOnlyTheme && currentTheme) {
@@ -99,7 +99,7 @@ function isThemePlugin(pluginId) {
9999

100100
async function cleanupFailedPlugins(pluginIds) {
101101
for (const pluginId of pluginIds) {
102-
console.log("skiping delete "+pluginId)
102+
console.log("skipping delete " + pluginId);
103103
continue;
104104
try {
105105
const pluginDir = Url.join(PLUGIN_DIR, pluginId);

0 commit comments

Comments
 (0)