👕 Fix new coffeelint errors

This commit is contained in:
Machiste Quintana 2015-04-06 23:45:02 -04:00
parent 9b8d7d46fe
commit 5d2392ea67
41 changed files with 150 additions and 146 deletions

View File

@ -29,7 +29,7 @@ window.benchmark = (args...) ->
else
count = defaultCount
[fn, options] = args
{ profile, focused } = (options ? {})
{profile, focused} = (options ? {})
method = if focused then fit else it
method description, ->
@ -69,7 +69,7 @@ window.keyIdentifierForKey = (key) ->
"U+00" + charCode.toString(16)
window.keydownEvent = (key, properties={}) ->
$.Event "keydown", _.extend({originalEvent: { keyIdentifier: keyIdentifierForKey(key) }}, properties)
$.Event "keydown", _.extend({originalEvent: {keyIdentifier: keyIdentifierForKey(key)}}, properties)
window.clickEvent = (properties={}) ->
$.Event "click", properties
@ -93,7 +93,7 @@ window.pagePixelPositionForPoint = (editorView, point) ->
point = Point.fromObject point
top = editorView.lines.offset().top + point.row * editorView.lineHeight
left = editorView.lines.offset().left + point.column * editorView.charWidth - editorView.lines.scrollLeft()
{ top, left }
{top, left}
window.seteditorViewWidthInChars = (editorView, widthInChars, charWidth=editorView.charWidth) ->
editorView.width(charWidth * widthInChars + editorView.lines.position().left)

View File

@ -213,7 +213,7 @@ describe "TokenizedBuffer.", ->
beforeEach ->
editor = benchmarkFixturesProject.openSync('medium.coffee')
{ languageMode, buffer } = editor
{languageMode, buffer} = editor
benchmark "construction", 20, ->
new TokenizedBuffer(buffer, { languageMode, tabLength: 2})
new TokenizedBuffer(buffer, {languageMode, tabLength: 2})

View File

