Skip to content

Commit

Permalink
Merge branch 'main' into fix/worker-threads-data-clone
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Mar 1, 2024
2 parents ec421c8 + 892f9a6 commit 3f50677
Show file tree
Hide file tree
Showing 911 changed files with 39,972 additions and 22,193 deletions.
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ aliases:
app-dir: ~/jest

orbs:
node: circleci/node@5.1.0
node: circleci/node@5.2.0

jobs:
test-node:
Expand Down Expand Up @@ -58,6 +58,5 @@ workflows:
name: test-node-partial-<< matrix.node-version >>
matrix:
parameters:
# For some reason, v20 fails to run yarn install…
node-version: ['14', '16', '18', '19']
node-version: ['16', '18', '20', '21']
- test-jest-jasmine
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ website/static

# Third-party script
packages/jest-diff/src/cleanupSemantic.ts
e2e/native-esm/wasm-bindgen/index_bg.js

**/.yarn
**/.pnp.*
Expand Down
153 changes: 132 additions & 21 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ module.exports = {
'plugin:markdown/recommended',
'plugin:import/errors',
'plugin:eslint-comments/recommended',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
'plugin:prettier/recommended',
],
globals: {
Expand All @@ -41,40 +43,46 @@ module.exports = {
overrides: [
{
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/strict',
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
],
files: ['*.ts', '*.tsx'],
plugins: ['@typescript-eslint/eslint-plugin', 'local'],
rules: {
'@typescript-eslint/array-type': ['error', {default: 'generic'}],
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{fixStyle: 'inline-type-imports', disallowTypeAnnotations: false},
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{argsIgnorePattern: '^_'},
],
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
// TS verifies these
'consistent-return': 'off',
'no-dupe-class-members': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
// TODO: enable at some point
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',

// not needed to be enforced for TS
'import/namespace': 'off',
},
},
{
files: [
'packages/jest-jasmine2/src/jasmine/Env.ts',
'packages/jest-jasmine2/src/jasmine/ReportDispatcher.ts',
'packages/jest-jasmine2/src/jasmine/Spec.ts',
'packages/jest-jasmine2/src/jasmine/SpyStrategy.ts',
'packages/jest-jasmine2/src/jasmine/Suite.ts',
'packages/jest-jasmine2/src/jasmine/createSpy.ts',
'packages/jest-jasmine2/src/jasmine/jasmineLight.ts',
'packages/jest-mock/src/__tests__/index.test.ts',
'packages/jest-mock/src/index.ts',
'packages/pretty-format/src/__tests__/Immutable.test.ts',
Expand All @@ -89,13 +97,7 @@ module.exports = {
files: [
'packages/expect/src/index.ts',
'packages/jest-fake-timers/src/legacyFakeTimers.ts',
'packages/jest-jasmine2/src/jasmine/Env.ts',
'packages/jest-jasmine2/src/jasmine/ReportDispatcher.ts',
'packages/jest-jasmine2/src/jasmine/Spec.ts',
'packages/jest-jasmine2/src/jasmine/Suite.ts',
'packages/jest-jasmine2/src/jasmine/jasmineLight.ts',
'packages/jest-jasmine2/src/jestExpect.ts',
'packages/jest-resolve/src/resolver.ts',
],
rules: {
'local/prefer-spread-eventually': 'warn',
Expand All @@ -112,8 +114,6 @@ module.exports = {
'packages/expect-utils/src/utils.ts',
'packages/jest-core/src/collectHandles.ts',
'packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts',
'packages/jest-jasmine2/src/jasmine/SpyStrategy.ts',
'packages/jest-jasmine2/src/jasmine/Suite.ts',
'packages/jest-leak-detector/src/index.ts',
'packages/jest-matcher-utils/src/index.ts',
'packages/jest-mock/src/__tests__/index.test.ts',
Expand Down Expand Up @@ -146,6 +146,13 @@ module.exports = {
],
},
},
{
files: 'e2e/coverage-remapping/covered.ts',
rules: {
'no-constant-binary-expression': 'off',
'no-constant-condition': 'off',
},
},

// 'eslint-plugin-jest' rules for test and test related files
{
Expand All @@ -158,6 +165,7 @@ module.exports = {
'e2e/failures/macros.js',
'e2e/test-in-root/*.js',
'e2e/test-match/test-suites/*',
'e2e/test-match-default/dot-spec-tests/*',
'packages/test-utils/src/ConditionalTest.ts',
],
env: {'jest/globals': true},
Expand Down Expand Up @@ -207,9 +215,15 @@ module.exports = {
'jest/no-focused-tests': 'off',
'jest/require-to-throw-message': 'off',
'no-console': 'off',
'no-constant-condition': 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'sort-keys': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/error-message': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/no-static-only-class': 'off',
'unicorn/prefer-number-properties': 'off',
},
},
// demonstration of matchers usage
Expand Down Expand Up @@ -272,6 +286,16 @@ module.exports = {
'no-restricted-imports': 'off',
},
},
{
files: ['examples/angular/**/*'],
rules: {
// Angular DI for some reason doesn't work with type imports
'@typescript-eslint/consistent-type-imports': [
'error',
{prefer: 'no-type-imports', disallowTypeAnnotations: false},
],
},
},
{
files: 'packages/**/*.ts',
rules: {
Expand All @@ -295,6 +319,7 @@ module.exports = {
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/class-literal-property-style': 'off',
},
},
{
Expand All @@ -307,6 +332,9 @@ module.exports = {
],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/prefer-spread': 'off',
},
},
{
Expand All @@ -315,8 +343,12 @@ module.exports = {
'packages/expect-utils/src/jasmineUtils.ts',
],
rules: {
'@typescript-eslint/ban-types': 'off',
'eslint-comments/disable-enable-pair': 'off',
'eslint-comments/no-unlimited-disable': 'off',
'prefer-rest-params': 'off',
'prefer-spread': 'off',
'sort-keys ': 'off',
},
},
{
Expand All @@ -336,17 +368,21 @@ module.exports = {
'website/**',
'**/__benchmarks__/**',
'**/__tests__/**',
'packages/jest-types/**/*',
'**/__typetests__/**',
'.eslintplugin/**',
],
rules: {
'import/no-extraneous-dependencies': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/error-message': 'off',
},
},
{
files: ['**/__typetests__/**'],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/no-useless-constructor': 'off',
},
},
{
Expand All @@ -357,7 +393,7 @@ module.exports = {
files: [
'scripts/*',
'packages/*/__benchmarks__/test.js',
'packages/jest-cli/src/init/index.ts',
'packages/create-jest/src/runCreate.ts',
'packages/jest-repl/src/cli/runtime-cli.ts',
],
rules: {
Expand All @@ -374,12 +410,44 @@ module.exports = {
'**/__typetests__/**',
],
rules: {
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'import/no-unresolved': 'off',
'no-console': 'off',
'no-unused-vars': 'off',
},
},
{
files: 'packages/jest-mock/src/__tests__/**/*',
rules: {
'unicorn/no-static-only-class': 'off',
},
},
{
files: '**/*.mjs',
rules: {
'unicorn/prefer-top-level-await': 'error',
},
},
{
files: [
'e2e/coverage-report/__mocks__/sumDependency.js',
'e2e/require-main-after-create-require/empty.js',
'packages/create-jest/src/__tests__/__fixtures__/**/*',
'packages/jest-core/src/__tests__/**/*',
'packages/jest-haste-map/src/__tests__/test_dotfiles_root/**/*',
'packages/jest-resolve/src/__mocks__/**/*',
],
rules: {
'unicorn/no-empty-file': 'off',
},
},
{
files: 'packages/expect/src/__tests__/*.test.js',
rules: {
'unicorn/prefer-number-properties': 'off',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand Down Expand Up @@ -407,6 +475,7 @@ module.exports = {
'handle-callback-err': 'off',
'id-length': 'off',
'id-match': 'off',
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': [
'error',
{
Expand Down Expand Up @@ -464,7 +533,8 @@ module.exports = {
{allow: ['warn', 'error', 'time', 'timeEnd', 'timeStamp']},
],
'no-const-assign': 'error',
'no-constant-condition': 'off',
'no-constant-condition': 'error',
'no-constant-binary-expression': 'error',
'no-continue': 'off',
'no-control-regex': 'off',
'no-debugger': 'error',
Expand Down Expand Up @@ -506,9 +576,7 @@ module.exports = {
'no-multi-str': 'error',
'no-multiple-empty-lines': 'off',
'no-native-reassign': ['error', {exceptions: ['Map', 'Set']}],
'no-negated-condition': 'off',
'no-negated-in-lhs': 'error',
'no-nested-ternary': 'off',
'no-new': 'warn',
'no-new-func': 'error',
'no-new-object': 'warn',
Expand Down Expand Up @@ -570,6 +638,11 @@ module.exports = {
'prefer-arrow-callback': ['error', {allowNamedFunctions: true}],
'prefer-const': 'error',
'prefer-template': 'error',

'promise/always-return': 'off',
'promise/catch-or-return': 'off',
'promise/no-callback-in-promise': 'off',

quotes: [
'error',
'single',
Expand All @@ -590,6 +663,44 @@ module.exports = {
'wrap-iife': 'off',
'wrap-regex': 'off',
yoda: 'off',

// doesn't work without ESModuleInterop
'unicorn/import-style': 'off',
// we're a CJS project
'unicorn/prefer-module': 'off',

// enforced by `@typescript-eslint/no-this-alias` already
'unicorn/no-this-assignment': 'off',

// Not an issue with TypeScript
'unicorn/no-array-callback-reference': 'off',

// reduce is fine
'unicorn/no-array-reduce': 'off',

// this is very aggressive (600+ files changed). might make sense to apply bit by bit over time?
'unicorn/prevent-abbreviations': 'off',

// nah
'unicorn/consistent-destructuring': 'off',
'unicorn/no-lonely-if': 'off',
'unicorn/no-null': 'off',
'unicorn/no-process-exit': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/prefer-event-target': 'off',
'unicorn/prefer-switch': 'off',
'unicorn/prefer-ternary': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/switch-case-braces': 'off',

// TODO: decide whether or not we want these
'unicorn/filename-case': 'off',
'unicorn/prefer-reflect-apply': 'off',

// enabling this is blocked by https://github.com/microsoft/rushstack/issues/2780
'unicorn/prefer-export-from': 'off',
// enabling this is blocked by https://github.com/jestjs/jest/pull/14297
'unicorn/prefer-node-protocol': 'off',
},
settings: {
'import/ignore': ['react-native'],
Expand Down
10 changes: 9 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"lockFileMaintenance": {"enabled": true, "automerge": true},
"lockFileMaintenance": {"enabled": true, "automerge": false},
"rangeStrategy": "replace",
"postUpdateOptions": ["yarnDedupeHighest"],
"packageRules": [
{
"matchPackageNames": ["@tsd/typescript", "typescript"],
"groupName": "typescript"
},
{
"matchPackageNames": ["jest-runner-tsd", "tsd-lite"],
"groupName": "tsd"
},
{
"matchPackageNames": ["@lerna-lite/cli", "@lerna-lite/publish"],
"groupName": "lerna-lite"
}
]
}
Loading

0 comments on commit 3f50677

Please sign in to comment.