Skip to content

Commit d74c7d2

Browse files
committed
test: Adjust AirBnB rules for Mocha tests
Mocha conventions use nameless functions instead of arrow functions because arrow functions lexically bind `this`, preventing you from accessing the Mocha context. This prevents setting timeouts and other things which require the Mocha context. See https://mochajs.org/#arrow-functions and airbnb/javascript#433
1 parent 86f79df commit d74c7d2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ module.exports = {
1515
node: true,
1616
mocha: true,
1717
},
18+
rules: {
19+
// These are set by airbnb-base, but go against Mocha conventions
20+
// See https://mochajs.org/#arrow-functions
21+
// and https://github.com/airbnb/javascript/issues/433
22+
'func-names': 'off',
23+
'prefer-arrow-callback': 'off',
24+
},
1825
},
1926
],
2027
};

0 commit comments

Comments
 (0)