@ -209,13 +209,13 @@ template = (str) ->
'var p=[],print=function(){p.push.apply(p,arguments);};' +
'with(obj){p.push(\'' +
str.replace(/[\r\t\n]/g, " ")
.replace(/'(?=[^<]*%>)/g,"\t")
.split("'").join("\\'")
.split("\t").join("'")
.replace(/<%=(.+?)%>/g, "',$1,'")
.split('<%').join("');")
.split('%>').join("p.push('") +
"');}return p.join('');"
.replace(/'(?=[^<]*%>)/g,"\t")
.split("'").join("\\'")
.split("\t").join("'")
.replace(/<%=(.+?)%>/g, "',$1,'")
.split('<%').join("');")
.split('%>').join("p.push('") +
"');}return p.join('');"
# Create the template that we will use to generate the Docco HTML page.
docco_template = template fs.readFileSync(__dirname + '/../resources/docco.jst').toString()

View File

@ -17,7 +17,7 @@ parse_stack_trace = (raw) ->
addresses = []
for line in raw
columns = line.split /\ +/
if columns[1] == 'libcef.dylib' and /0x[a-f0-9]+/.test columns[3]
if columns[1] is 'libcef.dylib' and /0x[a-f0-9]+/.test columns[3]
lines[columns[0]] = addresses.length
addresses.push '0x' + parseInt(columns[5]).toString(16) + ' '
@ -36,12 +36,12 @@ parse_log_file = (content) ->
lines = content.split /\r?\n/
for line in lines
if state == 'start'
if state is 'start'
if /Thread \d+ Crashed::/.test line
console.log line
state = 'parse'
else if state == 'parse'
break if line == ''
else if state is 'parse'
break if line is ''
stack_trace.push line
parse_stack_trace stack_trace
@ -53,4 +53,3 @@ process.stdin.on 'data', (chunk) ->
input += chunk
process.stdin.on 'end', ->
parse_log_file input

View File

@ -251,9 +251,9 @@ describe "Config", ->
it "removes all scoped and unscoped properties for that key-path", ->
atom.config.setDefaults("foo.bar", baz: 100)
atom.config.set("foo.bar", { baz: 1, ok: 2 }, scopeSelector: ".a")
atom.config.set("foo.bar", { baz: 11, ok: 12 }, scopeSelector: ".b")
atom.config.set("foo.bar", { baz: 21, ok: 22 })
atom.config.set("foo.bar", {baz: 1, ok: 2}, scopeSelector: ".a")
atom.config.set("foo.bar", {baz: 11, ok: 12}, scopeSelector: ".b")
atom.config.set("foo.bar", {baz: 21, ok: 22})
atom.config.unset("foo.bar.baz")

View File

@ -1,4 +1,4 @@
class quicksort
class Quicksort
sort: (items) ->
return items if items.length <= 1
@ -13,6 +13,7 @@ class quicksort
if current < pivot
left.push(current)
else
# coffeelint: disable=no_trailing_semicolons
right.push(current);
sort(left).concat(pivot).concat(sort(right))

View File

@ -1,5 +1,5 @@
module.exports =
configDefaults:
numbers: { one: 1, two: 2 }
numbers: {one: 1, two: 2}
activate: -> # no-op

View File

@ -1,4 +1,6 @@
# This is a comment
# coffeelint: disable=no_tabs
# coffeelint: disable=indentation
if this.studyingEconomics
buy() while supply > demand
sell() until supply > demand
buy() while supply > demand
sell() until supply > demand

View File

@ -1,3 +1,5 @@
# coffeelint: disable=no_tabs
# coffeelint: disable=no_trailing_whitespace
# Econ 101
if this.studyingEconomics
buy() while supply > demand

View File

@ -330,32 +330,32 @@ describe "PackageManager", ->
element2 = $$ -> @div class: 'test-2'
element3 = $$ -> @div class: 'test-3'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element2[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element3[0])).toHaveLength 0
waitsForPromise ->
atom.packages.activatePackage("package-with-keymaps")
runs ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])[0].command).toBe "test-1"
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element2[0])[0].command).toBe "test-2"
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element3[0])).toHaveLength 0
describe "when the metadata contains a 'keymaps' manifest", ->
it "loads only the keymaps specified by the manifest, in the specified order", ->
element1 = $$ -> @div class: 'test-1'
element3 = $$ -> @div class: 'test-3'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])).toHaveLength 0
waitsForPromise ->
atom.packages.activatePackage("package-with-keymaps-manifest")
runs ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])[0].command).toBe 'keymap-1'
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-n', target: element1[0])[0].command).toBe 'keymap-2'
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-y', target: element3[0])).toHaveLength 0
describe "when the keymap file is empty", ->
it "does not throw an error on activation", ->
@ -645,8 +645,8 @@ describe "PackageManager", ->
runs ->
atom.packages.deactivatePackage('package-with-keymaps')
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target: ($$ -> @div class: 'test-1')[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target: ($$ -> @div class: 'test-2')[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: ($$ -> @div class: 'test-1')[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: ($$ -> @div class: 'test-2')[0])).toHaveLength 0
it "removes the package's stylesheets", ->
waitsForPromise ->

View File

@ -15,7 +15,7 @@ describe "PaneContainerView", ->
@deserialize: ({name}) -> new TestView(name)
@content: -> @div tabindex: -1
initialize: (@name) -> @text(@name)
serialize: -> { deserializer: 'TestView', @name }
serialize: -> {deserializer: 'TestView', @name}
getURI: -> path.join(temp.dir, @name)
save: -> @saved = true
isEqual: (other) -> @name is other?.name

View File

@ -14,9 +14,9 @@ describe "PaneView", ->
@content: ({id, text}) -> @div class: 'test-view', id: id, tabindex: -1, text
initialize: ({@id, @text}) ->
@emitter = new Emitter
serialize: -> { deserializer: 'TestView', @id, @text }
serialize: -> {deserializer: 'TestView', @id, @text}
getURI: -> @id
isEqual: (other) -> other? and @id == other.id and @text == other.text
isEqual: (other) -> other? and @id is other.id and @text is other.text
changeTitle: ->
@emitter.emit 'did-change-title', 'title'
onDidChangeTitle: (callback) ->
@ -222,7 +222,7 @@ describe "PaneView", ->
fs.removeSync(filePath)
waitsFor ->
pane.items.length == 4
pane.items.length is 4
describe "when a pane is destroyed", ->
[pane2, pane2Model] = []

View File

@ -69,7 +69,7 @@ if specDirectory
specPackageName = JSON.parse(fs.readFileSync(path.join(specPackagePath, 'package.json')))?.name
specProjectPath = path.join(specDirectory, 'fixtures')
isCoreSpec = specDirectory == fs.realpathSync(__dirname)
isCoreSpec = specDirectory is fs.realpathSync(__dirname)
beforeEach ->
$.fx.off = true
@ -234,7 +234,7 @@ addCustomMatchers = (spec) ->
else
notText = if @isNot then " not" else ""
this.message = => "Expected object with length #{@actual.length} to#{notText} have length #{expected}"
@actual.length == expected
@actual.length is expected
toExistOnDisk: (expected) ->
notText = this.isNot and " not" or ""
@ -297,7 +297,7 @@ window.mousemoveEvent = (properties={}) ->
window.waitsForPromise = (args...) ->
if args.length > 1
{ shouldReject, timeout } = args[0]
{shouldReject, timeout} = args[0]
else
shouldReject = false
fn = _.last(args)
@ -328,7 +328,7 @@ window.fakeSetTimeout = (callback, ms) ->
id
window.fakeClearTimeout = (idToClear) ->
window.timeouts = window.timeouts.filter ([id]) -> id != idToClear
window.timeouts = window.timeouts.filter ([id]) -> id isnt idToClear
window.fakeSetInterval = (callback, ms) ->
id = ++window.intervalCount
@ -358,7 +358,7 @@ window.pagePixelPositionForPoint = (editorView, point) ->
point = Point.fromObject point
top = editorView.renderedLines.offset().top + point.row * editorView.lineHeight
left = editorView.renderedLines.offset().left + point.column * editorView.charWidth - editorView.renderedLines.scrollLeft()
{ top, left }
{top, left}
window.tokensText = (tokens) ->
_.pluck(tokens, 'value').join('')

View File

@ -547,7 +547,7 @@ describe "TextEditor", ->
lastLine = buffer.lineForRow(lastLineIndex)
expect(lastLine.length).toBeGreaterThan(0)
lastPosition = { row: lastLineIndex, column: lastLine.length }
lastPosition = {row: lastLineIndex, column: lastLine.length}
editor.setCursorScreenPosition(lastPosition)
editor.moveRight()

View File

@ -84,7 +84,7 @@ describe "ThemeManager", ->
atom.config.set('core.themes', [])
waitsFor ->
didChangeActiveThemesHandler.callCount == 1
didChangeActiveThemesHandler.callCount is 1
runs ->
didChangeActiveThemesHandler.reset()
@ -92,7 +92,7 @@ describe "ThemeManager", ->
atom.config.set('core.themes', ['atom-dark-ui'])
waitsFor ->
didChangeActiveThemesHandler.callCount == 1
didChangeActiveThemesHandler.callCount is 1
runs ->
didChangeActiveThemesHandler.reset()
@ -101,7 +101,7 @@ describe "ThemeManager", ->
atom.config.set('core.themes', ['atom-light-ui', 'atom-dark-ui'])
waitsFor ->
didChangeActiveThemesHandler.callCount == 1
didChangeActiveThemesHandler.callCount is 1
runs ->
didChangeActiveThemesHandler.reset()
@ -111,7 +111,7 @@ describe "ThemeManager", ->
atom.config.set('core.themes', [])
waitsFor ->
didChangeActiveThemesHandler.callCount == 1
didChangeActiveThemesHandler.callCount is 1
runs ->
didChangeActiveThemesHandler.reset()
@ -120,7 +120,7 @@ describe "ThemeManager", ->
atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui'])
waitsFor ->
didChangeActiveThemesHandler.callCount == 1
didChangeActiveThemesHandler.callCount is 1
runs ->
expect($('style[priority=1]')).toHaveLength 2

View File

@ -352,7 +352,7 @@ describe "TokenizedBuffer", ->
tabAsSpaces = _.multiplyString(' ', tokenizedBuffer.getTabLength())
screenLine0 = tokenizedBuffer.tokenizedLineForRow(0)
expect(screenLine0.text).toBe "# Econ 101#{tabAsSpaces}"
{ tokens } = screenLine0
{tokens} = screenLine0
expect(tokens.length).toBe 4
expect(tokens[0].value).toBe "#"
@ -452,7 +452,7 @@ describe "TokenizedBuffer", ->
it "renders each UTF-8 surrogate pair as its own atomic token", ->
screenLine0 = tokenizedBuffer.tokenizedLineForRow(0)
expect(screenLine0.text).toBe "'abc\uD835\uDF97def'"
{ tokens } = screenLine0
{tokens} = screenLine0
expect(tokens.length).toBe 5
expect(tokens[0].value).toBe "'"
@ -464,7 +464,7 @@ describe "TokenizedBuffer", ->
screenLine1 = tokenizedBuffer.tokenizedLineForRow(1)
expect(screenLine1.text).toBe "//\uD835\uDF97xyz"
{ tokens } = screenLine1
{tokens} = screenLine1
expect(tokens.length).toBe 4
expect(tokens[0].value).toBe '//'

View File

@ -189,7 +189,7 @@ describe "Workspace", ->
workspace.open('a', split: 'right').then (o) -> editor = o
runs ->
pane2 = workspace.getPanes().filter((p) -> p != pane1)[0]
pane2 = workspace.getPanes().filter((p) -> p isnt pane1)[0]
expect(workspace.getActivePane()).toBe pane2
expect(pane1.items).toEqual []
expect(pane2.items).toEqual [editor]
@ -218,7 +218,7 @@ describe "Workspace", ->
workspace.open('a', split: 'right').then (o) -> editor = o
runs ->
pane4 = workspace.getPanes().filter((p) -> p != pane1)[0]
pane4 = workspace.getPanes().filter((p) -> p isnt pane1)[0]
expect(workspace.getActivePane()).toBe pane4
expect(pane4.items).toEqual [editor]
expect(workspace.paneContainer.root.children[0]).toBe pane1
@ -226,19 +226,19 @@ describe "Workspace", ->
describe "when passed a path that matches a custom opener", ->
it "returns the resource returned by the custom opener", ->
fooOpener = (pathToOpen, options) -> { foo: pathToOpen, options } if pathToOpen?.match(/\.foo/)
barOpener = (pathToOpen) -> { bar: pathToOpen } if pathToOpen?.match(/^bar:\/\//)
fooOpener = (pathToOpen, options) -> {foo: pathToOpen, options} if pathToOpen?.match(/\.foo/)
barOpener = (pathToOpen) -> {bar: pathToOpen} if pathToOpen?.match(/^bar:\/\//)
workspace.addOpener(fooOpener)
workspace.addOpener(barOpener)
waitsForPromise ->
pathToOpen = atom.project.getDirectories()[0]?.resolve('a.foo')
workspace.open(pathToOpen, hey: "there").then (item) ->
expect(item).toEqual { foo: pathToOpen, options: {hey: "there"} }
expect(item).toEqual {foo: pathToOpen, options: {hey: "there"}}
waitsForPromise ->
workspace.open("bar://baz").then (item) ->
expect(item).toEqual { bar: "bar://baz" }
expect(item).toEqual {bar: "bar://baz"}
it "notifies ::onDidAddTextEditor observers", ->
absolutePath = require.resolve('./fixtures/dir/a')
@ -835,7 +835,7 @@ describe "Workspace", ->
runs ->
expect(results).toHaveLength 3
resultForA = _.find results, ({filePath}) -> path.basename(filePath) == 'a'
resultForA = _.find results, ({filePath}) -> path.basename(filePath) is 'a'
expect(resultForA.matches).toHaveLength 1
expect(resultForA.matches[0].matchText).toBe 'Elephant'

View File

@ -499,7 +499,7 @@ class Atom extends Model
# Extended: Toggle the full screen state of the current window.
toggleFullScreen: ->
@setFullScreen(!@isFullScreen())
@setFullScreen(not @isFullScreen())
# Schedule the window to be shown and focused on the next tick.
#

View File

@ -87,15 +87,15 @@ class ApplicationMenu
# Replaces VERSION with the current version.
substituteVersion: (template) ->
if (item = _.find(@flattenMenuTemplate(template), ({label}) -> label == 'VERSION'))
if (item = _.find(@flattenMenuTemplate(template), ({label}) -> label is 'VERSION'))
item.label = "Version #{@version}"
# Sets the proper visible state the update menu items
showUpdateMenuItem: (state) ->
checkForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Check for Update')
checkingForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Checking for Update')
downloadingUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Downloading Update')
installUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Restart and Install Update')
checkForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Check for Update')
checkingForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Checking for Update')
downloadingUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Downloading Update')
installUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Restart and Install Update')
return unless checkForUpdateItem? and checkingForUpdateItem? and downloadingUpdateItem? and installUpdateItem?
@ -121,11 +121,11 @@ class ApplicationMenu
[
label: "Atom"
submenu: [
{ label: "Check for Update", metadata: {autoUpdate: true}}
{ label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload() }
{ label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close() }
{ label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools() }
{ label: 'Quit', accelerator: 'Command+Q', click: -> app.quit() }
{label: "Check for Update", metadata: {autoUpdate: true}}
{label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()}
{label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()}
{label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()}
{label: 'Quit', accelerator: 'Command+Q', click: -> app.quit()}
]
]

View File

@ -95,7 +95,7 @@ class AtomApplication
# Public: Removes the {AtomWindow} from the global window list.
removeWindow: (window) ->
@windows.splice @windows.indexOf(window), 1
@applicationMenu?.enableWindowSpecificItems(false) if @windows.length == 0
@applicationMenu?.enableWindowSpecificItems(false) if @windows.length is 0
# Public: Adds the {AtomWindow} to the global window list.
addWindow: (window) ->

View File

@ -6,7 +6,7 @@ runas = null # defer until used
symlinkCommand = (sourcePath, destinationPath, callback) ->
fs.unlink destinationPath, (error) ->
if error? and error?.code != 'ENOENT'
if error? and error?.code isnt 'ENOENT'
callback(error)
else
fs.makeTree path.dirname(destinationPath), (error) ->
@ -17,13 +17,13 @@ symlinkCommand = (sourcePath, destinationPath, callback) ->
symlinkCommandWithPrivilegeSync = (sourcePath, destinationPath) ->
runas ?= require 'runas'
if runas('/bin/rm', ['-f', destinationPath], admin: true) != 0
if runas('/bin/rm', ['-f', destinationPath], admin: true) isnt 0
throw new Error("Failed to remove '#{destinationPath}'")
if runas('/bin/mkdir', ['-p', path.dirname(destinationPath)], admin: true) != 0
if runas('/bin/mkdir', ['-p', path.dirname(destinationPath)], admin: true) isnt 0
throw new Error("Failed to create directory '#{destinationPath}'")
if runas('/bin/ln', ['-s', sourcePath, destinationPath], admin: true) != 0
if runas('/bin/ln', ['-s', sourcePath, destinationPath], admin: true) isnt 0
throw new Error("Failed to symlink '#{sourcePath}' to '#{destinationPath}'")
module.exports =

View File

@ -1128,7 +1128,7 @@ splitKeyPath = (keyPath) ->
startIndex = 0
keyPathArray = []
for char, i in keyPath
if char is '.' and (i is 0 or keyPath[i-1] != '\\')
if char is '.' and (i is 0 or keyPath[i-1] isnt '\\')
keyPathArray.push keyPath.substring(startIndex, i)
startIndex = i + 1
keyPathArray.push keyPath.substr(startIndex, keyPath.length)

View File

@ -156,7 +156,7 @@ class Cursor extends Model
# Public: Returns whether the cursor is at the start of a line.
isAtBeginningOfLine: ->
@getBufferPosition().column == 0
@getBufferPosition().column is 0
# Public: Returns whether the cursor is on the line return character.
isAtEndOfLine: ->
@ -210,7 +210,7 @@ class Cursor extends Model
isInsideWord: (options) ->
{row, column} = @getBufferPosition()
range = [[row, column], [row, Infinity]]
@editor.getTextInBufferRange(range).search(options?.wordRegex ? @wordRegExp()) == 0
@editor.getTextInBufferRange(range).search(options?.wordRegex ? @wordRegExp()) is 0
# Public: Returns the indentation level of the current line.
getIndentLevel: ->
@ -243,7 +243,7 @@ class Cursor extends Model
#
# Returns a {Boolean}.
isLastCursor: ->
this == @editor.getLastCursor()
this is @editor.getLastCursor()
###
Section: Moving the Cursor
@ -258,9 +258,9 @@ class Cursor extends Model
moveUp: (rowCount=1, {moveToEndOfSelection}={}) ->
range = @marker.getScreenRange()
if moveToEndOfSelection and not range.isEmpty()
{ row, column } = range.start
{row, column} = range.start
else
{ row, column } = @getScreenPosition()
{row, column} = @getScreenPosition()
column = @goalColumn if @goalColumn?
@setScreenPosition({row: row - rowCount, column: column}, skipSoftWrapIndentation: true)
@ -275,9 +275,9 @@ class Cursor extends Model
moveDown: (rowCount=1, {moveToEndOfSelection}={}) ->
range = @marker.getScreenRange()
if moveToEndOfSelection and not range.isEmpty()
{ row, column } = range.end
{row, column} = range.end
else
{ row, column } = @getScreenPosition()
{row, column} = @getScreenPosition()
column = @goalColumn if @goalColumn?
@setScreenPosition({row: row + rowCount, column: column}, skipSoftWrapIndentation: true)
@ -315,7 +315,7 @@ class Cursor extends Model
if moveToEndOfSelection and not range.isEmpty()
@setScreenPosition(range.end)
else
{ row, column } = @getScreenPosition()
{row, column} = @getScreenPosition()
maxLines = @editor.getScreenLineCount()
rowLength = @editor.lineTextForScreenRow(row).length
columnsRemainingInLine = rowLength - column
@ -586,7 +586,7 @@ class Cursor extends Model
# Public: Sets whether the cursor is visible.
setVisible: (visible) ->
if @visible != visible
if @visible isnt visible
@visible = visible
@emit 'visibility-changed', @visible if Grim.includeDeprecatedAPIs
@emitter.emit 'did-change-visibility', @visible
@ -664,7 +664,7 @@ class Cursor extends Model
position = new Point(row, column - 1)
@editor.scanInBufferRange /^\n*$/g, scanRange, ({range, stop}) ->
if !range.start.isEqual(start)
unless range.start.isEqual(start)
position = range.start
stop()
position
@ -677,7 +677,7 @@ class Cursor extends Model
position = new Point(0, 0)
zero = new Point(0,0)
@editor.backwardsScanInBufferRange /^\n*$/g, scanRange, ({range, stop}) ->
if !range.start.isEqual(zero)
unless range.start.isEqual(zero)
position = range.start
stop()
position

View File

@ -146,7 +146,7 @@ class Decoration
matchesPattern: (decorationPattern) ->
return false unless decorationPattern?
for key, value of decorationPattern
return false if @properties[key] != value
return false if @properties[key] isnt value
true
onDidFlash: (callback) ->

View File

@ -16,7 +16,7 @@ class DefaultDirectoryProvider
directoryForURISync: (uri) ->
projectPath = path.normalize(uri)
directoryPath = if !fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath))
directoryPath = if not fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath))
path.dirname(projectPath)
else
projectPath

