diff --git a/lib/index.js b/lib/index.js index 0f0a360..6b36dad 100644 --- a/lib/index.js +++ b/lib/index.js @@ -15,7 +15,7 @@ export function provideLinter() { name: 'JSON Lint', grammarScopes: ['source.json'], scope: 'file', - lintOnFly: true, + lintsOnChange: true, lint: (editor) => { const path = editor.getPath(); const text = editor.getText(); @@ -28,10 +28,12 @@ export function provideLinter() { const column = 0; return Promise.resolve([{ - type: 'Error', - text: message, - filePath: path, - range: new Range([line, column], [line, column + 1]) + severity: 'error', + excerpt: message, + location: { + file: path, + position: new Range([line, column], [line, column + 1]) + } }]); } diff --git a/package.json b/package.json index 284b76c..1e8c84d 100644 --- a/package.json +++ b/package.json @@ -59,12 +59,12 @@ } }, "package-deps": [ - "linter" + "linter:2.0.0" ], "providedServices": { "linter": { "versions": { - "1.0.0": "provideLinter" + "2.0.0": "provideLinter" } } } diff --git a/spec/linter-jsonlint-spec.js b/spec/linter-jsonlint-spec.js index d1a3af1..f20db3c 100644 --- a/spec/linter-jsonlint-spec.js +++ b/spec/linter-jsonlint-spec.js @@ -34,13 +34,13 @@ describe('The jsonlint provider for Linter', () => { it('verifies the first message', () => { waitsForPromise(() => lint(editor).then((messages) => { - expect(messages[0].type).toEqual('Error'); - expect(messages[0].text).toEqual(`Parse error on line 2: + expect(messages[0].severity).toEqual('error'); + expect(messages[0].excerpt).toEqual(`Parse error on line 2: { "key": 1 + 2} ------------^ Expecting 'EOF', '}', ',', ']', got 'undefined'`); - expect(messages[0].filePath).toMatch(/.+bad\.json$/); - expect(messages[0].range).toEqual({ + expect(messages[0].location.file).toMatch(/.+bad\.json$/); + expect(messages[0].location.position).toEqual({ start: { row: 2, column: 0 }, end: { row: 2, column: 1 } });