Skip to content

Commit 63ccb9d

Browse files
committed
test: Use eslint-plugin-mocha for tests
This pulls in the eslint-plugin-mocha and enables its use when linting tests. Because our existing tests do not always follow the Mocha conventions, some mocha rules are disable for now. See #289
1 parent d74c7d2 commit 63ccb9d

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.eslintrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module.exports = {
22
extends: 'airbnb-base',
3+
plugins: [
4+
'mocha',
5+
],
36
env: {
47
node: true,
58
},
@@ -15,12 +18,19 @@ module.exports = {
1518
node: true,
1619
mocha: true,
1720
},
21+
extends: 'plugin:mocha/recommended',
1822
rules: {
1923
// These are set by airbnb-base, but go against Mocha conventions
2024
// See https://mochajs.org/#arrow-functions
2125
// and https://github.com/airbnb/javascript/issues/433
2226
'func-names': 'off',
2327
'prefer-arrow-callback': 'off',
28+
29+
// The following rules cause problems for our existing tests, so they are disabled for now:
30+
'mocha/no-mocha-arrows': 'off',
31+
'mocha/no-skipped-tests': 'off',
32+
'mocha/no-hooks-for-single-case': 'off',
33+
'mocha/no-identical-title': 'off',
2434
},
2535
},
2636
],

package-lock.json

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"eslint": "^6.2.0",
4949
"eslint-config-airbnb-base": "^14.0.0",
5050
"eslint-plugin-import": "^2.18.2",
51+
"eslint-plugin-mocha": "^7.0.1",
5152
"mocha": "^6.2.3",
5253
"sinon": "^7.4.1",
5354
"standard-version": "^7.0.0"

0 commit comments

Comments
 (0)