View File

@ -166,7 +166,7 @@ class DisplayBuffer extends Model
@updateAllScreenLines()
screenDelta = @getLastRow() - end
bufferDelta = 0
@emitDidChange({ start, end, screenDelta, bufferDelta })
@emitDidChange({start, end, screenDelta, bufferDelta})
# Sets the visibility of the tokenized buffer.
#
@ -740,7 +740,7 @@ class DisplayBuffer extends Model
screenPositionForBufferPosition: (bufferPosition, options) ->
throw new Error("This TextEditor has been destroyed") if @isDestroyed()
{ row, column } = @buffer.clipPosition(bufferPosition)
{row, column} = @buffer.clipPosition(bufferPosition)
[startScreenRow, endScreenRow] = @rowMap.screenRowRangeForBufferRow(row)
for screenRow in [startScreenRow...endScreenRow]
screenLine = @screenLines[screenRow]
@ -774,7 +774,7 @@ class DisplayBuffer extends Model
#
# Returns a {Point}.
bufferPositionForScreenPosition: (screenPosition, options) ->
{ row, column } = @clipScreenPosition(Point.fromObject(screenPosition), options)
{row, column} = @clipScreenPosition(Point.fromObject(screenPosition), options)
[bufferRow] = @rowMap.bufferRowRangeForScreenRow(row)
new Point(bufferRow, @screenLines[row].bufferColumnForScreenColumn(column))
@ -828,8 +828,8 @@ class DisplayBuffer extends Model
#
# Returns the new, clipped {Point}. Note that this could be the same as `position` if no clipping was performed.
clipScreenPosition: (screenPosition, options={}) ->
{ wrapBeyondNewlines, wrapAtSoftNewlines, skipSoftWrapIndentation } = options
{ row, column } = Point.fromObject(screenPosition)
{wrapBeyondNewlines, wrapAtSoftNewlines, skipSoftWrapIndentation} = options
{row, column} = Point.fromObject(screenPosition)
if row < 0
row = 0

