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

Commit a158e1c

Browse files
committed
👕 Fix linting issues
1 parent 7756c46 commit a158e1c

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

lib/main.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ const parseClangRanges = (ranges) => {
7373
*/
7474
const findTextEditor = (filePath) => {
7575
const allEditors = atom.workspace.getTextEditors();
76-
const matchingEditor = allEditors.find(
77-
textEditor => textEditor.getPath() === filePath);
76+
const matchingEditor = allEditors.find(textEditor => textEditor.getPath() === filePath);
7877
return matchingEditor || false;
7978
};
8079

@@ -97,38 +96,24 @@ export default {
9796
atom.config.observe('linter-clang.executablePath', (value) => {
9897
this.executablePath = value;
9998
}),
100-
);
101-
this.subscriptions.add(
10299
atom.config.observe('linter-clang.clangIncludePaths', (value) => {
103100
this.clangIncludePaths = value;
104101
}),
105-
);
106-
this.subscriptions.add(
107102
atom.config.observe('linter-clang.clangSuppressWarnings', (value) => {
108103
this.clangSuppressWarnings = value;
109104
}),
110-
);
111-
this.subscriptions.add(
112105
atom.config.observe('linter-clang.clangDefaultCFlags', (value) => {
113106
this.clangDefaultCFlags = value;
114107
}),
115-
);
116-
this.subscriptions.add(
117108
atom.config.observe('linter-clang.clangDefaultCppFlags', (value) => {
118109
this.clangDefaultCppFlags = value;
119110
}),
120-
);
121-
this.subscriptions.add(
122111
atom.config.observe('linter-clang.clangDefaultObjCFlags', (value) => {
123112
this.clangDefaultObjCFlags = value;
124113
}),
125-
);
126-
this.subscriptions.add(
127114
atom.config.observe('linter-clang.clangDefaultObjCppFlags', (value) => {
128115
this.clangDefaultObjCppFlags = value;
129116
}),
130-
);
131-
this.subscriptions.add(
132117
atom.config.observe('linter-clang.clangErrorLimit', (value) => {
133118
this.clangErrorLimit = value;
134119
}),
@@ -210,9 +195,7 @@ export default {
210195
args.push('--verbose');
211196
}
212197

213-
this.clangIncludePaths.forEach(path =>
214-
args.push(`-I${path}`),
215-
);
198+
this.clangIncludePaths.forEach(path => args.push(`-I${path}`));
216199

217200
let usingClangComplete = false;
218201
try {
@@ -222,7 +205,7 @@ export default {
222205
usingClangComplete = true;
223206
const workingDir = /-working-directory=(.+)/.exec(flag);
224207
if (workingDir !== null) {
225-
basePath = workingDir[1];
208+
[, basePath] = workingDir;
226209
}
227210
});
228211
} catch (error) {
@@ -269,7 +252,7 @@ export default {
269252
if (isCurrentFile) {
270253
file = filePath;
271254
} else if (isAbsolute(match[1])) {
272-
file = match[1];
255+
[, file] = match;
273256
} else {
274257
file = resolve(basePath, match[1]);
275258
}
@@ -300,6 +283,7 @@ export default {
300283
// There is a -Wflag specified, for now just re-insert that into the excerpt
301284
excerpt = `${match[6]} [${match[7]}]`;
302285
} else {
286+
// eslint-disable-next-line prefer-destructuring
303287
excerpt = match[6];
304288
}
305289
const message = {

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-clang-spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
'use babel';
22

3-
// eslint-disable-next-line import/no-extraneous-dependencies
4-
import { beforeEach, it } from 'jasmine-fix';
5-
// Note, when testing if using fit you must import it!
63
import { join } from 'path';
4+
// eslint-disable-next-line no-unused-vars
5+
import { it, fit, wait, beforeEach, afterEach } from 'jasmine-fix';
76

8-
const lint = require('../lib/main').provideLinter().lint;
7+
const { lint } = require('../lib/main').provideLinter();
98

109
const miPath = join(__dirname, 'files', 'missing_import');
1110
const poPath = join(__dirname, 'files', 'pragma', 'pragma_once');

0 commit comments

Comments
 (0)