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

Commit 987d21d

Browse files
authored
Merge pull request #107 from AtomLinter/greenkeeper/eslint-config-airbnb-base-12.0.0
Update eslint-config-airbnb-base to version 12.0.0 🚀
2 parents 7da9e44 + c0c2765 commit 987d21d

File tree

4 files changed

+30
-46
lines changed

4 files changed

+30
-46
lines changed

lib/init.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ const isPhoenixProject = async (filePath) => {
103103

104104
const findTextEditor = (filePath) => {
105105
const allEditors = atom.workspace.getTextEditors();
106-
const matchingEditor = allEditors.find(
107-
textEditor => textEditor.getPath() === filePath);
106+
const matchingEditor = allEditors.find(textEditor => textEditor.getPath() === filePath);
108107
if (matchingEditor !== undefined) {
109108
return matchingEditor;
110109
}
@@ -284,10 +283,7 @@ const getDepsPa = async (filePath) => {
284283
const projectPath = await elixirProjectPath(filePath);
285284
try {
286285
return readdirSync(join(projectPath, buildDir))
287-
.map(
288-
item =>
289-
join(projectPath, buildDir, item, 'ebin'),
290-
);
286+
.map(item => join(projectPath, buildDir, item, 'ebin'));
291287
} catch (e) {
292288
return [];
293289
}
@@ -347,18 +343,12 @@ export default {
347343
atom.config.observe('linter-elixirc.elixircPath', (value) => {
348344
elixircPath = value;
349345
}),
350-
);
351-
this.subscriptions.add(
352346
atom.config.observe('linter-elixirc.mixPath', (value) => {
353347
mixPath = value;
354348
}),
355-
);
356-
this.subscriptions.add(
357349
atom.config.observe('linter-elixirc.forceElixirc', (value) => {
358350
forceElixirc = value;
359351
}),
360-
);
361-
this.subscriptions.add(
362352
atom.config.observe('linter-elixirc.mixEnv', (value) => {
363353
mixEnv = value;
364354
}),

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,18 @@
4444
"linter:2.0.0",
4545
"language-elixir"
4646
],
47+
"scripts": {
48+
"lint": "eslint .",
49+
"test": "apm test"
50+
},
4751
"dependencies": {
4852
"atom-linter": "^10.0.0",
4953
"atom-package-deps": "^4.5.0",
5054
"tmp": "^0.0.33"
5155
},
5256
"devDependencies": {
53-
"eslint": "^4.3.0",
54-
"eslint-config-airbnb-base": "^11.3.1",
57+
"eslint": "^4.6.0",
58+
"eslint-config-airbnb-base": "^12.0.0",
5559
"eslint-plugin-import": "^2.7.0",
5660
"fs-extra": "^4.0.1"
5761
},

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: {
3+
atomtest: true,
34
jasmine: true,
4-
atomtest: true
5+
},
6+
rules: {
7+
"import/no-extraneous-dependencies": [
8+
"error",
9+
{
10+
"devDependencies": true
11+
}
12+
]
513
}
614
};

spec/linter-elixirc-spec.js

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { join } from 'path';
44
// eslint-disable-next-line import/no-extraneous-dependencies, import/no-unresolved
55
import { remove } from 'fs-extra';
66

7+
const { lint } = require('../lib/init.js').provideLinter();
8+
79
const validPathElixirc = join(__dirname, 'fixtures', 'elixirc', 'valid.ex');
810
const warningPathElixirc = join(__dirname, 'fixtures', 'elixirc', 'warning.ex');
911
const errorMode1PathElixirc = join(__dirname, 'fixtures', 'elixirc', 'error-mode1.ex');
@@ -19,18 +21,14 @@ remove(mixBuildDirectory);
1921
describe('The elixirc provider for Linter', () => {
2022
describe('when not working inside a Mix project', () => {
2123
describe('and using the standard configuration', () => {
22-
let lint;
23-
2424
beforeEach(() => {
25-
lint = require('../lib/init.js').provideLinter().lint;
2625
atom.workspace.destroyActivePaneItem();
2726

2827
waitsForPromise(() =>
2928
Promise.all([
3029
atom.packages.activatePackage('linter-elixirc'),
3130
atom.packages.activatePackage('language-elixir'),
32-
]),
33-
);
31+
]));
3432
});
3533

3634
it('works with mode 1 errors', () => {
@@ -43,8 +41,7 @@ describe('The elixirc provider for Linter', () => {
4341
expect(messages[0].excerpt).toBe('(ArgumentError) Dangerous is not available');
4442
expect(messages[0].location.file).toBe(errorMode1PathElixirc);
4543
expect(messages[0].location.position).toEqual([[1, 0], [1, 32]]);
46-
}),
47-
);
44+
}));
4845
});
4946

5047
it('works with mode 2 errors', () => {
@@ -57,8 +54,7 @@ describe('The elixirc provider for Linter', () => {
5754
expect(messages[0].excerpt).toBe('(CompileError) module Usefulness is not loaded and could not be found');
5855
expect(messages[0].location.file).toBe(errorMode2PathElixirc);
5956
expect(messages[0].location.position).toEqual([[3, 2], [3, 20]]);
60-
}),
61-
);
57+
}));
6258
});
6359

