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

Commit 76ed1f4

Browse files
committed
👕 Fix linting issues
1 parent 7192449 commit 76ed1f4

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export function provideLinter() {
2323
try {
2424
jsonlint.parse(text);
2525
} catch (error) {
26-
const message = error.message;
26+
const { message } = error;
2727
const line = Number(message.match(regex)[1]);
2828
const column = 0;
2929

3030
return Promise.resolve([{
3131
type: 'Error',
32-
text: error.message,
32+
text: message,
3333
filePath: path,
3434
range: new Range([line, column], [line, column + 1])
3535
}]);

spec/.eslintrc.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
module.exports = {
22
env: {
33
atomtest: true,
4-
jasmine: true
4+
jasmine: true,
5+
},
6+
rules: {
7+
"import/no-extraneous-dependencies": [
8+
"error",
9+
{
10+
"devDependencies": true
11+
}
12+
]
513
}
614
};

spec/linter-jsonlint-spec.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ const goodPath = path.join(__dirname, 'fixtures', 'good.json');
66
const badPath = path.join(__dirname, 'fixtures', 'bad.json');
77

88
describe('The jsonlint provider for Linter', () => {
9-
const lint = require('../lib/index.js').provideLinter().lint;
9+
const { lint } = require('../lib/index.js').provideLinter();
1010

1111
beforeEach(() => {
1212
atom.workspace.destroyActivePaneItem();
1313
waitsForPromise(() =>
1414
Promise.all([
1515
atom.packages.activatePackage('linter-jsonlint'),
1616
atom.packages.activatePackage('language-json')
17-
])
18-
);
17+
]));
1918
});
2019

2120
describe('checks bad.md and', () => {
@@ -24,14 +23,12 @@ describe('The jsonlint provider for Linter', () => {
2423
waitsForPromise(() =>
2524
atom.workspace.open(badPath).then((openEditor) => {
2625
editor = openEditor;
27-
})
28-
);
26+
}));
2927
});
3028

3129
it('finds at least one message', () => {
3230
waitsForPromise(() =>
33-
lint(editor).then(messages => expect(messages.length).toBeGreaterThan(0))
34-
);
31+
lint(editor).then(messages => expect(messages.length).toBeGreaterThan(0)));
3532
});
3633

3734
it('verifies the first message', () => {
@@ -47,16 +44,13 @@ Expecting 'EOF', '}', ',', ']', got 'undefined'`);
4744
start: { row: 2, column: 0 },
4845
end: { row: 2, column: 1 }
4946
});
50-
})
51-
);
47+
}));
5248
});
5349
});
5450

5551
it('finds nothing wrong with a valid file', () => {
5652
waitsForPromise(() =>
5753
atom.workspace.open(goodPath).then(editor =>
58-
lint(editor).then(messages => expect(messages.length).toEqual(0))
59-
)
60-
);
54+
lint(editor).then(messages => expect(messages.length).toEqual(0))));
6155
});
6256
});

0 commit comments

Comments
 (0)