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

Commit 88f8f82

Browse files
committed
V2 linter API support
1 parent bc85ee1 commit 88f8f82

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

lib/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ export function provideLinter() {
2828
const column = 0;
2929

3030
return Promise.resolve([{
31-
type: 'Error',
32-
text: message,
33-
filePath: path,
34-
range: new Range([line, column], [line, column + 1])
31+
severity: 'error',
32+
excerpt: message,
33+
location: {
34+
file: path,
35+
position: new Range([line, column], [line, column + 1])
36+
}
3537
}]);
3638
}
3739

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@
5959
}
6060
},
6161
"package-deps": [
62-
"linter"
62+
"linter:2.0.0"
6363
],
6464
"providedServices": {
6565
"linter": {
6666
"versions": {
67-
"1.0.0": "provideLinter"
67+
"2.0.0": "provideLinter"
6868
}
6969
}
7070
}

spec/linter-jsonlint-spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ describe('The jsonlint provider for Linter', () => {
3434
it('verifies the first message', () => {
3535
waitsForPromise(() =>
3636
lint(editor).then((messages) => {
37-
expect(messages[0].type).toEqual('Error');
38-
expect(messages[0].text).toEqual(`Parse error on line 2:
37+
expect(messages[0].severity).toEqual('error');
38+
expect(messages[0].excerpt).toEqual(`Parse error on line 2:
3939
{ "key": 1 + 2}
4040
------------^
4141
Expecting 'EOF', '}', ',', ']', got 'undefined'`);
42-
expect(messages[0].filePath).toMatch(/.+bad\.json$/);
43-
expect(messages[0].range).toEqual({
42+
expect(messages[0].location.file).toMatch(/.+bad\.json$/);
43+
expect(messages[0].location.position).toEqual({
4444
start: { row: 2, column: 0 },
4545
end: { row: 2, column: 1 }
4646
});

0 commit comments

Comments
 (0)