Skip to content

Commit af77eee

Browse files
committed
chore: lint
1 parent e99d084 commit af77eee

File tree

14 files changed

+143
-91
lines changed

14 files changed

+143
-91
lines changed

.npmignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.*
2-
*.spec.js
2+
*.spec.*
33
*.fixture.js*
44
manifest.yml
55
docker
@@ -19,7 +19,7 @@ app.json
1919
bower.json
2020
manifest.yml
2121

22-
bin/release.js
22+
bin/release.mjs
2323

2424
client
2525
img/logo/cloudcmd-hq.png

bin/release.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ await main();
1919
async function main() {
2020
const history = '## Version history\n\n';
2121
const link = '//github.com/coderaiser/cloudcmd/releases/tag/';
22-
const template =
23-
'- *{{ date }}*, ' +
22+
const template = '- ' +
23+
'*{{ date }}*, ' +
2424
'**[v{{ version }}]' +
2525
'(' + link +
2626
'v{{ version }})**\n';

client/key/vim/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const getOperations = (event, deps) => {
3131
getCurrentName,
3232

3333
toggleSelectedFile,
34-
Buffer = {},
34+
Buffer = {},
3535
} = deps;
3636

3737
return {

client/listeners/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ async function onPathElementClick(panel, event) {
215215

216216
function copyPath(el) {
217217
clipboard
218-
.writeText(el
219-
.parentElement.title)
218+
.writeText(el.parentElement.title)
220219
.then(CloudCmd.log)
221220
.catch(CloudCmd.log);
222221
}
@@ -422,7 +421,7 @@ function dragndrop() {
422421
};
423422

424423
/**
425-
* In Mac OS Chrome dropEffect = 'none'
424+
* In macOS Chrome dropEffect = 'none'
426425
* so drop do not firing up when try
427426
* to upload file from download bar
428427
*/

client/modules/operation/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ module.exports.init = promisify((callback) => {
5959
exec.series([
6060
DOM.loadSocket,
6161
async (callback) => {
62-
if (config('dropbox'))
63-
return callback();
64-
65-
const {prefix, prefixSocket} = CloudCmd;
66-
67-
await loadAll();
68-
await initOperations(prefix, prefixSocket, callback);
69-
},
62+
if (config('dropbox'))
63+
return callback();
64+
65+
const {prefix, prefixSocket} = CloudCmd;
66+
67+
await loadAll();
68+
await initOperations(prefix, prefixSocket, callback);
69+
},
7070
(callback) => {
71-
Loaded = true;
72-
Images.hide();
73-
callback();
74-
},
71+
Loaded = true;
72+
Images.hide();
73+
callback();
74+
},
7575
], callback);
7676
});
7777

client/modules/user-menu/navigate.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
const fullstore = require('fullstore');
44

5-
const {J, K, UP, DOWN} = require('../../key/key.js');
5+
const {
6+
J,
7+
K,
8+
UP,
9+
DOWN,
10+
} = require('../../key/key.js');
611

712
const store = fullstore(1);
813
const isDigit = (a) => /^\d+$/.test(a);

client/modules/user-menu/navigate.spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
const test = require('supertape');
44
const navigate = require('./navigate');
55

6-
const {UP, DOWN, J, K} = require('../../key/key.js');
6+
const {
7+
UP,
8+
DOWN,
9+
J,
10+
K,
11+
} = require('../../key/key.js');
712

813
test('cloudcmd: user-menu: navigate: DOWN', (t) => {
914
const el = {

common/cloudfunc.js

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ module.exports.buildFromJSON = (params) => {
173173
Path(path);
174174

175175
fileTable += `${header}<ul data-name="js-files" class="files">`;
176+
176177
/* Если мы не в корне */
177178
if (path !== '/') {
178179
const dotDot = getDotDot(path);
@@ -203,43 +204,43 @@ module.exports.buildFromJSON = (params) => {
203204

204205
fileTable += files
205206
.filter(filterOutDotFiles({
206-
showDotFiles,
207-
}))
207+
showDotFiles,
208+
}))
208209
.map(updateField)
209210
.map((file) => {
210-
const name = encode(file.name);
211-
const link = prefix + FS + path + name;
212-
213-
const {
214-
type,
215-
mode,
216-
date,
217-
owner,
218-
size,
219-
} = file;
220-
221-
const linkResult = rendy(templateLink, {
222-
link,
223-
title: name,
224-
name,
225-
attribute: getAttribute(file.type),
226-
});
227-
228-
const dataName = getDataName(file.name);
229-
const attribute = `draggable="true" ${dataName}`;
230-
231-
return rendy(templateFile, {
232-
tag: 'li',
233-
attribute,
234-
className: '',
235-
type,
236-
name: linkResult,
237-
size,
238-
date,
239-
owner,
240-
mode,
241-
});
242-
})
211+
const name = encode(file.name);
212+
const link = prefix + FS + path + name;
213+
214+
const {
215+
type,
216+
mode,
217+
date,
218+
owner,
219+
size,
220+
} = file;
221+
222+
const linkResult = rendy(templateLink, {
223+
link,
224+
title: name,
225+
name,
226+
attribute: getAttribute(file.type),
227+
});
228+
229+
const dataName = getDataName(file.name);
230+
const attribute = `draggable="true" ${dataName}`;
231+
232+
return rendy(templateFile, {
233+
tag: 'li',
234+
attribute,
235+
className: '',
236+
type,
237+
name: linkResult,
238+
size,
239+
date,
240+
owner,
241+
mode,
242+
});
243+
})
243244
.join('');
244245

245246
fileTable += '</ul>';

eslint.config.mjs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {safeAlign} from 'eslint-plugin-putout';
2+
import {defineConfig} from 'eslint/config';
3+
import n from 'eslint-plugin-n';
4+
import globals from 'globals';
5+
import {matchToFlat} from '@putout/eslint-flat';
6+
7+
export const match = {
8+
'bin/release.mjs': {
9+
'no-console': 'off',
10+
'n/hashbang': 'off',
11+
},
12+
'client/dom/index.js': {
13+
'no-multi-spaces': 'off',
14+
},
15+
'client/**/*.js': {
16+
'n/no-extraneous-require': 'off',
17+
'n/no-unsupported-features/node-builtins': 'off',
18+
},
19+
'bin/cloudcmd.js': {
20+
'no-console': 'off',
21+
},
22+
};
23+
export default defineConfig([
24+
safeAlign, {
25+
ignores: ['**/fixture'],
26+
rules: {
27+
'key-spacing': 'off',
28+
'n/prefer-node-protocol': 'error',
29+
},
30+
plugins: {
31+
n,
32+
},
33+
}, {
34+
files: ['{client,common,static}/**/*.js'],
35+
languageOptions: {
36+
globals: {
37+
...globals.browser,
38+
},
39+
},
40+
},
41+
...matchToFlat(match),
42+
]);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
"just-snake-case": "^3.2.0",
121121
"markdown-it": "^14.0.0",
122122
"mellow": "^3.0.0",
123+
"mime-types": "^3.0.1",
123124
"montag": "^1.2.1",
124125
"nano-memoize": "^3.0.16",
125126
"nomine": "^4.0.0",

0 commit comments

Comments
 (0)