Skip to content

Commit e9026be

Browse files
committed
Fix ESLint errors
1 parent fd5d0b0 commit e9026be

13 files changed

+137
-184
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
decls
2+
spec

lib/breakpoint-event.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@
44

55
import Breakpoint from './breakpoint'
66

7-
export type BreakpointEventType = 'inserted' | 'removed' | 'enabled' |
8-
'disabled' | 'moved' |
9-
'condition-added' | 'condition-removed'
7+
export type BreakpointEventType = 'inserted' | 'removed' | 'enabled' |
8+
'disabled' | 'moved' |
9+
'condition-added' | 'condition-removed'
1010

1111
export default class BreakpointEvent {
12-
type: BreakpointEventType;
12+
type: BreakpointEventType;
1313
breakpoint: Breakpoint;
14-
bufferRow: ?number;
14+
bufferRow: ?number;
1515

16-
constructor(
17-
type: BreakpointEventType, breakpoint: Breakpoint, bufferRow?: number) {
18-
19-
this.type = type
16+
constructor(type: BreakpointEventType,
17+
breakpoint: Breakpoint,
18+
bufferRow?: number) {
19+
this.type = type
2020
this.breakpoint = breakpoint
2121

2222
if (type === 'moved') {
23-
2423
if (bufferRow == null || typeof bufferRow !== 'number') {
2524
throw new Error('bufferRow must be a number')
2625
}

lib/breakpoint.js

+10-14
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@
33
/* @flow */
44

55
export type FunctionBreakpoint = { function: string }
6-
export type LineBreakpoint = { filePath: string, bufferRow: number }
6+
export type LineBreakpoint = { filePath: string, bufferRow: number }
77
export type BreakpointLocation = LineBreakpoint | FunctionBreakpoint
88

99
export default class Breakpoint {
10-
location: BreakpointLocation;
11-
enabled: boolean;
12-
condition: ?string;
10+
location: BreakpointLocation;
11+
enabled: boolean;
12+
condition: ?string;
1313
activeBufferRow: ?number;
1414

1515
constructor(location: BreakpointLocation, condition?: string) {
16-
1716
if (!location.function && (!location.filePath || !location.bufferRow)) {
1817
throw new TypeError('location must be BreakpointLocation')
1918
}
2019

21-
this.location = location
22-
this.condition = (condition) ? condition : null
23-
this.enabled = true
20+
this.location = location
21+
this.condition = condition || null
22+
this.enabled = true
2423
this.activeBufferRow = null
2524
}
2625

@@ -33,14 +32,12 @@ export default class Breakpoint {
3332
}
3433

3534
equals(other: Breakpoint): bool {
36-
3735
if (this.location.function && other.location.function) {
38-
3936
return (this.location.function === other.location.function)
4037
} else if (this.location.filePath && other.location.filePath) {
41-
const same_file = (this.location.filePath === other.location.filePath)
38+
const sameFile = (this.location.filePath === other.location.filePath)
4239

43-
if (same_file && this.location.bufferRow && other.location.bufferRow) {
40+
if (sameFile && this.location.bufferRow && other.location.bufferRow) {
4441
return (this.location.bufferRow === other.location.bufferRow)
4542
}
4643
}
@@ -49,9 +46,8 @@ export default class Breakpoint {
4946
}
5047

5148
toHumanized(): string {
52-
5349
if (this.location.filePath && this.location.bufferRow) {
54-
return this.location.filePath + ':' + (this.location.bufferRow+1)
50+
return `${this.location.filePath}:${this.location.bufferRow + 1}`
5551
}
5652

5753
return '?'

lib/debugger-controller.js

+15-21
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
/* @flow */
44

5-
import Breakpoint from './breakpoint'
6-
import DebuggerRegistry from './debugger-registry'
7-
import ProjectConfig from './project-config'
8-
import ViewRegistry from './view-registry'
5+
import Breakpoint from './breakpoint'
6+
import DebuggerRegistry from './debugger-registry'
7+
import ProjectConfig from './project-config'
8+
import ViewRegistry from './view-registry'
99

1010
import type { Debugger, DebuggerView } from './types'
1111

1212
export default class DebuggerController {
1313
debuggerRegistry: DebuggerRegistry;
14-
viewRegistry: ViewRegistry;
14+
viewRegistry: ViewRegistry;
1515

1616
constructor() {
1717
this.debuggerRegistry = new DebuggerRegistry()
18-
this.viewRegistry = new ViewRegistry(this)
18+
this.viewRegistry = new ViewRegistry(this)
1919

2020
atom.commands.add('atom-text-editor', {
2121
'debugger:start': () => { this.start() },
@@ -24,7 +24,7 @@ export default class DebuggerController {
2424
'debugger:pause': () => { this.pause() },
2525
'debugger:step-into': () => { this.stepInto() },
2626
'debugger:step-over': () => { this.stepOver() },
27-
'debugger:toggle-breakpoint-at-current-line': () => { this.toggleBreakpoint() }
27+
'debugger:toggle-breakpoint-at-current-line': () => { this.toggleBreakpoint() },
2828
})
2929
}
3030

@@ -33,7 +33,7 @@ export default class DebuggerController {
3333
}
3434

3535
addView(view: DebuggerView): void {
36-
this.viewRegistry.add(view);
36+
this.viewRegistry.add(view)
3737
}
3838

3939
deleteView(view: DebuggerView): void {
@@ -42,46 +42,40 @@ export default class DebuggerController {
4242

4343
/* Commands */
4444
start(): void {
45-
let proxy = this.debuggerRegistry.getDebuggerProxy()
46-
let config
45+
const proxy = this.debuggerRegistry.getDebuggerProxy()
4746

4847
if (proxy.getActiveDebugger() != null) {
49-
5048
atom.notifications.addError(
5149
'There is a session in progress. Please, exit first.')
5250

5351
return
5452
}
5553

56-
config = new ProjectConfig()
54+
const config = new ProjectConfig()
5755
config.tryLoad()
5856

5957
if (!config.data) {
60-
6158
atom.notifications.addError('The project has no config.')
6259

6360
return
6461
}
6562

6663
if (!config.data.target) {
67-
6864
atom.notifications.addError('The project has no target set.')
6965

7066
return
7167
}
7268

7369
if (!config.data.debugger) {
74-
7570
atom.notifications.addError('The project has no debugger set.')
7671

7772
return
7873
}
7974

8075
const target = config.data.target
81-
const debug = this.debuggerRegistry.get(config.data.debugger)
76+
const debug = this.debuggerRegistry.get(config.data.debugger)
8277

8378
if (!debug) {
84-
8579
atom.notifications.addFatalError('The debugger is unknown.')
8680

8781
return
@@ -117,14 +111,14 @@ export default class DebuggerController {
117111
return
118112
}
119113

120-
let breakpoint = new Breakpoint({
121-
filePath: activeEditor.getPath(),
122-
bufferRow: activeEditor.getCursorBufferPosition().row
114+
const breakpoint = new Breakpoint({
115+
filePath: activeEditor.getPath(),
116+
bufferRow: activeEditor.getCursorBufferPosition().row,
123117
})
124118

125119
const debug = this.debuggerRegistry.getDebuggerProxy()
126120

127-
if (debug.removeBreakpoint(breakpoint) == false) {
121+
if (debug.removeBreakpoint(breakpoint) === false) {
128122
debug.insertBreakpoint(breakpoint)
129123
}
130124
}

0 commit comments

Comments
 (0)