Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #234 from AtomLinter/check-max-line
Browse files Browse the repository at this point in the history
Workaround jshint#2894
  • Loading branch information
Arcanemagus committed Mar 11, 2016
2 parents f813820 + 5145023 commit 5951296
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,19 @@ module.exports = {
range = Helpers.rangeFromLineNumber(textEditor, errorLine)
} else {
let character = error.character > 0 ? error.character - 1 : 0
let line = errorLine
const buffer = textEditor.getBuffer()
const maxLine = buffer.getLineCount()
// TODO: Remove workaround of jshint/jshint#2894
if (errorLine >= maxLine) {
line = maxLine
}
const maxCharacter = buffer.lineLengthForRow(line)
// TODO: Remove workaround of jquery/esprima#1457
const maxCharacter = textEditor.getBuffer().lineLengthForRow(errorLine)
if (character > maxCharacter) {
character = maxCharacter
}
range = Helpers.rangeFromLineNumber(textEditor, errorLine, character)
range = Helpers.rangeFromLineNumber(textEditor, line, character)
}

results.push({
Expand Down

0 comments on commit 5951296

Please sign in to comment.