Skip to content

Commit 7cf9dda

Browse files
committed
fix lint errors
1 parent 657806c commit 7cf9dda

File tree

4 files changed

+61
-65
lines changed

4 files changed

+61
-65
lines changed

browser/components/CodeEditor.js

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import CodeMirror from 'codemirror'
55
import 'codemirror-mode-elixir'
66
import attachmentManagement from 'browser/main/lib/dataApi/attachmentManagement'
77
import convertModeName from 'browser/lib/convertModeName'
8-
import { options, TableEditor } from '@susisu/mte-kernel'
8+
import { options, TableEditor, Alignment } from '@susisu/mte-kernel'
99
import TextEditorInterface from 'browser/lib/TextEditorInterface'
1010
import eventEmitter from 'browser/main/lib/eventEmitter'
1111
import iconv from 'iconv-lite'
@@ -143,7 +143,7 @@ export default class CodeEditor extends React.Component {
143143
override: true
144144
}
145145
})
146-
146+
147147
this.setMode(this.props.mode)
148148

149149
this.editor.on('focus', this.focusHandler)
@@ -164,11 +164,11 @@ export default class CodeEditor extends React.Component {
164164
CodeMirror.Vim.defineEx('qw', 'qw', this.quitEditor)
165165
CodeMirror.Vim.map('ZZ', ':q', 'normal')
166166
this.setState({ isReady: true })
167-
167+
168168
const editorIntf = new TextEditorInterface(this.editor)
169169
this.tableEditor = new TableEditor(editorIntf)
170170
eventEmitter.on('code:format-table', this.formatTable)
171-
171+
172172
const defaultKeyMap = CodeMirror.normalizeKeyMap({
173173
Tab: function (cm) {
174174
const cursor = cm.getCursor()
@@ -221,52 +221,52 @@ export default class CodeEditor extends React.Component {
221221
return CodeMirror.Pass
222222
}
223223
})
224-
225-
if(this.props.enableTableEditor) {
224+
225+
if (this.props.enableTableEditor) {
226226
const opts = options({
227227
smartCursor: true
228228
})
229-
229+
230230
const editorKeyMap = CodeMirror.normalizeKeyMap({
231-
'Tab' : () => { this.tableEditor.nextCell(opts) },
232-
'Shift-Tab' : () => { this.tableEditor.previousCell(opts) },
233-
'Enter' : () => { this.tableEditor.nextRow(opts) },
234-
'Ctrl-Enter' : () => { this.tableEditor.escape(opts) },
235-
'Cmd-Enter' : () => { this.tableEditor.escape(opts) },
236-
'Shift-Ctrl-Left' : () => { this.tableEditor.alignColumn(Alignment.LEFT, opts) },
237-
'Shift-Cmd-Left' : () => { this.tableEditor.alignColumn(Alignment.LEFT, opts) },
238-
'Shift-Ctrl-Right' : () => { this.tableEditor.alignColumn(Alignment.RIGHT, opts) },
239-
'Shift-Cmd-Right' : () => { this.tableEditor.alignColumn(Alignment.RIGHT, opts) },
240-
'Shift-Ctrl-Up' : () => { this.tableEditor.alignColumn(Alignment.CENTER, opts) },
241-
'Shift-Cmd-Up' : () => { this.tableEditor.alignColumn(Alignment.CENTER, opts) },
242-
'Shift-Ctrl-Down' : () => { this.tableEditor.alignColumn(Alignment.NONE, opts) },
243-
'Shift-Cmd-Down' : () => { this.tableEditor.alignColumn(Alignment.NONE, opts) },
244-
'Ctrl-Left' : () => { this.tableEditor.moveFocus(0, -1, opts) },
245-
'Cmd-Left' : () => { this.tableEditor.moveFocus(0, -1, opts) },
246-
'Ctrl-Right' : () => { this.tableEditor.moveFocus(0, 1, opts) },
247-
'Cmd-Right' : () => { this.tableEditor.moveFocus(0, 1, opts) },
248-
'Ctrl-Up' : () => { this.tableEditor.moveFocus(-1, 0, opts) },
249-
'Cmd-Up' : () => { this.tableEditor.moveFocus(-1, 0, opts) },
250-
'Ctrl-Down' : () => { this.tableEditor.moveFocus(1, 0, opts) },
251-
'Cmd-Down' : () => { this.tableEditor.moveFocus(1, 0, opts) },
252-
'Ctrl-K Ctrl-I' : () => { this.tableEditor.insertRow(opts) },
253-
'Cmd-K Cmd-I' : () => { this.tableEditor.insertRow(opts) },
254-
'Ctrl-L Ctrl-I' : () => { this.tableEditor.deleteRow(opts) },
255-
'Cmd-L Cmd-I' : () => { this.tableEditor.deleteRow(opts) },
256-
'Ctrl-K Ctrl-J' : () => { this.tableEditor.insertColumn(opts) },
257-
'Cmd-K Cmd-J' : () => { this.tableEditor.insertColumn(opts) },
258-
'Ctrl-L Ctrl-J' : () => { this.tableEditor.deleteColumn(opts) },
259-
'Cmd-L Cmd-J' : () => { this.tableEditor.deleteColumn(opts) },
260-
'Alt-Shift-Ctrl-Left' : () => { this.tableEditor.moveColumn(-1, opts) },
261-
'Alt-Shift-Cmd-Left' : () => { this.tableEditor.moveColumn(-1, opts) },
231+
'Tab': () => { this.tableEditor.nextCell(opts) },
232+
'Shift-Tab': () => { this.tableEditor.previousCell(opts) },
233+
'Enter': () => { this.tableEditor.nextRow(opts) },
234+
'Ctrl-Enter': () => { this.tableEditor.escape(opts) },
235+
'Cmd-Enter': () => { this.tableEditor.escape(opts) },
236+
'Shift-Ctrl-Left': () => { this.tableEditor.alignColumn(Alignment.LEFT, opts) },
237+
'Shift-Cmd-Left': () => { this.tableEditor.alignColumn(Alignment.LEFT, opts) },
238+
'Shift-Ctrl-Right': () => { this.tableEditor.alignColumn(Alignment.RIGHT, opts) },
239+
'Shift-Cmd-Right': () => { this.tableEditor.alignColumn(Alignment.RIGHT, opts) },
240+
'Shift-Ctrl-Up': () => { this.tableEditor.alignColumn(Alignment.CENTER, opts) },
241+
'Shift-Cmd-Up': () => { this.tableEditor.alignColumn(Alignment.CENTER, opts) },
242+
'Shift-Ctrl-Down': () => { this.tableEditor.alignColumn(Alignment.NONE, opts) },
243+
'Shift-Cmd-Down': () => { this.tableEditor.alignColumn(Alignment.NONE, opts) },
244+
'Ctrl-Left': () => { this.tableEditor.moveFocus(0, -1, opts) },
245+
'Cmd-Left': () => { this.tableEditor.moveFocus(0, -1, opts) },
246+
'Ctrl-Right': () => { this.tableEditor.moveFocus(0, 1, opts) },
247+
'Cmd-Right': () => { this.tableEditor.moveFocus(0, 1, opts) },
248+
'Ctrl-Up': () => { this.tableEditor.moveFocus(-1, 0, opts) },
249+
'Cmd-Up': () => { this.tableEditor.moveFocus(-1, 0, opts) },
250+
'Ctrl-Down': () => { this.tableEditor.moveFocus(1, 0, opts) },
251+
'Cmd-Down': () => { this.tableEditor.moveFocus(1, 0, opts) },
252+
'Ctrl-K Ctrl-I': () => { this.tableEditor.insertRow(opts) },
253+
'Cmd-K Cmd-I': () => { this.tableEditor.insertRow(opts) },
254+
'Ctrl-L Ctrl-I': () => { this.tableEditor.deleteRow(opts) },
255+
'Cmd-L Cmd-I': () => { this.tableEditor.deleteRow(opts) },
256+
'Ctrl-K Ctrl-J': () => { this.tableEditor.insertColumn(opts) },
257+
'Cmd-K Cmd-J': () => { this.tableEditor.insertColumn(opts) },
258+
'Ctrl-L Ctrl-J': () => { this.tableEditor.deleteColumn(opts) },
259+
'Cmd-L Cmd-J': () => { this.tableEditor.deleteColumn(opts) },
260+
'Alt-Shift-Ctrl-Left': () => { this.tableEditor.moveColumn(-1, opts) },
261+
'Alt-Shift-Cmd-Left': () => { this.tableEditor.moveColumn(-1, opts) },
262262
'Alt-Shift-Ctrl-Right': () => { this.tableEditor.moveColumn(1, opts) },
263-
'Alt-Shift-Cmd-Right' : () => { this.tableEditor.moveColumn(1, opts) },
264-
'Alt-Shift-Ctrl-Up' : () => { this.tableEditor.moveRow(-1, opts) },
265-
'Alt-Shift-Cmd-Up' : () => { this.tableEditor.moveRow(-1, opts) },
266-
'Alt-Shift-Ctrl-Down' : () => { this.tableEditor.moveRow(1, opts) },
267-
'Alt-Shift-Cmd-Down' : () => { this.tableEditor.moveRow(1, opts) }
263+
'Alt-Shift-Cmd-Right': () => { this.tableEditor.moveColumn(1, opts) },
264+
'Alt-Shift-Ctrl-Up': () => { this.tableEditor.moveRow(-1, opts) },
265+
'Alt-Shift-Cmd-Up': () => { this.tableEditor.moveRow(-1, opts) },
266+
'Alt-Shift-Ctrl-Down': () => { this.tableEditor.moveRow(1, opts) },
267+
'Alt-Shift-Cmd-Down': () => { this.tableEditor.moveRow(1, opts) }
268268
})
269-
269+
270270
const updateActiveState = () => {
271271
const active = this.tableEditor.cursorIsInTable(opts)
272272
if (active) {
@@ -276,7 +276,7 @@ export default class CodeEditor extends React.Component {
276276
this.tableEditor.resetSmartCursor()
277277
}
278278
}
279-
279+
280280
this.editor.on('cursorActivity', () => {
281281
if (!editorIntf.transaction) {
282282
updateActiveState()

browser/components/MarkdownEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class MarkdownEditor extends React.Component {
235235
if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none'
236236

237237
const storage = findStorage(storageKey)
238-
238+
239239
return (
240240
<div className={className == null
241241
? 'MarkdownEditor'

browser/lib/TextEditorInterface.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ export default class TextEditorInterface {
77
this.transaction = false
88
}
99

10-
getCursorPosition() {
10+
getCursorPosition () {
1111
const { line, ch } = this.doc.getCursor()
1212
return new Point(line, ch)
1313
}
1414

15-
setCursorPosition(pos) {
15+
setCursorPosition (pos) {
1616
this.doc.setCursor({
1717
line: pos.row,
1818
ch: pos.column
1919
})
2020
}
2121

22-
setSelectionRange(range) {
22+
setSelectionRange (range) {
2323
this.doc.setSelection(
2424
{ line: range.start.row, ch: range.start.column },
2525
{ line: range.end.row, ch: range.end.column }
2626
)
2727
}
2828

29-
getLastRow() {
29+
getLastRow () {
3030
return this.doc.lineCount() - 1
3131
}
3232

33-
acceptsTableEdit() {
33+
acceptsTableEdit () {
3434
return true
3535
}
3636

37-
getLine(row) {
37+
getLine (row) {
3838
return this.doc.getLine(row)
3939
}
4040

41-
insertLine(row, line) {
41+
insertLine (row, line) {
4242
const lastRow = this.getLastRow()
4343
if (row > lastRow) {
4444
const lastLine = this.getLine(lastRow)
@@ -47,8 +47,7 @@ export default class TextEditorInterface {
4747
{ line: lastRow, ch: lastLine.length },
4848
{ line: lastRow, ch: lastLine.length }
4949
)
50-
}
51-
else {
50+
} else {
5251
this.doc.replaceRange(
5352
line + '\n',
5453
{ line: row, ch: 0 },
@@ -57,7 +56,7 @@ export default class TextEditorInterface {
5756
}
5857
}
5958

60-
deleteLine(row) {
59+
deleteLine (row) {
6160
const lastRow = this.getLastRow()
6261
if (row >= lastRow) {
6362
if (lastRow > 0) {
@@ -68,17 +67,15 @@ export default class TextEditorInterface {
6867
{ line: lastRow - 1, ch: preLastLine.length },
6968
{ line: lastRow, ch: lastLine.length }
7069
)
71-
}
72-
else {
70+
} else {
7371
const lastLine = this.getLine(lastRow)
7472
this.doc.replaceRange(
7573
'',
7674
{ line: lastRow, ch: 0 },
7775
{ line: lastRow, ch: lastLine.length }
7876
)
7977
}
80-
}
81-
else {
78+
} else {
8279
this.doc.replaceRange(
8380
'',
8481
{ line: row, ch: 0 },
@@ -87,7 +84,7 @@ export default class TextEditorInterface {
8784
}
8885
}
8986

90-
replaceLines(startRow, endRow, lines) {
87+
replaceLines (startRow, endRow, lines) {
9188
const lastRow = this.getLastRow()
9289
if (endRow > lastRow) {
9390
const lastLine = this.getLine(lastRow)
@@ -96,8 +93,7 @@ export default class TextEditorInterface {
9693
{ line: startRow, ch: 0 },
9794
{ line: lastRow, ch: lastLine.length }
9895
)
99-
}
100-
else {
96+
} else {
10197
this.doc.replaceRange(
10298
lines.join('\n') + '\n',
10399
{ line: startRow, ch: 0 },
@@ -106,7 +102,7 @@ export default class TextEditorInterface {
106102
}
107103
}
108104

109-
transact(func) {
105+
transact (func) {
110106
this.transaction = true
111107
func()
112108
this.transaction = false

browser/main/modals/PreferencesModal/UiTab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ class UiTab extends React.Component {
420420
{i18n.__('Bring in web page title when pasting URL on editor')}
421421
</label>
422422
</div>
423-
423+
424424
<div styleName='group-checkBoxSection'>
425425
<label>
426426
<input onChange={(e) => this.handleUIChange(e)}

0 commit comments

Comments
 (0)