Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit a584a1e

Browse files
authored
fix incorrect annotation formating in lint (#213)
1 parent cdf3bd0 commit a584a1e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/lint.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
import CodeMirror from 'codemirror';
1111
import {getDiagnostics} from 'graphql-language-service-interface';
1212

13-
const SEVERITY = ['ERROR', 'WARNING', 'INFORMATION', 'HINT'];
13+
const SEVERITY = ['error', 'warning', 'information', 'hint'];
14+
const TYPE = {
15+
'GraphQL: Validation': 'validation',
16+
'GraphQL: Deprecation': 'deprecation',
17+
'GraphQL: Syntax': 'syntax',
18+
};
1419

1520
/**
1621
* Registers a "lint" helper for CodeMirror.
@@ -32,10 +37,10 @@ CodeMirror.registerHelper('lint', 'graphql', (text, options) => {
3237

3338
const results = rawResults.map(error => ({
3439
message: error.message,
35-
severity: SEVERITY[error.severity],
36-
type: error.source,
37-
from: error.range.start,
38-
to: error.range.end,
40+
severity: SEVERITY[error.severity - 1],
41+
type: TYPE[error.source],
42+
from: CodeMirror.Pos(error.range.start.line, error.range.start.character),
43+
to: CodeMirror.Pos(error.range.end.line, error.range.end.character),
3944
}));
4045

4146
return results;

0 commit comments

Comments
 (0)