6460
it('works with warnings', () => {
@@ -70,8 +66,7 @@ describe('The elixirc provider for Linter', () => {
7066
expect(messages[0].excerpt).toBe('variable "prepare_for_call" does not exist and is being expanded to "prepare_for_call()", please use parentheses to remove the ambiguity or change the variable name');
7167
expect(messages[0].location.file).toBe(warningPathElixirc);
7268
expect(messages[0].location.position).toEqual([[20, 4], [20, 20]]);
73-
}),
74-
);
69+
}));
7570
});
7671

7772
it('works with .exs files', () => {
@@ -83,34 +78,28 @@ describe('The elixirc provider for Linter', () => {
8378
expect(messages[0].excerpt).toBe('function simple_function/0 is unused');
8479
expect(messages[0].location.file).toBe(exsFilePathElixirc);
8580
expect(messages[0].location.position).toEqual([[1, 2], [1, 25]]);
86-
}),
87-
);
81+
}));
8882
});
8983

9084
it('finds nothing wrong with a valid file', () => {
9185
waitsForPromise(() =>
9286
atom.workspace.open(validPathElixirc).then(editor => lint(editor)).then((messages) => {
9387
expect(messages.length).toBe(0);
94-
}),
95-
);
88+
}));
9689
});
9790
});
9891
});
9992

10093
describe('when working inside a Mix project', () => {
10194
describe('and using the standard configuration', () => {
102-
let lint;
103-
10495
beforeEach(() => {
105-
lint = require('../lib/init.js').provideLinter().lint;
10696
atom.workspace.destroyActivePaneItem();
10797

10898
waitsForPromise(() =>
10999
Promise.all([
110100
atom.packages.activatePackage('linter-elixirc'),
111101
atom.packages.activatePackage('language-elixir'),
112-
]),
113-
);
102+
]));
114103
});
115104

116105
it('works with mode 2 errors', () => {
@@ -123,8 +112,7 @@ describe('The elixirc provider for Linter', () => {
123112
expect(messages[0].excerpt).toBe('(CompileError) Identicon.Image.__struct__/1 is undefined, cannot expand struct Identicon.Image');
124113
expect(messages[0].location.file).toBe(errorMode2PathMix);
125114
expect(messages[0].location.position).toEqual([[11, 4], [11, 30]]);
126-
}),
127-
);
115+
}));
128116
});
129117

130118
it('works with .exs files', () => {
@@ -136,27 +124,22 @@ describe('The elixirc provider for Linter', () => {
136124
expect(messages[0].excerpt).toBe('function simple_function/0 is unused');
137125
expect(messages[0].location.file).toBe(exsFilePathMix);
138126
expect(messages[0].location.position).toEqual([[1, 2], [1, 25]]);
139-
}),
140-
);
127+
}));
141128
});
142129
});
143130
});
144131
});
145132

146133
describe('when using the setting forceElixirc', () => {
147-
let lint;
148-
149134
beforeEach(() => {
150135
atom.config.set('linter-elixirc.forceElixirc', true);
151-
lint = require('../lib/init.js').provideLinter().lint;
152136
atom.workspace.destroyActivePaneItem();
153137

154138
waitsForPromise(() =>
155139
Promise.all([
156140
atom.packages.activatePackage('linter-elixirc'),
157141
atom.packages.activatePackage('language-elixir'),
158-
]),
159-
);
142+
]));
160143
});
161144

162145
it('works with warnings', () => {
@@ -168,7 +151,6 @@ describe('when using the setting forceElixirc', () => {
168151
expect(messages[0].excerpt).toBe('(CompileError) Identicon.Image.__struct__/1 is undefined, cannot expand struct Identicon.Image');
169152
expect(messages[0].location.file).toBe(errorMode2PathMix);
170153
expect(messages[0].location.position).toEqual([[11, 4], [11, 30]]);
171-
}),
172-
);
154+
}));
173155
});
174156
});

0 commit comments

Comments
 (0)