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

Commit 2a04377

Browse files
authored
0.6.3 - Disable some rules for tests (#58)
- Allow an "unscoped `this`" keyword, as Mocha lets you do `this.timeout(num)` to set a test-specific timeout. - Allow using the `var!` syntax to make non-null assertions in test files, so we don't have to deal with the `null | undefined` case in test files when we _know_ the result will be valid.
1 parent bb8d866 commit 2a04377

File tree

4 files changed

+35
-22
lines changed

4 files changed

+35
-22
lines changed

CHANGELOG.md

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

1010
## [Unreleased]
1111

12+
## 0.6.3 - June 8, 2020
13+
14+
- Disable some rules specifically for `*.test.ts` files
15+
16+
- Allow an "unscoped `this`" keyword, as Mocha lets you do `this.timeout(num)` to set a test-specific timeout.
17+
- Allow using the `var!` syntax to make non-null assertions in test files, so we don't have to deal with the `null | undefined` case in test files when we _know_ the result will be valid.
18+
1219
## 0.6.2 - June 8, 2020
1320

1421
- Upgrade `eslint-plugin-import` to one that officially supports ESLint v7.

package-lock.json

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

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
{
22
"name": "@xpring-eng/eslint-config-base",
3-
"version": "0.6.2",
3+
"version": "0.6.3",
44
"description": "Xpring's base TS ESLint config, following our styleguide",
5-
"main": "index.js",
6-
"scripts": {
7-
"eslint-find-option-rules": "eslint-find-rules [option] <file> [flag]",
8-
"unused": "eslint-find-rules --unused",
9-
"plugin": "eslint-find-rules --plugin",
10-
"check-prettier": "npx eslint --print-config index.js | npx eslint-config-prettier-check",
11-
"check-prettier-test": "npx eslint --print-config test/index.test.js | npx eslint-config-prettier-check",
12-
"lint": "eslint --report-unused-disable-directives ."
13-
},
14-
"repository": {
15-
"type": "git",
16-
"url": "https://github.com/xpring-eng/eslint"
17-
},
185
"keywords": [
196
"eslint",
207
"eslintconfig",
218
"config",
229
"styleguide"
2310
],
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/xpring-eng/eslint"
14+
},
2415
"license": "MIT",
16+
"main": "index.js",
17+
"scripts": {
18+
"check-prettier": "npx eslint --print-config index.js | npx eslint-config-prettier-check",
19+
"check-prettier-test": "npx eslint --print-config test/index.test.js | npx eslint-config-prettier-check",
20+
"eslint-find-option-rules": "eslint-find-rules [option] <file> [flag]",
21+
"lint": "eslint --report-unused-disable-directives .",
22+
"plugin": "eslint-find-rules --plugin",
23+
"unused": "eslint-find-rules --unused"
24+
},
2525
"dependencies": {
2626
"confusing-browser-globals": "^1.0.9",
2727
"eslint-config-prettier": "^6.11.0"
2828
},
29-
"peerDependencies": {
29+
"devDependencies": {
3030
"@typescript-eslint/eslint-plugin": "^3.1.0",
3131
"@typescript-eslint/parser": "^3.1.0",
32-
"eslint": ">= 7",
32+
"eslint": "^7.2.0",
33+
"eslint-find-rules": "^3.4.0",
3334
"eslint-plugin-eslint-comments": "^3.2.0",
3435
"eslint-plugin-import": "^2.21.1",
3536
"eslint-plugin-jsdoc": "^27.0.0",
@@ -38,13 +39,12 @@
3839
"eslint-plugin-prettier": "^3.1.3",
3940
"eslint-plugin-tsdoc": "^0.2.5",
4041
"prettier": "^2.0.5",
41-
"typescript": "^3.9.2"
42+
"typescript": "^3.9.3"
4243
},
43-
"devDependencies": {
44+
"peerDependencies": {
4445
"@typescript-eslint/eslint-plugin": "^3.1.0",
4546
"@typescript-eslint/parser": "^3.1.0",
46-
"eslint": "^7.2.0",
47-
"eslint-find-rules": "^3.4.0",
47+
"eslint": ">= 7",
4848
"eslint-plugin-eslint-comments": "^3.2.0",
4949
"eslint-plugin-import": "^2.21.1",
5050
"eslint-plugin-jsdoc": "^27.0.0",
@@ -53,6 +53,6 @@
5353
"eslint-plugin-prettier": "^3.1.3",
5454
"eslint-plugin-tsdoc": "^0.2.5",
5555
"prettier": "^2.0.5",
56-
"typescript": "^3.9.3"
56+
"typescript": "^3.9.2"
5757
}
5858
}

rules/@typescript-eslint.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,12 @@ module.exports = {
732732
// TODO:(hbergren) Is this true?
733733
'@typescript-eslint/no-floating-promises': 'off',
734734

735+
// In Mocha, you can use `this.timeout()` to set a custom timeout for a specific test
736+
'@typescript-eslint/no-invalid-this': 'off',
737+
738+
// We use non-null assertions liberally in tests to allow TypeScript to build
739+
'@typescript-eslint/no-non-null-assertion': 'off',
740+
735741
// We purposefully break some TypeScript assumptions in various tests (like giving `null` to a database access function)
736742
'@typescript-eslint/ban-ts-comment': [
737743
'error',

0 commit comments

Comments
 (0)