Skip to content

Commit bc4d4b7

Browse files
committed
feat(deps): Update dependencies 2024.12.01
1 parent b4e3f9a commit bc4d4b7

27 files changed

+6204
-4674
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
nodejs: [18, 19, 20, 21, 22]
18+
nodejs: [18, 19, 20, 21, 22, 23]
1919

2020
steps:
2121
- uses: actions/checkout@v4

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
with:
2626
node-version-file: .nvmrc
2727
cache: yarn
28-
- uses: github/codeql-action/init@v2
28+
- uses: github/codeql-action/init@v3
2929
with:
3030
languages: javascript-typescript
31-
- uses: github/codeql-action/analyze@v2
31+
- uses: github/codeql-action/analyze@v3
3232
with:
3333
category: /language:javascript-typescript

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.3.0
1+
23.3.0

.yarn/releases/yarn-4.3.1.cjs

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

.yarn/releases/yarn-4.5.3.cjs

Lines changed: 934 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ plugins:
99
path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
1010
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
1111

12-
yarnPath: .yarn/releases/yarn-4.3.1.cjs
12+
yarnPath: .yarn/releases/yarn-4.5.3.cjs

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ But what if you don't want to use Jest as your testing framework? What if you do
2222

2323
## Table of contents
2424

25-
- [Features](#features)
26-
- [Requirements](#requirements)
27-
- [Install](#install)
28-
- [Usage](#usage)
29-
- [With Vitest](#with-vitest)
30-
- [With Mocha](#with-mocha)
31-
- [Mocking native methods](#mocking-native-methods)
32-
- [Contributing](#contributing)
33-
- [License](#license)
25+
- [React Native Testing Mocks](#react-native-testing-mocks)
26+
- [Motivation](#motivation)
27+
- [Table of contents](#table-of-contents)
28+
- [Features](#features)
29+
- [Requirements](#requirements)
30+
- [Install](#install)
31+
- [Usage](#usage)
32+
- [With Vitest](#with-vitest)
33+
- [With Mocha](#with-mocha)
34+
- [Mocking native methods](#mocking-native-methods)
35+
- [Contributing](#contributing)
36+
- [Something's missing?](#somethings-missing)
37+
- [Contributions](#contributions)
38+
- [License](#license)
3439

3540
### Features
3641

@@ -49,6 +54,9 @@ But what if you don't want to use Jest as your testing framework? What if you do
4954
- **react:** >=18.2.0
5055
- **react-native:** ">=0.73.2
5156

57+
> [!NOTE]
58+
> Node.js v22.7.0 has enabled [module syntax detection](https://github.com/nodejs/node/releases/tag/v22.7.0) by default, causing React Native's flow modules to fail to load. The simplest solution for now is to disable the experimental feature using the `--no-experimental-detect-module` flag. You can add it to your tests script with the following environmet variable: `NODE_OPTIONS="--no-experimental-detect-module"`.
59+
5260
## Install
5361

5462
With NPM:
Lines changed: 38 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,30 @@
11
// @ts-check
2-
import path from "path";
3-
import { fileURLToPath } from "url";
4-
5-
import { fixupPluginRules } from "@eslint/compat";
6-
import { FlatCompat } from "@eslint/eslintrc";
72
import eslintJs from "@eslint/js";
83
import stylistic from "@stylistic/eslint-plugin";
9-
import etc from "eslint-plugin-etc";
4+
import * as importPlugin from "eslint-plugin-import";
105
import jsdoc from "eslint-plugin-jsdoc";
11-
import reactJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
12-
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
6+
import perfectionist from "eslint-plugin-perfectionist";
7+
import reactPlugin from "eslint-plugin-react";
138
import sonarjs from "eslint-plugin-sonarjs";
149
import globals from "globals";
1510
import eslintTs from "typescript-eslint";
1611

1712
const project = "./tsconfig.json";
18-
const filename = fileURLToPath(import.meta.url);
19-
const dirname = path.dirname(filename);
20-
const compat = new FlatCompat({
21-
baseDirectory: dirname,
22-
recommendedConfig: eslintJs.configs.recommended,
23-
});
2413

2514
/**
26-
* @param {string} name the pugin name
27-
* @param {string} alias the plugin alias
28-
* @returns {import("eslint").ESLint.Plugin}
15+
* @param {object} config the plugin config
16+
* @returns {import("typescript-eslint").ConfigWithExtends}
2917
*/
30-
function legacyPlugin(name, alias = name) {
31-
const plugin = compat.plugins(name)[0]?.plugins?.[alias];
32-
33-
if (!plugin) {
34-
throw new Error(`Unable to resolve plugin ${name} and/or alias ${alias}`);
35-
}
36-
37-
return fixupPluginRules(plugin);
18+
function fixConfigTypes(config) {
19+
return config;
3820
}
3921

4022
export default eslintTs.config(
4123
eslintJs.configs.recommended,
4224
...eslintTs.configs.recommendedTypeChecked,
43-
...compat.extends("plugin:import/typescript"),
44-
reactRecommended,
45-
reactJsxRuntime,
25+
fixConfigTypes(importPlugin.flatConfigs?.typescript),
26+
fixConfigTypes(reactPlugin.configs.flat?.recommended),
27+
fixConfigTypes(reactPlugin.configs.flat?.["jsx-runtime"]),
4628
sonarjs.configs.recommended,
4729
stylistic.configs.customize({
4830
braceStyle: "1tbs",
@@ -63,7 +45,7 @@ export default eslintTs.config(
6345
globals: { ...globals.browser, ...globals.node },
6446
parserOptions: {
6547
ecmaFeatures: { jsx: true },
66-
ecmaVersion: 2024,
48+
ecmaVersion: 2023,
6749
jsxPragma: null,
6850
project,
6951
tsconfigRootDir: import.meta.dirname,
@@ -74,13 +56,12 @@ export default eslintTs.config(
7456
reportUnusedDisableDirectives: "error",
7557
},
7658
plugins: {
77-
deprecation: legacyPlugin("eslint-plugin-deprecation", "deprecation"),
78-
etc: fixupPluginRules(etc),
79-
"extra-rules": legacyPlugin("eslint-plugin-extra-rules", "extra-rules"),
80-
import: legacyPlugin("eslint-plugin-import", "import"),
59+
import: importPlugin,
8160
jsdoc,
61+
perfectionist,
8262
},
8363
settings: {
64+
"import/ignore": ["react-native"], // https://github.com/facebook/react-native/issues/28549
8465
"import/resolver": {
8566
typescript: {
8667
alwaysTryTypes: true,
@@ -95,7 +76,6 @@ export default eslintTs.config(
9576
{
9677
rules: {
9778
"@stylistic/arrow-parens": ["error", "as-needed"],
98-
"@stylistic/indent": "off",
9979
"@stylistic/indent-binary-ops": "off",
10080
"@stylistic/jsx-curly-brace-presence": ["error", { children: "always" }],
10181
"@stylistic/jsx-curly-newline": "off",
@@ -117,6 +97,7 @@ export default eslintTs.config(
11797
"@stylistic/no-mixed-spaces-and-tabs": "error",
11898
"@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
11999
"@stylistic/object-curly-spacing": ["error", "always"],
100+
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
120101
"@stylistic/padded-blocks": ["error", "never", { allowSingleLineBlocks: false }],
121102
"@stylistic/quote-props": ["error", "as-needed"],
122103
"@stylistic/quotes": ["error", "double", {
@@ -125,7 +106,6 @@ export default eslintTs.config(
125106
}],
126107
"@stylistic/space-before-function-paren": ["error", { anonymous: "never", named: "never" }],
127108
"@stylistic/switch-colon-spacing": "error",
128-
"@typescript-eslint/ban-types": "error",
129109
"@typescript-eslint/consistent-type-assertions": "error",
130110
"@typescript-eslint/consistent-type-exports": "error",
131111
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }],
@@ -187,14 +167,11 @@ export default eslintTs.config(
187167
camelcase: "error",
188168
"constructor-super": "error",
189169
curly: "error",
190-
"deprecation/deprecation": "error",
191170
eqeqeq: "error",
192-
"etc/no-assign-mutated-array": "error",
193-
"etc/no-implicit-any-catch": "error",
194-
"etc/no-internal": "error",
195-
"etc/throw-error": "error",
196-
"extra-rules/no-commented-out-code": "error",
197171
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
172+
"import/default": "off",
173+
"import/named": "off",
174+
"import/namespace": "off",
198175
"import/newline-after-import": "error",
199176
"import/no-absolute-path": "error",
200177
"import/no-cycle": ["error", {
@@ -204,7 +181,8 @@ export default eslintTs.config(
204181
}],
205182
"import/no-duplicates": ["error", { "prefer-inline": true }],
206183
"import/no-import-module-exports": "error",
207-
"import/no-namespace": "error",
184+
"import/no-named-as-default-member": "off",
185+
"import/no-namespace": ["error", { ignore: ["eslint-plugin-import"] }],
208186
"import/no-relative-packages": "error",
209187
"import/no-unresolved": "error",
210188
"import/no-useless-path-segments": "error",
@@ -247,6 +225,11 @@ export default eslintTs.config(
247225
"no-var": "error",
248226
"object-shorthand": "error",
249227
"one-var": ["error", "never"],
228+
"perfectionist/sort-interfaces": ["error", { ignoreCase: false, type: "natural" }],
229+
"perfectionist/sort-intersection-types": ["error", { ignoreCase: false, type: "natural" }],
230+
"perfectionist/sort-object-types": ["error", { ignoreCase: false, type: "natural" }],
231+
"perfectionist/sort-objects": ["error", { ignoreCase: false, type: "natural" }],
232+
"perfectionist/sort-union-types": ["error", { ignoreCase: false, type: "natural" }],
250233
"prefer-const": "error",
251234
radix: "error",
252235
"react/display-name": "off",
@@ -256,10 +239,17 @@ export default eslintTs.config(
256239
"react/jsx-no-literals": "error",
257240
"react/prop-types": "off",
258241
"sonarjs/cognitive-complexity": "off",
242+
"sonarjs/different-types-comparison": "off",
243+
"sonarjs/function-return-type": "off",
259244
"sonarjs/no-duplicate-string": "off",
260-
"sonarjs/no-inverted-boolean-check": "error",
245+
"sonarjs/no-empty-function": "off",
246+
"sonarjs/no-extend-native": "off",
247+
"sonarjs/no-nested-functions": "off",
248+
"sonarjs/no-selector-parameter": "off",
249+
"sonarjs/no-unused-expressions": "off",
250+
"sonarjs/public-static-readonly": "off",
251+
"sonarjs/sonar-prefer-read-only-props": "off",
261252
"sort-imports": ["error", { ignoreDeclarationSort: true }],
262-
"sort-keys": "error",
263253
},
264254
},
265255
{
@@ -273,11 +263,6 @@ export default eslintTs.config(
273263
rules: {
274264
...eslintTs.configs.disableTypeChecked.rules,
275265
"@typescript-eslint/explicit-function-return-type": "off",
276-
"deprecation/deprecation": "off",
277-
"etc/no-assign-mutated-array": "off",
278-
"etc/no-implicit-any-catch": "off",
279-
"etc/no-internal": "off",
280-
"etc/throw-error": "off",
281266
},
282267
},
283268
{
@@ -290,8 +275,11 @@ export default eslintTs.config(
290275
files: ["**/*.test.ts?(x)"],
291276
rules: {
292277
"@typescript-eslint/no-non-null-assertion": "off",
278+
"@typescript-eslint/prefer-promise-reject-errors": "off",
293279
"@typescript-eslint/restrict-template-expressions": "off",
294-
"etc/throw-error": "off",
280+
"sonarjs/assertions-in-tests": "off",
281+
"sonarjs/no-empty-test-file": "off",
282+
"sonarjs/no-nested-functions": "off",
295283
},
296284
},
297285
);

package.json

Lines changed: 40 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,24 @@
2222
"sideEffects": true,
2323
"exports": {
2424
".": {
25-
"import": "./dist/main.js",
26-
"require": "./dist/main.cjs",
2725
"types": "./dist/main.d.ts",
28-
"default": "./dist/main.js"
26+
"import": "./dist/main.js",
27+
"require": "./dist/main.cjs"
2928
},
3029
"./register": {
31-
"import": "./dist/register.js",
32-
"require": "./dist/register.cjs",
3330
"types": "./dist/register.d.ts",
34-
"default": "./dist/register.js"
31+
"import": "./dist/register.js",
32+
"require": "./dist/register.cjs"
3533
},
3634
"./vitest": {
37-
"import": "./dist/vitest.js",
38-
"require": "./dist/vitest.cjs",
3935
"types": "./dist/vitest/plugin.d.ts",
40-
"default": "./dist/vitest.js"
36+
"import": "./dist/vitest.js",
37+
"require": "./dist/vitest.cjs"
4138
},
4239
"./vitest/env": {
43-
"import": "./dist/vitestEnv.js",
44-
"require": "./dist/vitestEnv.cjs",
4540
"types": "./dist/vitest/env.d.ts",
46-
"default": "./dist/vitestEnv.js"
41+
"import": "./dist/vitestEnv.js",
42+
"require": "./dist/vitestEnv.cjs"
4743
},
4844
"./package.json": "./package.json"
4945
},
@@ -59,62 +55,58 @@
5955
},
6056
"scripts": {
6157
"build": "vite build",
62-
"check": "yarn compile && yarn lint && yarn test --run",
58+
"check": "yarn build && yarn compile && yarn lint && yarn test --run",
6359
"compile": "tsc",
6460
"lint": "eslint .",
6561
"release": "semantic-release",
66-
"test": "vitest"
62+
"test": "NODE_OPTIONS=\"--no-experimental-detect-module\" vitest"
6763
},
68-
"packageManager": "yarn@4.3.1",
64+
"packageManager": "yarn@4.5.3",
6965
"dependencies": {
70-
"@babel/core": "^7.24.7",
71-
"@babel/register": "^7.24.6",
66+
"@babel/core": "^7.26.0",
67+
"@babel/register": "^7.25.9",
7268
"babel-plugin-extension-resolver": "^1.0.12",
73-
"debug": "^4.3.5",
69+
"debug": "^4.3.7",
7470
"dot-prop-immutable": "^2.1.1",
71+
"rewiremock": "^3.14.5",
7572
"supports-color": "^9.4.0",
76-
"ts-pattern": "^5.2.0"
73+
"ts-pattern": "^5.5.0"
7774
},
7875
"devDependencies": {
7976
"@assertive-ts/core": "^2.1.0",
80-
"@eslint/compat": "^1.1.0",
81-
"@eslint/eslintrc": "^3.1.0",
82-
"@eslint/js": "^9.6.0",
83-
"@react-native/babel-preset": "^0.74.85",
84-
"@stylistic/eslint-plugin": "^2.3.0",
85-
"@testing-library/react-native": "^12.5.1",
77+
"@eslint/js": "^9.16.0",
78+
"@react-native/babel-preset": "^0.76.3",
79+
"@stylistic/eslint-plugin": "^2.11.0",
80+
"@testing-library/react-native": "^12.9.0",
8681
"@types/babel__core": "^7.20.5",
8782
"@types/babel__register": "^7.17.3",
8883
"@types/debug": "^4.1.12",
89-
"@types/eslint__eslintrc": "^2.1.1",
9084
"@types/eslint__js": "^8.42.3",
91-
"@types/node": "^20.14.10",
92-
"@types/react": "^18.3.3",
85+
"@types/node": "^22.10.1",
86+
"@types/react": "^18.3.12",
9387
"@types/react-test-renderer": "^18.3.0",
9488
"@types/sinon": "^17.0.3",
95-
"eslint": "^9.6.0",
96-
"eslint-import-resolver-typescript": "^3.6.1",
97-
"eslint-plugin-deprecation": "^3.0.0",
98-
"eslint-plugin-etc": "^2.0.3",
99-
"eslint-plugin-extra-rules": "^0.0.0-development",
100-
"eslint-plugin-import": "^2.29.1",
101-
"eslint-plugin-jsdoc": "^48.5.2",
102-
"eslint-plugin-react": "^7.34.3",
103-
"eslint-plugin-sonarjs": "^1.0.3",
104-
"globals": "^15.8.0",
89+
"eslint": "^9.16.0",
90+
"eslint-import-resolver-typescript": "^3.6.3",
91+
"eslint-plugin-import": "^2.31.0",
92+
"eslint-plugin-jsdoc": "^50.6.0",
93+
"eslint-plugin-perfectionist": "^4.1.2",
94+
"eslint-plugin-react": "^7.37.2",
95+
"eslint-plugin-sonarjs": "^2.0.4",
96+
"globals": "^15.12.0",
10597
"react": "18.3.1",
106-
"react-native": "^0.74.3",
107-
"react-native-svg": "^15.3.0",
98+
"react-native": "^0.76.3",
99+
"react-native-svg": "^15.9.0",
108100
"react-test-renderer": "^18.3.1",
109-
"semantic-release": "^24.0.0",
101+
"semantic-release": "^24.2.0",
110102
"semantic-release-yarn": "^3.0.2",
111-
"sinon": "^18.0.0",
112-
"tslib": "^2.6.3",
113-
"typescript": "^5.5.3",
114-
"typescript-eslint": "^7.15.0",
115-
"vite": "^5.3.3",
116-
"vite-plugin-dts": "^3.9.1",
117-
"vitest": "^1.6.0"
103+
"sinon": "^19.0.2",
104+
"tslib": "^2.8.1",
105+
"typescript": "^5.7.2",
106+
"typescript-eslint": "^8.16.0",
107+
"vite": "^6.0.1",
108+
"vite-plugin-dts": "^4.3.0",
109+
"vitest": "^2.1.6"
118110
},
119111
"peerDependencies": {
120112
"@react-native/babel-preset": ">=0.73.18",

register.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from "./dist/register";
1+
export type * from "./dist/register";

0 commit comments

Comments
 (0)