Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next major #1531

Merged
merged 24 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f976fc8
feat: remove `no-if` rule (#1528)
G-Rath Mar 21, 2024
732c71b
chore(release): 28.0.0-next.1 [skip ci]
semantic-release-bot Mar 21, 2024
df5e580
feat: drop support for Node v14 (#1527)
G-Rath Mar 21, 2024
c439b48
chore(release): 28.0.0-next.2 [skip ci]
semantic-release-bot Mar 21, 2024
8408db9
chore: update TSConfig to use Node v16 defaults (#1529)
G-Rath Mar 22, 2024
dc6e8cd
feat: upgrade `@typescript-eslint/utils` to v6 (#1508)
G-Rath Mar 22, 2024
9899ddf
chore(release): 28.0.0-next.3 [skip ci]
semantic-release-bot Mar 22, 2024
150e355
feat: drop support for `@typescript-eslint/eslint-plugin` v5 (#1530)
G-Rath Mar 23, 2024
4d6f79a
chore(release): 28.0.0-next.4 [skip ci]
semantic-release-bot Mar 23, 2024
d362581
test(no-done-callback): add missing `suggestions` to `each` cases (#1…
G-Rath Mar 24, 2024
0297a7a
refactor: address missed usage of deprecated `context.getFilename` in…
G-Rath Mar 24, 2024
a61b12d
test(prefer-expect-assertions): add missing `suggestions` to `each` c…
G-Rath Mar 24, 2024
98087f9
feat: remove `snapshot` processor and `flat/snapshot` config (#1532)
G-Rath Mar 27, 2024
201b6e9
chore(release): 28.0.0-next.5 [skip ci]
semantic-release-bot Mar 27, 2024
fb800db
test(prefer-expect-assertions): add missing suggestions (#1538)
G-Rath Mar 27, 2024
8bba541
test(prefer-comparison-matcher): update names and remove duplicates (…
G-Rath Mar 29, 2024
295120e
refactor: use `flatMap` instead of `reduce` (#1541)
G-Rath Mar 29, 2024
af4a9c9
fix(no-large-snapshots): avoid `instanceof RegExp` check for ESLint v…
G-Rath Mar 29, 2024
7bc48aa
chore(release): 28.0.0-next.6 [skip ci]
semantic-release-bot Mar 29, 2024
59d642c
ci: run against upcoming next major ESLint version (#1534)
G-Rath Mar 31, 2024
cff726c
Merge branch 'main' into next
SimenB Apr 6, 2024
3c5e167
fix: allow ESLint 9 as peer dependency (#1547)
SimenB Apr 6, 2024
c87e388
fix: drop support for Node 19 (#1548)
SimenB Apr 6, 2024
37f1d69
chore(release): 28.0.0-next.7 [skip ci]
semantic-release-bot Apr 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = {
globals,
},
{
files: ['src/**/*', 'dangerfile.ts', 'tools/*'],
files: ['src/**/*', 'dangerfile.ts', 'tools/*', './jest.config.ts'],
parserOptions: {
sourceType: 'module',
},
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,16 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x, 19.x, 20.x, 21.x]
eslint-version: [7, 8]
ts-eslint-plugin-version: [5, 6, 7]
node-version: [16.x, 18.x, 19.x, 20.x, 21.x]
eslint-version: [7, 8, next]
ts-eslint-plugin-version: [6, 7]
exclude:
# ts-eslint/plugin@6 doesn't support node@14
- node-version: 14.x
ts-eslint-plugin-version: 6
# ts-eslint/plugin@7 doesn't support node@14
- node-version: 14.x
ts-eslint-plugin-version: 7
# ts-eslint/plugin@7 doesn't support node@16
- node-version: 16.x
ts-eslint-plugin-version: 7
# eslint@9 doesn't support node@16
- node-version: 16.x
eslint-version: next
# ts-eslint/plugin@7 doesn't support node@19
- node-version: 19.x
ts-eslint-plugin-version: 7
Expand All @@ -109,7 +106,7 @@ jobs:
yarn add --dev eslint@${{ matrix.eslint-version }} @typescript-eslint/eslint-plugin@${{ matrix.ts-eslint-plugin-version }} @typescript-eslint/parser@${{ matrix.ts-eslint-plugin-version }}
- name: run tests
# only collect coverage on eslint versions that support dynamic import
run: yarn test --coverage ${{ matrix.eslint-version >= 8 }}
run: yarn test --coverage ${{ matrix.eslint-version == 8 }}
env:
CI: true
- uses: codecov/codecov-action@v3
Expand Down
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,65 @@
# [28.0.0-next.6](https://github.com/jest-community/eslint-plugin-jest/compare/v28.0.0-next.5...v28.0.0-next.6) (2024-03-29)


### Bug Fixes

* **no-large-snapshots:** avoid `instanceof RegExp` check for ESLint v9 compatibility ([#1542](https://github.com/jest-community/eslint-plugin-jest/issues/1542)) ([af4a9c9](https://github.com/jest-community/eslint-plugin-jest/commit/af4a9c94d624b5db4643c994f5bec96b0cb889b8))

# [28.0.0-next.5](https://github.com/jest-community/eslint-plugin-jest/compare/v28.0.0-next.4...v28.0.0-next.5) (2024-03-27)


### Features

* remove `snapshot` processor and `flat/snapshot` config ([#1532](https://github.com/jest-community/eslint-plugin-jest/issues/1532)) ([98087f9](https://github.com/jest-community/eslint-plugin-jest/commit/98087f9bb27082f9fbda59a56c65536fb9d8a0dc))


### BREAKING CHANGES

* removed unneeded `snapshot` processor and `flat/snapshot` config

# [28.0.0-next.4](https://github.com/jest-community/eslint-plugin-jest/compare/v28.0.0-next.3...v28.0.0-next.4) (2024-03-23)


### Features

* drop support for `@typescript-eslint/eslint-plugin` v5 ([#1530](https://github.com/jest-community/eslint-plugin-jest/issues/1530)) ([150e355](https://github.com/jest-community/eslint-plugin-jest/commit/150e3558a637b49ddd76d362f88332b30f78dc5c))


### BREAKING CHANGES

* dropped support for `@typescript-eslint/eslint-plugin` v5

# [28.0.0-next.3](https://github.com/jest-community/eslint-plugin-jest/compare/v28.0.0-next.2...v28.0.0-next.3) (2024-03-22)


### Features

* upgrade `@typescript-eslint/utils` to v6 ([#1508](https://github.com/jest-community/eslint-plugin-jest/issues/1508)) ([dc6e8cd](https://github.com/jest-community/eslint-plugin-jest/commit/dc6e8cd249817de585b50e473c2146e1542dd146))

# [28.0.0-next.2](https://github.com/jest-community/eslint-plugin-jest/compare/v28.0.0-next.1...v28.0.0-next.2) (2024-03-21)


### Features

* drop support for Node v14 ([#1527](https://github.com/jest-community/eslint-plugin-jest/issues/1527)) ([df5e580](https://github.com/jest-community/eslint-plugin-jest/commit/df5e58081d1bd15fbed8bd22f6c03d5f350d73b6))


### BREAKING CHANGES

* dropped support for Node v14

# [28.0.0-next.1](https://github.com/jest-community/eslint-plugin-jest/compare/v27.9.0...v28.0.0-next.1) (2024-03-21)


### Features

* remove `no-if` rule ([#1528](https://github.com/jest-community/eslint-plugin-jest/issues/1528)) ([f976fc8](https://github.com/jest-community/eslint-plugin-jest/commit/f976fc8c71fc5e9f55cd5ae09092f15ee277fd2c))


### BREAKING CHANGES

* removed `no-if` in favor of `no-conditional-in-test`

# [27.9.0](https://github.com/jest-community/eslint-plugin-jest/compare/v27.8.0...v27.9.0) (2024-02-16)


Expand Down
147 changes: 58 additions & 89 deletions README.md

Large diffs are not rendered by default.

58 changes: 0 additions & 58 deletions docs/rules/no-if.md

This file was deleted.

58 changes: 58 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { version as typescriptESLintPluginVersion } from '@typescript-eslint/eslint-plugin/package.json';
import { version as eslintVersion } from 'eslint/package.json';
import type { Config } from 'jest';
import * as semver from 'semver';

const config = {
clearMocks: true,
restoreMocks: true,
resetMocks: true,

coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},

projects: [
{
displayName: 'test',
testPathIgnorePatterns: [
'<rootDir>/lib/.*',
'<rootDir>/src/rules/__tests__/fixtures/*',
'<rootDir>/src/rules/__tests__/test-utils.ts',
],
coveragePathIgnorePatterns: ['/node_modules/'],
},
{
displayName: 'lint',
runner: 'jest-runner-eslint',
testMatch: ['<rootDir>/**/*.{js,ts}'],
testPathIgnorePatterns: ['<rootDir>/lib/.*'],
coveragePathIgnorePatterns: ['/node_modules/'],
},
],
} satisfies Config;

if (semver.major(eslintVersion) >= 9) {
config.projects = config.projects.filter(
({ displayName }) => displayName !== 'lint',
);

// jest/unbound-method doesn't work when using @typescript-eslint v6
if (semver.major(typescriptESLintPluginVersion) === 6) {
for (const project of config.projects) {
project.testPathIgnorePatterns.push(
'<rootDir>/src/rules/__tests__/unbound-method.test.ts',
);
project.coveragePathIgnorePatterns.push(
'<rootDir>/src/rules/unbound-method.ts',
);
}
}
}

export default config;
44 changes: 7 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-jest",
"version": "27.9.0",
"version": "28.0.0-next.6",
"description": "ESLint rules for Jest",
"keywords": [
"eslint",
Expand Down Expand Up @@ -64,38 +64,8 @@
"@semantic-release/github"
]
},
"jest": {
"coverageThreshold": {
"global": {
"branches": 100,
"functions": 100,
"lines": 100,
"statements": 100
}
},
"projects": [
{
"displayName": "test",
"testPathIgnorePatterns": [
"<rootDir>/lib/.*",
"<rootDir>/src/rules/__tests__/fixtures/*",
"<rootDir>/src/rules/__tests__/test-utils.ts"
]
},
{
"displayName": "lint",
"runner": "jest-runner-eslint",
"testMatch": [
"<rootDir>/**/*.{js,ts}"
],
"testPathIgnorePatterns": [
"<rootDir>/lib/.*"
]
}
]
},
"dependencies": {
"@typescript-eslint/utils": "^5.10.0"
"@typescript-eslint/utils": "^6.0.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
Expand All @@ -107,12 +77,12 @@
"@schemastore/package": "^0.0.10",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@tsconfig/node14": "^14.1.0",
"@tsconfig/node16": "^16.0.0",
"@types/eslint": "^8.4.6",
"@types/jest": "^29.0.0",
"@types/node": "^14.18.26",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-jest": "^29.0.0",
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"dedent": "^1.5.0",
Expand Down Expand Up @@ -142,7 +112,7 @@
"typescript": "^5.0.4"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0",
"eslint": "^7.0.0 || ^8.0.0",
"jest": "*"
},
Expand All @@ -156,7 +126,7 @@
},
"packageManager": "yarn@3.8.1",
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^16.10.0 || >=18.0.0"
},
"publishConfig": {
"provenance": true
Expand Down
14 changes: 0 additions & 14 deletions src/__tests__/__snapshots__/rules.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,6 @@ exports[`rules should export configs that refer to actual rules 1`] = `
"jest/valid-title": "error",
},
},
"flat/snapshots": {
"files": [
"**/*.snap",
],
"plugins": {
"jest": ObjectContaining {
"meta": {
"name": "eslint-plugin-jest",
"version": Any<String>,
},
},
},
"processor": "jest/snapshots",
},
"flat/style": {
"languageOptions": {
"globals": {
Expand Down
13 changes: 4 additions & 9 deletions src/__tests__/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync } from 'fs';
import { resolve } from 'path';
import plugin from '../';

const numberOfRules = 53;
const numberOfRules = 52;
const ruleNames = Object.keys(plugin.rules);
const deprecatedRules = Object.entries(plugin.rules)
.filter(([, rule]) => rule.meta.deprecated)
Expand Down Expand Up @@ -61,7 +61,6 @@ describe('rules', () => {
'flat/recommended': { plugins: { jest: expectJestPlugin } },
'flat/style': { plugins: { jest: expectJestPlugin } },
'flat/all': { plugins: { jest: expectJestPlugin } },
'flat/snapshots': { plugins: { jest: expectJestPlugin } },
});
expect(Object.keys(recommendedConfigs)).toEqual([
'all',
Expand All @@ -70,20 +69,16 @@ describe('rules', () => {
'flat/all',
'flat/recommended',
'flat/style',
'flat/snapshots',
]);
expect(Object.keys(recommendedConfigs.all.rules)).toHaveLength(
ruleNames.length - deprecatedRules.length,
);
expect(Object.keys(recommendedConfigs['flat/all'].rules)).toHaveLength(
ruleNames.length - deprecatedRules.length,
);
const allConfigRules = Object.values(recommendedConfigs)
.map(config => Object.keys(config.rules ?? {}))
.reduce((previousValue, currentValue) => [
...previousValue,
...currentValue,
]);
const allConfigRules = Object.values(recommendedConfigs).flatMap(config =>
Object.keys(config.rules ?? {}),
);

allConfigRules.forEach(rule => {
const ruleNamePrefix = 'jest/';
Expand Down