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

Commit d396e5a

Browse files
authored
Merge pull request #94 from vzamanillo/v2-linter-api-support
V2 linter API support
2 parents bc85ee1 + b440bbf commit d396e5a

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

lib/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function provideLinter() {
1515
name: 'JSON Lint',
1616
grammarScopes: ['source.json'],
1717
scope: 'file',
18-
lintOnFly: true,
18+
lintsOnChange: true,
1919
lint: (editor) => {
2020
const path = editor.getPath();
2121
const text = editor.getText();
@@ -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)