View File

@ -122,7 +122,7 @@ class LanguageMode
continue unless startRow?
# assumption: startRow will always be the min indent level for the entire range
if @editor.indentationForBufferRow(startRow) == indentLevel
if @editor.indentationForBufferRow(startRow) is indentLevel
@editor.createFold(startRow, endRow)
return
@ -178,7 +178,7 @@ class LanguageMode
continue if @editor.isBufferRowBlank(row)
indentation = @editor.indentationForBufferRow(row)
if indentation <= startIndentLevel
includeRowInFold = indentation == startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row))
includeRowInFold = indentation is startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row))
foldEndRow = row if includeRowInFold
break
@ -211,14 +211,14 @@ class LanguageMode
startRow = bufferRow
while startRow > firstRow
break if @isLineCommentedAtBufferRow(startRow - 1) != isOriginalRowComment
break if @isLineCommentedAtBufferRow(startRow - 1) isnt isOriginalRowComment
break unless /\w/.test(@editor.lineTextForBufferRow(startRow - 1))
startRow--
endRow = bufferRow
lastRow = @editor.getLastBufferRow()
while endRow < lastRow
break if @isLineCommentedAtBufferRow(endRow + 1) != isOriginalRowComment
break if @isLineCommentedAtBufferRow(endRow + 1) isnt isOriginalRowComment
break unless /\w/.test(@editor.lineTextForBufferRow(endRow + 1))
endRow++

