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

Rewrite #15

Merged
merged 4 commits into from
Aug 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
}
}