Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Commit 00781a7

Browse files
authored
Add chai-as-promised ESLint plugin (#82)
- Add `chai-as-promised` plugin to avoid bad tests.
1 parent 3e19a67 commit 00781a7

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
99

1010
## [Unreleased]
1111

12+
## 0.9.0 - June 29, 2020
13+
14+
- Add `chai-as-promised` plugin to avoid bad tests.
15+
1216
## 0.8.0 - June 23, 2020
1317

1418
- Add `eslint-plugin-array-func` to provide rules for best practices with `.map().filter().reduce()` style operations.

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
'./rules/import',
2929
'./rules/array-func',
3030
'./rules/mocha',
31+
'./rules/chai-as-promised',
3132
'./rules/prettier',
3233
].map(require.resolve),
3334
rules: {},

package-lock.json

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@xpring-eng/eslint-config-base",
3-
"version": "0.8.0",
3+
"version": "0.9.0",
44
"description": "Xpring's base TS ESLint config, following our styleguide",
55
"keywords": [
66
"eslint",
@@ -27,6 +27,7 @@
2727
"eslint-config-prettier": "^6.11.0"
2828
},
2929
"devDependencies": {
30+
"@fintechstudios/eslint-plugin-chai-as-promised": "^3.0.2",
3031
"@typescript-eslint/eslint-plugin": "^3.4.0",
3132
"@typescript-eslint/parser": "^3.4.0",
3233
"eslint": "^7.3.1",
@@ -43,6 +44,7 @@
4344
"typescript": "^3.9.3"
4445
},
4546
"peerDependencies": {
47+
"@fintechstudios/eslint-plugin-chai-as-promised": "^3.0.2",
4648
"@typescript-eslint/eslint-plugin": "^3.4.0",
4749
"@typescript-eslint/parser": "^3.4.0",
4850
"eslint": "^7.3.1",

rules/chai-as-promised.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
env: {
3+
node: true, // Enable node global variables & Node.js scoping
4+
es2020: true, // Add all ECMAScript 2020 globals and automatically set the ecmaVersion parser option to ES2020
5+
},
6+
parserOptions: {
7+
sourceType: 'module',
8+
},
9+
10+
plugins: ['@fintechstudios/eslint-plugin-chai-as-promised'],
11+
12+
rules: {
13+
// Must not use await within chai-as-promised expressions
14+
// https://github.com/fintechstudios/eslint-plugin-chai-as-promised/blob/master/docs/rules/no-await-in-condition.md
15+
'@fintechstudios/chai-as-promised/no-unhandled-promises': 'error',
16+
17+
// Must handle promises returned from chai-as-promised expressions
18+
// https://github.com/fintechstudios/eslint-plugin-chai-as-promised/blob/master/docs/rules/no-unhandled-promises.md
19+
'@fintechstudios/chai-as-promised/no-await-in-condition': 'error',
20+
},
21+
22+
overrides: [],
23+
}

0 commit comments

Comments
 (0)