View File

@ -164,7 +164,7 @@ class MenuManager
filtered = {}
for key, bindings of keystrokesByCommand
for binding in bindings
continue if binding.indexOf(' ') != -1
continue if binding.indexOf(' ') isnt -1
filtered[key] ?= []
filtered[key].push(binding)

View File

@ -27,9 +27,9 @@ class Notification
getDetail: -> @options.detail
isEqual: (other) ->
@getMessage() == other.getMessage() \
and @getType() == other.getType() \
and @getDetail() == other.getDetail()
@getMessage() is other.getMessage() \
and @getType() is other.getType() \
and @getDetail() is other.getDetail()
dismiss: ->
return unless @isDismissable() and not @isDismissed()

View File

@ -37,7 +37,7 @@ class OverlayManager
# The same node may be used in more than one overlay. This steals the node
# back if it has been displayed in another overlay.
overlayNode.appendChild(itemView) if overlayNode.childNodes.length == 0
overlayNode.appendChild(itemView) if overlayNode.childNodes.length is 0
cachedOverlay.pixelPosition = pixelPosition
overlayNode.style.top = pixelPosition.top + 'px'

View File

@ -31,7 +31,7 @@ class PaneAxisElement extends HTMLElement
view = atom.views.getView(child)
view.remove()
childReplaced: ({index, oldChild, newChild}) ->
childReplaced: ({index, oldChild, newChild}) ->
focusedElement = document.activeElement if @hasFocus()
@childRemoved({child: oldChild, index})
@childAdded({child: newChild, index})

