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

Commit

Permalink
Merge pull request #15 from 1000ch/master
Browse files Browse the repository at this point in the history
Rewritten for the new Linter API.

Fixes #17 
Fixes #16 
Fixes #14 
Fixes #13
  • Loading branch information
keplersj committed Aug 28, 2015
2 parents aa189dd + 96af916 commit 24ab6cf
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 48 deletions.
40 changes: 40 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use babel';

import { Range } from 'atom';
import jsonlint from 'jsonlint';

export default class LinterJsonLint {

static regex = '.+?line\\s(\\d+)'

static provideLinter() {
return {
grammarScopes: ['source.json'],
scope: 'file',
lintOnFly: true,
lint: (editor) => {

let path = editor.getPath();
let text = editor.getText();

try {
jsonlint.parse(text);
} catch (e) {

let line = Number(e.message.match(this.regex)[1]);
let column = 0;

return [{
type: 'Error',
text: e.message,
filePath: path,
range: new Range([line, column], [line, column + 1])
}];
}

return [];
}
}
}

}
10 changes: 0 additions & 10 deletions lib/init.coffee

This file was deleted.

34 changes: 0 additions & 34 deletions lib/linter-jsonlint.coffee

This file was deleted.

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
{
"name": "linter-jsonlint",
"linter-package": true,
"main": "./lib/init",
"main": "index.js",
"version": "0.1.4",
"description": "Lint JSON on the fly",
"repository": "https://github.com/AtomLinter/linter-jsonlint",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
"atom": ">=1.0.0"
},
"dependencies": {
"jsonlint": "~1.6.0"
"jsonlint": "~1.6.2"
},
"providedServices": {
"linter": {
"versions": {
"1.0.0": "provideLinter"
}
}
}
}

0 comments on commit 24ab6cf

Please sign in to comment.