Skip to content

Commit 699d149

Browse files
committed
Merge branch 'next'
2 parents 39719a3 + 755e279 commit 699d149

17 files changed

+886
-777
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ jobs:
6060
strategy:
6161
fail-fast: false
6262
matrix:
63-
node-version: [12.x, 14.x, 16.x, 17.x, 18.x]
64-
eslint-version: [6, 7, 8]
63+
node-version: [14.x, 16.x, 18.x]
64+
eslint-version: [7, 8]
6565
runs-on: ubuntu-latest
6666

6767
steps:

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
# [27.0.0-next.2](https://github.com/jest-community/eslint-plugin-jest/compare/v27.0.0-next.1...v27.0.0-next.2) (2022-08-28)
2+
3+
4+
### Bug Fixes
5+
6+
* **unbound-method:** don't suppress errors from base rule ([#1219](https://github.com/jest-community/eslint-plugin-jest/issues/1219)) ([7c1389e](https://github.com/jest-community/eslint-plugin-jest/commit/7c1389e3d8c59e283de37ed86f3f4c12fb38c3ff))
7+
8+
9+
### Features
10+
11+
* make `no-alias-methods` recommended ([#1221](https://github.com/jest-community/eslint-plugin-jest/issues/1221)) ([914b24a](https://github.com/jest-community/eslint-plugin-jest/commit/914b24a0bc12a151e6f7ecec37a440769b555b94))
12+
* **no-jest-import:** remove rule ([#1220](https://github.com/jest-community/eslint-plugin-jest/issues/1220)) ([918873b](https://github.com/jest-community/eslint-plugin-jest/commit/918873beb15d4a698fe5150d826d44b696283683))
13+
* **no-restricted-matchers:** match based on start of chain, requiring each permutation to be set ([#1218](https://github.com/jest-community/eslint-plugin-jest/issues/1218)) ([f4dd97a](https://github.com/jest-community/eslint-plugin-jest/commit/f4dd97a7ec3b985d0f7e42a5a6331bc0c65a7d56))
14+
15+
16+
### BREAKING CHANGES
17+
18+
* `no-alias-methods` is now recommended as the methods themselves will be removed in the next major version of Jest
19+
* **no-jest-import:** removed `no-jest-import` rule
20+
* **unbound-method:** errors thrown by the `unbound-method` base rule are no longer suppressed - really this means that if you don't specify `project` when this rule is enabled and `@typescript-eslint/eslint-plugin` is present, that error will no longer be suppressed instead of silently doing nothing; it will still not throw if this rule is enabled without the base rule being present
21+
* **no-restricted-matchers:** `no-restricted-matchers` now checks against the start of the expect chain, meaning you have to explicitly list each possible matcher & modifier permutations that you want to restrict
22+
23+
# [27.0.0-next.1](https://github.com/jest-community/eslint-plugin-jest/compare/v26.8.7...v27.0.0-next.1) (2022-08-23)
24+
25+
26+
### Features
27+
28+
* drop support for `eslint@6` ([#1212](https://github.com/jest-community/eslint-plugin-jest/issues/1212)) ([21fc2fe](https://github.com/jest-community/eslint-plugin-jest/commit/21fc2feea67a8fd9f6673fd6a1e91ca1f5bdda11))
29+
* drop support for Node versions 12 and 17 ([#1211](https://github.com/jest-community/eslint-plugin-jest/issues/1211)) ([4c987f5](https://github.com/jest-community/eslint-plugin-jest/commit/4c987f5f566398d95584668bd2bc18bfdf438e40))
30+
31+
32+
### BREAKING CHANGES
33+
34+
* Support for ESLint version 6 is removed
35+
* Node versions 12 and 17 are no longer supported
36+
137
# [26.9.0](https://github.com/jest-community/eslint-plugin-jest/compare/v26.8.7...v26.9.0) (2022-08-28)
238

339

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ installations requiring long-term consistency.
203203
| [expect-expect](docs/rules/expect-expect.md) | Enforce assertion to be made in a test body | ![recommended][] | |
204204
| [max-expects](docs/rules/max-expects.md) | Enforces a maximum number assertion calls in a test body | | |
205205
| [max-nested-describe](docs/rules/max-nested-describe.md) | Enforces a maximum depth to nested describe calls | | |
206-
| [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods | ![style][] | ![fixable][] |
206+
| [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods | ![recommended][] | ![fixable][] |
207207
| [no-commented-out-tests](docs/rules/no-commented-out-tests.md) | Disallow commented out tests | ![recommended][] | |
208208
| [no-conditional-expect](docs/rules/no-conditional-expect.md) | Prevent calling `expect` conditionally | ![recommended][] | |
209209
| [no-conditional-in-test](docs/rules/no-conditional-in-test.md) | Disallow conditional logic in tests | | |
@@ -217,7 +217,6 @@ installations requiring long-term consistency.
217217
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles | ![recommended][] | |
218218
| [no-interpolation-in-snapshots](docs/rules/no-interpolation-in-snapshots.md) | Disallow string interpolation inside snapshots | ![recommended][] | |
219219
| [no-jasmine-globals](docs/rules/no-jasmine-globals.md) | Disallow Jasmine globals | ![recommended][] | ![fixable][] |
220-
| [no-jest-import](docs/rules/no-jest-import.md) | Disallow importing Jest | ![recommended][] | |
221220
| [no-large-snapshots](docs/rules/no-large-snapshots.md) | disallow large snapshots | | |
222221
| [no-mocks-import](docs/rules/no-mocks-import.md) | Disallow manually importing from `__mocks__` | ![recommended][] | |
223222
| [no-restricted-matchers](docs/rules/no-restricted-matchers.md) | Disallow specific matchers & modifiers | | |

docs/rules/no-alias-methods.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Disallow alias methods (`no-alias-methods`)
22

3+
> These aliases are going to be removed in the next major version of Jest - see
4+
> https://github.com/facebook/jest/issues/13164 for more
5+
36
Several Jest methods have alias names, such as `toThrow` having the alias of
47
`toThrowError`. This rule ensures that only the canonical name as used in the
58
Jest documentation is used in the code. This makes it easier to search for all

docs/rules/no-jest-import.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/rules/no-restricted-matchers.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ alternatives.
88
Bans are expressed in the form of a map, with the value being either a string
99
message to be shown, or `null` if the default rule message should be used.
1010

11-
Both matchers, modifiers, and chains of the two are checked, allowing for
12-
specific variations of a matcher to be banned if desired.
11+
Bans are checked against the start of the `expect` chain - this means that to
12+
ban a specific matcher entirely you must specify all six permutations, but
13+
allows you to ban modifiers as well.
1314

1415
By default, this map is empty, meaning no matchers or modifiers are banned.
1516

@@ -22,7 +23,12 @@ For example:
2223
{
2324
"toBeFalsy": null,
2425
"resolves": "Use `expect(await promise)` instead.",
25-
"not.toHaveBeenCalledWith": null
26+
"toHaveBeenCalledWith": null,
27+
"not.toHaveBeenCalledWith": null,
28+
"resolves.toHaveBeenCalledWith": null,
29+
"rejects.toHaveBeenCalledWith": null,
30+
"resolves.not.toHaveBeenCalledWith": null,
31+
"rejects.not.toHaveBeenCalledWith": null
2632
}
2733
]
2834
}
@@ -32,15 +38,18 @@ Examples of **incorrect** code for this rule with the above configuration
3238

3339
```js
3440
it('is false', () => {
41+
// if this has a modifer (i.e. `not.toBeFalsy`), it would be considered fine
3542
expect(a).toBeFalsy();
3643
});
3744

3845
it('resolves', async () => {
46+
// all uses of this modifier are disallowed, regardless of matcher
3947
await expect(myPromise()).resolves.toBe(true);
4048
});
4149

4250
describe('when an error happens', () => {
4351
it('does not upload the file', async () => {
52+
// all uses of this matcher are disallowed
4453
expect(uploadFileMock).not.toHaveBeenCalledWith('file.name');
4554
});
4655
});

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-jest",
3-
"version": "26.9.0",
3+
"version": "27.0.0-next.2",
44
"description": "ESLint rules for Jest",
55
"keywords": [
66
"eslint",
@@ -103,34 +103,34 @@
103103
"@babel/core": "^7.4.4",
104104
"@babel/preset-env": "^7.4.4",
105105
"@babel/preset-typescript": "^7.3.3",
106-
"@commitlint/cli": "^16.0.0",
107-
"@commitlint/config-conventional": "^16.0.0",
106+
"@commitlint/cli": "^17.0.3",
107+
"@commitlint/config-conventional": "^17.0.3",
108108
"@schemastore/package": "^0.0.6",
109109
"@semantic-release/changelog": "^6.0.0",
110110
"@semantic-release/git": "^10.0.0",
111111
"@types/dedent": "^0.7.0",
112112
"@types/jest": "^28.0.0",
113-
"@types/node": "^16.0.0",
113+
"@types/node": "^14.18.26",
114114
"@types/prettier": "^2.0.0",
115115
"@typescript-eslint/eslint-plugin": "^5.0.0",
116116
"@typescript-eslint/parser": "^5.0.0",
117-
"babel-jest": "^28.0.0",
117+
"babel-jest": "^29.0.0",
118118
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
119119
"dedent": "^0.7.0",
120120
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0",
121121
"eslint-config-prettier": "^8.3.0",
122122
"eslint-plugin-eslint-comments": "^3.1.2",
123-
"eslint-plugin-eslint-plugin": "^4.0.0",
123+
"eslint-plugin-eslint-plugin": "^5.0.6",
124124
"eslint-plugin-import": "^2.25.1",
125125
"eslint-plugin-node": "^11.0.0",
126-
"eslint-plugin-prettier": "^3.4.1",
126+
"eslint-plugin-prettier": "^4.2.1",
127127
"eslint-remote-tester": "^3.0.0",
128128
"eslint-remote-tester-repositories": "~0.0.5",
129-
"husky": "^7.0.2",
129+
"husky": "^8.0.1",
130130
"is-ci": "^3.0.0",
131-
"jest": "^28.0.0",
132-
"jest-runner-eslint": "^1.0.0",
133-
"lint-staged": "^12.0.0",
131+
"jest": "^29.0.0",
132+
"jest-runner-eslint": "^1.1.0",
133+
"lint-staged": "^13.0.3",
134134
"pinst": "^3.0.0",
135135
"prettier": "^2.0.5",
136136
"rimraf": "^3.0.0",
@@ -141,7 +141,7 @@
141141
},
142142
"peerDependencies": {
143143
"@typescript-eslint/eslint-plugin": "^5.0.0",
144-
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
144+
"eslint": "^7.0.0 || ^8.0.0"
145145
},
146146
"peerDependenciesMeta": {
147147
"@typescript-eslint/eslint-plugin": {
@@ -153,6 +153,6 @@
153153
},
154154
"packageManager": "[email protected]",
155155
"engines": {
156-
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
156+
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
157157
}
158158
}

src/__tests__/__snapshots__/rules.test.ts.snap

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`rules should export configs that refer to actual rules 1`] = `
4-
Object {
5-
"all": Object {
6-
"env": Object {
4+
{
5+
"all": {
6+
"env": {
77
"jest/globals": true,
88
},
9-
"plugins": Array [
9+
"plugins": [
1010
"jest",
1111
],
12-
"rules": Object {
12+
"rules": {
1313
"jest/consistent-test-it": "error",
1414
"jest/expect-expect": "error",
1515
"jest/max-expects": "error",
@@ -28,7 +28,6 @@ Object {
2828
"jest/no-identical-title": "error",
2929
"jest/no-interpolation-in-snapshots": "error",
3030
"jest/no-jasmine-globals": "error",
31-
"jest/no-jest-import": "error",
3231
"jest/no-large-snapshots": "error",
3332
"jest/no-mocks-import": "error",
3433
"jest/no-restricted-matchers": "error",
@@ -62,15 +61,16 @@ Object {
6261
"jest/valid-title": "error",
6362
},
6463
},
65-
"recommended": Object {
66-
"env": Object {
64+
"recommended": {
65+
"env": {
6766
"jest/globals": true,
6867
},
69-
"plugins": Array [
68+
"plugins": [
7069
"jest",
7170
],
72-
"rules": Object {
71+
"rules": {
7372
"jest/expect-expect": "warn",
73+
"jest/no-alias-methods": "error",
7474
"jest/no-commented-out-tests": "warn",
7575
"jest/no-conditional-expect": "error",
7676
"jest/no-deprecated-functions": "error",
@@ -81,7 +81,6 @@ Object {
8181
"jest/no-identical-title": "error",
8282
"jest/no-interpolation-in-snapshots": "error",
8383
"jest/no-jasmine-globals": "error",
84-
"jest/no-jest-import": "error",
8584
"jest/no-mocks-import": "error",
8685
"jest/no-standalone-expect": "error",
8786
"jest/no-test-prefixes": "error",
@@ -91,11 +90,11 @@ Object {
9190
"jest/valid-title": "error",
9291
},
9392
},
94-
"style": Object {
95-
"plugins": Array [
93+
"style": {
94+
"plugins": [
9695
"jest",
9796
],
98-
"rules": Object {
97+
"rules": {
9998
"jest/no-alias-methods": "warn",
10099
"jest/prefer-to-be": "error",
101100
"jest/prefer-to-contain": "error",

src/__tests__/rules.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { existsSync } from 'fs';
22
import { resolve } from 'path';
33
import plugin from '../';
44

5-
const numberOfRules = 51;
5+
const numberOfRules = 50;
66
const ruleNames = Object.keys(plugin.rules);
77
const deprecatedRules = Object.entries(plugin.rules)
88
.filter(([, rule]) => rule.meta.deprecated)

src/rules/__tests__/no-jest-import.test.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)