View File

@ -339,7 +339,7 @@ class Project extends Model
@findBufferForPath(@resolvePath(filePath))?.isModified()
findBufferForPath: (filePath) ->
_.find @buffers, (buffer) -> buffer.getPath() == filePath
_.find @buffers, (buffer) -> buffer.getPath() is filePath
# Only to be used in specs
bufferForPathSync: (filePath) ->

View File

@ -34,7 +34,7 @@ module.exports = (rootPaths, regexSource, options) ->
scanner.on 'path-found', ->
pathsSearched++
if pathsSearched % PATHS_COUNTER_SEARCHED_CHUNK == 0
if pathsSearched % PATHS_COUNTER_SEARCHED_CHUNK is 0
emit('scan:paths-searched', pathsSearched)
search regex, scanner, searcher, ->

View File

@ -110,7 +110,7 @@ class Selection extends Model
range = @getBufferRange()
start = range.start.row
end = range.end.row
end = Math.max(start, end - 1) if range.end.column == 0
end = Math.max(start, end - 1) if range.end.column is 0
[start, end]
getTailScreenPosition: ->
@ -386,7 +386,7 @@ class Selection extends Model
if autoIndentFirstLine
@editor.setIndentationForBufferRow(oldBufferRange.start.row, desiredIndentLevel)
if options.autoIndentNewline and text == '\n'
if options.autoIndentNewline and text is '\n'
currentIndentation = @editor.indentationForBufferRow(newBufferRange.start.row)
@editor.autoIndentBufferRow(newBufferRange.end.row, preserveLeadingWhitespace: true, skipBlankLines: false)
if @editor.indentationForBufferRow(newBufferRange.end.row) < currentIndentation
@ -601,7 +601,7 @@ class Selection extends Model
# of levels. Leaves the first line unchanged.
adjustIndent: (lines, indentAdjustment) ->
for line, i in lines
if indentAdjustment == 0 or line is ''
if indentAdjustment is 0 or line is ''
continue
else if indentAdjustment > 0
lines[i] = @editor.buildIndentString(indentAdjustment) + line
@ -620,8 +620,8 @@ class Selection extends Model
# * `options` (optional) {Object} with the keys:
# * `autoIndent` If `true`, the line is indented to an automatically-inferred
# level. Otherwise, {TextEditor::getTabText} is inserted.
indent: ({ autoIndent }={}) ->
{ row, column } = @cursor.getBufferPosition()
indent: ({autoIndent}={}) ->
{row, column} = @cursor.getBufferPosition()
if @isEmpty()
@cursor.skipLeadingWhitespace()
@ -640,7 +640,7 @@ class Selection extends Model
indentSelectedRows: ->
[start, end] = @getBufferRowRange()
for row in [start..end]
@editor.buffer.insert([row, 0], @editor.getTabText()) unless @editor.buffer.lineLengthForRow(row) == 0
@editor.buffer.insert([row, 0], @editor.getTabText()) unless @editor.buffer.lineLengthForRow(row) is 0
return
###

