Skip to content

Commit 69d8882

Browse files
committed
chore(edward) lint
1 parent 20f5554 commit 69d8882

File tree

12 files changed

+59
-65
lines changed

12 files changed

+59
-65
lines changed

.github/workflows/nodejs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Node CI
2-
'on':
2+
on:
33
- push
44
- pull_request
55
jobs:
@@ -8,12 +8,12 @@ jobs:
88
strategy:
99
matrix:
1010
node-version:
11-
- 14.x
1211
- 16.x
12+
- 18.x
1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v2
1515
- name: Use Node.js ${{ matrix.node-version }}
16-
uses: actions/setup-node@v1
16+
uses: actions/setup-node@v2
1717
with:
1818
node-version: ${{ matrix.node-version }}
1919
- name: Install Redrun

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ modules/pako/dist
1919
yarn-error.log
2020

2121
coverage
22+
.idea

.putout.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"match": {
33
"client": {
4-
"declare-undefined-variables": "off"
4+
"nodejs": "off"
55
},
66
"client/edward.js": {
77
"remove-console": "off"

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Edward [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
1+
# Edward [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL]
22

33
[NPMIMGURL]: https://img.shields.io/npm/v/edward.svg?style=flat
44
[BuildStatusURL]: https://github.com/cloudcmd/edward/actions?query=workflow%3A%22Node+CI%22 "Build Status"
55
[BuildStatusIMGURL]: https://github.com/cloudcmd/edward/workflows/Node%20CI/badge.svg
6-
[DependencyStatusIMGURL]: https://img.shields.io/david/cloudcmd/edward.svg?style=flat
76
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
87
[NPM_INFO_IMG]: https://nodei.co/npm/edward.png?downloads=true&&stars&&downloadRank "npm install edward"
98
[NPMURL]: https://npmjs.org/package/edward "npm"
10-
[DependencyStatusURL]: https://david-dm.org/cloudcmd/edward "Dependency Status"
119
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
1210
[edit.json]: https://github.com/cloudcmd/edward/tree/master/json/edit.json "edit.json"
1311

@@ -28,7 +26,7 @@ Web editor used in [Cloud Commander](http://cloudcmd.io) based on [Ace](http://a
2826
npm i edward -g
2927
```
3028

31-
![NPM_INFO][NPM_INFO_IMG]
29+
![NPM\_INFO][NPM_INFO_IMG]
3230

3331
## Command line parameters
3432

@@ -68,12 +66,12 @@ const express = require('express');
6866
const app = express();
6967

7068
app.use(edward({
71-
root: '/', // default
72-
online: true, // default
73-
diff: true, // default
74-
zip: true, // default
75-
dropbox: false, // optional
76-
dropboxToken: 'token', // optional
69+
root: '/', // default
70+
online: true, // default
71+
diff: true, // default
72+
zip: true, // default
73+
dropbox: false, // optional
74+
dropboxToken: 'token', // optional
7775
}));
7876

7977
app.listen(31_337);

bin/edward.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ function main(name) {
4141

4242
const {env} = process;
4343

44-
const port = env.PORT || /* c9 */
45-
env.VCAP_APP_PORT || /* cloudfoundry */
46-
1337;
44+
const port = env.PORT /* c9 */
45+
|| env.VCAP_APP_PORT /* cloudfoundry */
46+
|| 1337;
4747

48-
const ip = env.IP || /* c9 */
49-
'0.0.0.0';
48+
const ip = env.IP /* c9 */
49+
|| '0.0.0.0';
5050

5151
app .use(express.static(DIR))
5252
.use(edward({
@@ -56,7 +56,7 @@ function main(name) {
5656

5757
server.listen(port, ip);
5858

59-
const socket = io.listen(server);
59+
const socket = io(server);
6060
const edSocket = edward.listen(socket);
6161

6262
edSocket.on('connection', () => {

bower.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
2-
"name": "edward",
3-
"homepage": "https://github.com/cloudcmd/edward",
4-
"authors": [
5-
"coderaiser <mnemonic.enemy@gmail.com>"
6-
],
7-
"description": "web editor",
8-
"main": "bin/edward.js",
9-
"keywords": [
10-
"file",
11-
"edit"
12-
],
13-
"license": "MIT",
14-
"private": true,
15-
"ignore": [
16-
"node_modules",
17-
"modules"
18-
],
19-
"dependencies": {
20-
"ace-builds": "^1.5.0"
21-
}
2+
"name": "edward",
3+
"homepage": "https://github.com/cloudcmd/edward",
4+
"authors": [
5+
"coderaiser <mnemonic.enemy@gmail.com>"
6+
],
7+
"description": "web editor",
8+
"main": "bin/edward.js",
9+
"keywords": [
10+
"file",
11+
"edit"
12+
],
13+
"license": "MIT",
14+
"private": true,
15+
"ignore": [
16+
"node_modules",
17+
"modules"
18+
],
19+
"dependencies": {
20+
"ace-builds": "^1.5.0"
21+
}
2222
}

client/_clipboard.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ module.exports = function(cmd) {
3434
.then(insert)
3535
.catch(() => {
3636
showMessageOnce('Could not paste from clipboard. Inner buffer used.');
37+
3738
const value = _story.getData(NAME);
39+
3840
insert(value);
3941
});
4042
};

client/_on-save.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = async function(error, text) {
1919
if (error.message)
2020
msg = error.message + '\n' + msg;
2121
else
22-
msg = 'Can\'t save.' + msg;
22+
msg = `Can't save.` + msg;
2323

2424
const [cancel] = await tryToCatch(confirm, _title, msg);
2525

client/edward.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
'use strict';
2+
3+
const isString = (a) => typeof a === 'string';
14
/* global ace */
25
/* global join */
36

4-
'use strict';
5-
67
require('../css/edward.css');
78

89
const {createPatch} = require('daffy');
@@ -48,7 +49,7 @@ function Edward(el, options, callback) {
4849
if (!callback)
4950
callback = options;
5051

51-
if (typeof el === 'string')
52+
if (isString(el))
5253
el = document.querySelector(el);
5354

5455
this._maxSize = options._maxSize || 512_000;
@@ -347,7 +348,7 @@ Edward.prototype._setUseOfWorker = function(mode) {
347348
const session = this._getSession();
348349
const isStr = typeof mode === 'string';
349350
const regStr = 'coffee|css|html|json|lua|php|xquery';
350-
const regExp = new RegExp(regStr);
351+
const regExp = RegExp(regStr);
351352

352353
let isMatch;
353354

@@ -436,6 +437,7 @@ Edward.prototype._getSession = function() {
436437
Edward.prototype.sha = function() {
437438
const value = this.getValue();
438439
const shaObj = new jssha('SHA-1', 'TEXT');
440+
439441
shaObj.update(value);
440442

441443
return shaObj.getHash('HEX');
@@ -557,12 +559,8 @@ Edward.prototype._loadFiles = function(callback) {
557559
};
558560

559561
const scripts = Object.keys(obj)
560-
.filter((name) => {
561-
return !window[name];
562-
})
563-
.map((name) => {
564-
return PREFIX + obj[name];
565-
});
562+
.filter((name) => !window[name])
563+
.map((name) => PREFIX + obj[name]);
566564

567565
if (scripts.lengths)
568566
return callback();
@@ -582,11 +580,7 @@ Edward.prototype._loadFiles = function(callback) {
582580
'language_tools',
583581
'searchbox',
584582
'modelist',
585-
].map((name) => {
586-
return 'ext-' + name;
587-
}).map((name) => {
588-
return ace + name + '.js';
589-
}));
583+
].map((name) => 'ext-' + name).map((name) => ace + name + '.js'));
590584

591585
await load.js(url);
592586
callback();

client/loadremote.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ module.exports = async (name, options = {}) => {
6161
local = [module.local];
6262
}
6363

64-
local = local.map((url) => {
65-
return prefix + url;
66-
});
64+
local = local.map((url) => prefix + url);
6765

6866
const remote = remoteTmpls.map((tmpl) => {
6967
return tmpl.replace(/{{\sversion\s}}/g, version);

0 commit comments

Comments
 (0)