Skip to content

Commit

Permalink
Correctly determine message type
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Jan 20, 2017
1 parent 04b5563 commit bfe3936
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/linting.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ function lint (textEditor, reportError) {
if (!report) return []

const { filePath } = report
return report.messages.map(({ fatal, message: text, line, column, source }) => ({
type: fatal ? 'Error' : 'Warning',
return report.messages.map(({ message: text, line, column, severity, source }) => ({
type: severity === 2 ? 'Error' : 'Warning',
text,
filePath,
range: getRange(line, column, source)
Expand Down
8 changes: 4 additions & 4 deletions test/lib/linting.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('lib/linting', () => {
},
{
ruleId: 'no-unused-vars',
severity: 2,
severity: 1,
message: '"foo" is defined but never used',
line: 1,
column: 5,
Expand All @@ -59,7 +59,7 @@ describe('lib/linting', () => {
fix: { range: [10, 15], text: "'bar'" }
},
{
fatal: true,
severity: 2,
message: 'Made up message to test fallback code paths'
}
],
Expand All @@ -75,7 +75,7 @@ describe('lib/linting', () => {
})
return expect(linting.lint(textEditor), 'to be fulfilled').then(report => expect(report, 'to equal', [
{
type: 'Warning',
type: 'Error',
text: 'Newline required at end of file but not found.',
filePath,
range: [ [ 0, 0 ], [ 0, 1 ] ]
Expand All @@ -87,7 +87,7 @@ describe('lib/linting', () => {
range: [ [ 0, 1 ], [ 0, 4 ] ]
},
{
type: 'Warning',
type: 'Error',
text: 'Strings must use singlequote.',
filePath,
range: [ [ 0, 1 ], [ 0, 10 ] ]
Expand Down

0 comments on commit bfe3936

Please sign in to comment.