View File

@ -117,7 +117,7 @@ class TextEditorComponent
@cursorMoved = false
@selectionChanged = false
if @editor.getLastSelection()? and !@editor.getLastSelection().isEmpty()
if @editor.getLastSelection()? and not @editor.getLastSelection().isEmpty()
@domNode.classList.add('has-selection')
else
@domNode.classList.remove('has-selection')

View File

@ -949,14 +949,14 @@ class TextEditor extends Model
# For each selection, if the selection is empty, converts the containing word
# to upper case. Otherwise convert the selected text to upper case.
upperCase: ->
@replaceSelectedText selectWordIfEmpty:true, (text) -> text.toUpperCase()
@replaceSelectedText selectWordIfEmpty: true, (text) -> text.toUpperCase()
# Extended: Convert the selected text to lower case.
#
# For each selection, if the selection is empty, converts the containing word
# to upper case. Otherwise convert the selected text to upper case.
lowerCase: ->
@replaceSelectedText selectWordIfEmpty:true, (text) -> text.toLowerCase()
@replaceSelectedText selectWordIfEmpty: true, (text) -> text.toLowerCase()
# Extended: Toggle line comments for rows intersecting selections.
#
@ -2464,7 +2464,7 @@ class TextEditor extends Model
{cursor} = selection
if indentBasis?
containsNewlines = text.indexOf('\n') isnt -1
if containsNewlines or !cursor.hasPrecedingCharactersOnLine()
if containsNewlines or not cursor.hasPrecedingCharactersOnLine()
options.indentBasis ?= indentBasis
if fullLine and selection.isEmpty()

View File

@ -27,7 +27,7 @@ class Token
isEqual: (other) ->
# TODO: scopes is deprecated. This is here for the sake of lang package tests
@value == other.value and _.isEqual(@scopes, other.scopes) and !!@isAtomic == !!other.isAtomic
@value is other.value and _.isEqual(@scopes, other.scopes) and !!@isAtomic is !!other.isAtomic
isBracket: ->
/^meta\.brace\b/.test(_.last(@scopes))

View File

@ -154,11 +154,11 @@ class TokenizedBuffer extends Model
loop
previousStack = @stackForRow(row)
@tokenizedLines[row] = @buildTokenizedLineForRow(row, @stackForRow(row - 1))
if --rowsRemaining == 0
if --rowsRemaining is 0
filledRegion = false
endRow = row
break
if row == lastRow or _.isEqual(@stackForRow(row), previousStack)
if row is lastRow or _.isEqual(@stackForRow(row), previousStack)
filledRegion = true
endRow = row
break
@ -280,7 +280,7 @@ class TokenizedBuffer extends Model
ruleStack = startingStack
stopTokenizingAt = startRow + @chunkSize
tokenizedLines = for row in [startRow..endRow]
if (ruleStack or row == 0) and row < stopTokenizingAt
if (ruleStack or row is 0) and row < stopTokenizingAt
screenLine = @buildTokenizedLineForRow(row, ruleStack)
ruleStack = screenLine.ruleStack
else
@ -390,7 +390,7 @@ class TokenizedBuffer extends Model
iterateTokensInBufferRange: (bufferRange, iterator) ->
bufferRange = Range.fromObject(bufferRange)
{ start, end } = bufferRange
{start, end} = bufferRange
keepLooping = true
stop = -> keepLooping = false
@ -399,13 +399,13 @@ class TokenizedBuffer extends Model
bufferColumn = 0
for token in @tokenizedLines[bufferRow].tokens
startOfToken = new Point(bufferRow, bufferColumn)
iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken)
iterator(token, startOfToken, {stop}) if bufferRange.containsPoint(startOfToken)
return unless keepLooping
bufferColumn += token.bufferDelta
backwardsIterateTokensInBufferRange: (bufferRange, iterator) ->
bufferRange = Range.fromObject(bufferRange)
{ start, end } = bufferRange
{start, end} = bufferRange
keepLooping = true
stop = -> keepLooping = false
@ -415,20 +415,20 @@ class TokenizedBuffer extends Model
for token in new Array(@tokenizedLines[bufferRow].tokens...).reverse()
bufferColumn -= token.bufferDelta
startOfToken = new Point(bufferRow, bufferColumn)
iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken)
iterator(token, startOfToken, {stop}) if bufferRange.containsPoint(startOfToken)
return unless keepLooping
findOpeningBracket: (startBufferPosition) ->
range = [[0,0], startBufferPosition]
position = null
depth = 0
@backwardsIterateTokensInBufferRange range, (token, startPosition, { stop }) ->
@backwardsIterateTokensInBufferRange range, (token, startPosition, {stop}) ->
if token.isBracket()
if token.value == '}'
if token.value is '}'
depth++
else if token.value == '{'
else if token.value is '{'
depth--
if depth == 0
if depth is 0
position = startPosition
stop()
position
@ -437,13 +437,13 @@ class TokenizedBuffer extends Model
range = [startBufferPosition, @buffer.getEndPosition()]
position = null
depth = 0
@iterateTokensInBufferRange range, (token, startPosition, { stop }) ->
@iterateTokensInBufferRange range, (token, startPosition, {stop}) ->
if token.isBracket()
if token.value == '{'
if token.value is '{'
depth++
else if token.value == '}'
else if token.value is '}'
depth--
if depth == 0
if depth is 0
position = startPosition
stop()
position

View File

@ -52,9 +52,9 @@ class TokenizedLine
#
# Returns a {Number} representing the clipped column.
clipScreenColumn: (column, options={}) ->
return 0 if @tokens.length == 0
return 0 if @tokens.length is 0
{ clip } = options
{clip} = options
column = Math.min(column, @getMaxScreenColumn())
tokenStartColumn = 0
@ -65,9 +65,9 @@ class TokenizedLine
if @isColumnInsideSoftWrapIndentation(tokenStartColumn)
@softWrapIndentationDelta
else if token.isAtomic and tokenStartColumn < column
if clip == 'forward'
if clip is 'forward'
tokenStartColumn + token.screenDelta
else if clip == 'backward'
else if clip is 'backward'
tokenStartColumn
else #'closest'
if column > tokenStartColumn + (token.screenDelta / 2)
@ -140,7 +140,7 @@ class TokenizedLine
indentTokens
softWrapAt: (column, hangingIndent) ->
return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0
return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column is 0
rightTokens = new Array(@tokens...)
leftTokens = []
@ -179,7 +179,7 @@ class TokenizedLine
@lineEnding is null
isColumnInsideSoftWrapIndentation: (column) ->
return false if @softWrapIndentationTokens.length == 0
return false if @softWrapIndentationTokens.length is 0
column < @softWrapIndentationDelta
@ -190,7 +190,7 @@ class TokenizedLine
_.reduce @softWrapIndentationTokens, ((acc, token) -> acc + token.screenDelta), 0
hasOnlySoftWrapIndentation: ->
@tokens.length == @softWrapIndentationTokens.length
@tokens.length is @softWrapIndentationTokens.length
tokenAtBufferColumn: (bufferColumn) ->
@tokens[@tokenIndexAtBufferColumn(bufferColumn)]

View File

@ -85,7 +85,7 @@ class WindowEventHandler
if process.platform in ['win32', 'linux']
@subscribeToCommand $(window), 'window:toggle-menu-bar', ->
atom.config.set('core.autoHideMenuBar', !atom.config.get('core.autoHideMenuBar'))
atom.config.set('core.autoHideMenuBar', not atom.config.get('core.autoHideMenuBar'))
@subscribeToCommand $(document), 'core:focus-next', @focusNext

View File

@ -400,7 +400,7 @@ class Workspace extends Model
uri = atom.project.resolvePath(uri)
item = @getActivePane().itemForURI(uri)
if uri
item ?= opener(uri, options) for opener in @getOpeners() when !item
item ?= opener(uri, options) for opener in @getOpeners() when not item
item ?= atom.project.openSync(uri, {initialLine, initialColumn})
@getActivePane().activateItem(item)
@ -419,7 +419,7 @@ class Workspace extends Model
if uri?
item = pane.itemForURI(uri)
item ?= opener(uri, options) for opener in @getOpeners() when !item
item ?= opener(uri, options) for opener in @getOpeners() when not item
try
item ?= atom.project.open(uri, options)
@ -865,8 +865,8 @@ class Workspace extends Model
openPaths = (buffer.getPath() for buffer in atom.project.getBuffers())
outOfProcessPaths = _.difference(filePaths, openPaths)
inProcessFinished = !openPaths.length
outOfProcessFinished = !outOfProcessPaths.length
inProcessFinished = not openPaths.length
outOfProcessFinished = not outOfProcessPaths.length
checkFinished = ->
deferred.resolve() if outOfProcessFinished and inProcessFinished