Skip to content

Commit

Permalink
feat(deps): Update dependencies 2024.12.01
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion committed Dec 1, 2024
1 parent b4e3f9a commit bc4d4b7
Show file tree
Hide file tree
Showing 27 changed files with 6,204 additions and 4,674 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
nodejs: [18, 19, 20, 21, 22]
nodejs: [18, 19, 20, 21, 22, 23]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
with:
node-version-file: .nvmrc
cache: yarn
- uses: github/codeql-action/init@v2
- uses: github/codeql-action/init@v3
with:
languages: javascript-typescript
- uses: github/codeql-action/analyze@v2
- uses: github/codeql-action/analyze@v3
with:
category: /language:javascript-typescript
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.3.0
23.3.0
894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.3.1.cjs

This file was deleted.

934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.3.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ plugins:
path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"

yarnPath: .yarn/releases/yarn-4.3.1.cjs
yarnPath: .yarn/releases/yarn-4.5.3.cjs
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@ But what if you don't want to use Jest as your testing framework? What if you do

## Table of contents

- [Features](#features)
- [Requirements](#requirements)
- [Install](#install)
- [Usage](#usage)
- [With Vitest](#with-vitest)
- [With Mocha](#with-mocha)
- [Mocking native methods](#mocking-native-methods)
- [Contributing](#contributing)
- [License](#license)
- [React Native Testing Mocks](#react-native-testing-mocks)
- [Motivation](#motivation)
- [Table of contents](#table-of-contents)
- [Features](#features)
- [Requirements](#requirements)
- [Install](#install)
- [Usage](#usage)
- [With Vitest](#with-vitest)
- [With Mocha](#with-mocha)
- [Mocking native methods](#mocking-native-methods)
- [Contributing](#contributing)
- [Something's missing?](#somethings-missing)
- [Contributions](#contributions)
- [License](#license)

### Features

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

> [!NOTE]
> 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"`.
## Install

With NPM:
Expand Down
88 changes: 38 additions & 50 deletions eslint.config.mjs → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,30 @@
// @ts-check
import path from "path";
import { fileURLToPath } from "url";

import { fixupPluginRules } from "@eslint/compat";
import { FlatCompat } from "@eslint/eslintrc";
import eslintJs from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import etc from "eslint-plugin-etc";
import * as importPlugin from "eslint-plugin-import";
import jsdoc from "eslint-plugin-jsdoc";
import reactJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
import perfectionist from "eslint-plugin-perfectionist";
import reactPlugin from "eslint-plugin-react";
import sonarjs from "eslint-plugin-sonarjs";
import globals from "globals";
import eslintTs from "typescript-eslint";

const project = "./tsconfig.json";
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
const compat = new FlatCompat({
baseDirectory: dirname,
recommendedConfig: eslintJs.configs.recommended,
});

/**
* @param {string} name the pugin name
* @param {string} alias the plugin alias
* @returns {import("eslint").ESLint.Plugin}
* @param {object} config the plugin config
* @returns {import("typescript-eslint").ConfigWithExtends}
*/
function legacyPlugin(name, alias = name) {
const plugin = compat.plugins(name)[0]?.plugins?.[alias];

if (!plugin) {
throw new Error(`Unable to resolve plugin ${name} and/or alias ${alias}`);
}

return fixupPluginRules(plugin);
function fixConfigTypes(config) {
return config;
}

export default eslintTs.config(
eslintJs.configs.recommended,
...eslintTs.configs.recommendedTypeChecked,
...compat.extends("plugin:import/typescript"),
reactRecommended,
reactJsxRuntime,
fixConfigTypes(importPlugin.flatConfigs?.typescript),
fixConfigTypes(reactPlugin.configs.flat?.recommended),
fixConfigTypes(reactPlugin.configs.flat?.["jsx-runtime"]),
sonarjs.configs.recommended,
stylistic.configs.customize({
braceStyle: "1tbs",
Expand All @@ -63,7 +45,7 @@ export default eslintTs.config(
globals: { ...globals.browser, ...globals.node },
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 2024,
ecmaVersion: 2023,
jsxPragma: null,
project,
tsconfigRootDir: import.meta.dirname,
Expand All @@ -74,13 +56,12 @@ export default eslintTs.config(
reportUnusedDisableDirectives: "error",
},
plugins: {
deprecation: legacyPlugin("eslint-plugin-deprecation", "deprecation"),
etc: fixupPluginRules(etc),
"extra-rules": legacyPlugin("eslint-plugin-extra-rules", "extra-rules"),
import: legacyPlugin("eslint-plugin-import", "import"),
import: importPlugin,
jsdoc,
perfectionist,
},
settings: {
"import/ignore": ["react-native"], // https://github.com/facebook/react-native/issues/28549
"import/resolver": {
typescript: {
alwaysTryTypes: true,
Expand All @@ -95,7 +76,6 @@ export default eslintTs.config(
{
rules: {
"@stylistic/arrow-parens": ["error", "as-needed"],
"@stylistic/indent": "off",
"@stylistic/indent-binary-ops": "off",
"@stylistic/jsx-curly-brace-presence": ["error", { children: "always" }],
"@stylistic/jsx-curly-newline": "off",
Expand All @@ -117,6 +97,7 @@ export default eslintTs.config(
"@stylistic/no-mixed-spaces-and-tabs": "error",
"@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
"@stylistic/padded-blocks": ["error", "never", { allowSingleLineBlocks: false }],
"@stylistic/quote-props": ["error", "as-needed"],
"@stylistic/quotes": ["error", "double", {
Expand All @@ -125,7 +106,6 @@ export default eslintTs.config(
}],
"@stylistic/space-before-function-paren": ["error", { anonymous: "never", named: "never" }],
"@stylistic/switch-colon-spacing": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }],
Expand Down Expand Up @@ -187,14 +167,11 @@ export default eslintTs.config(
camelcase: "error",
"constructor-super": "error",
curly: "error",
"deprecation/deprecation": "error",
eqeqeq: "error",
"etc/no-assign-mutated-array": "error",
"etc/no-implicit-any-catch": "error",
"etc/no-internal": "error",
"etc/throw-error": "error",
"extra-rules/no-commented-out-code": "error",
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
"import/default": "off",
"import/named": "off",
"import/namespace": "off",
"import/newline-after-import": "error",
"import/no-absolute-path": "error",
"import/no-cycle": ["error", {
Expand All @@ -204,7 +181,8 @@ export default eslintTs.config(
}],
"import/no-duplicates": ["error", { "prefer-inline": true }],
"import/no-import-module-exports": "error",
"import/no-namespace": "error",
"import/no-named-as-default-member": "off",
"import/no-namespace": ["error", { ignore: ["eslint-plugin-import"] }],
"import/no-relative-packages": "error",
"import/no-unresolved": "error",
"import/no-useless-path-segments": "error",
Expand Down Expand Up @@ -247,6 +225,11 @@ export default eslintTs.config(
"no-var": "error",
"object-shorthand": "error",
"one-var": ["error", "never"],
"perfectionist/sort-interfaces": ["error", { ignoreCase: false, type: "natural" }],
"perfectionist/sort-intersection-types": ["error", { ignoreCase: false, type: "natural" }],
"perfectionist/sort-object-types": ["error", { ignoreCase: false, type: "natural" }],
"perfectionist/sort-objects": ["error", { ignoreCase: false, type: "natural" }],
"perfectionist/sort-union-types": ["error", { ignoreCase: false, type: "natural" }],
"prefer-const": "error",
radix: "error",
"react/display-name": "off",
Expand All @@ -256,10 +239,17 @@ export default eslintTs.config(
"react/jsx-no-literals": "error",
"react/prop-types": "off",
"sonarjs/cognitive-complexity": "off",
"sonarjs/different-types-comparison": "off",
"sonarjs/function-return-type": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-inverted-boolean-check": "error",
"sonarjs/no-empty-function": "off",
"sonarjs/no-extend-native": "off",
"sonarjs/no-nested-functions": "off",
"sonarjs/no-selector-parameter": "off",
"sonarjs/no-unused-expressions": "off",
"sonarjs/public-static-readonly": "off",
"sonarjs/sonar-prefer-read-only-props": "off",
"sort-imports": ["error", { ignoreDeclarationSort: true }],
"sort-keys": "error",
},
},
{
Expand All @@ -273,11 +263,6 @@ export default eslintTs.config(
rules: {
...eslintTs.configs.disableTypeChecked.rules,
"@typescript-eslint/explicit-function-return-type": "off",
"deprecation/deprecation": "off",
"etc/no-assign-mutated-array": "off",
"etc/no-implicit-any-catch": "off",
"etc/no-internal": "off",
"etc/throw-error": "off",
},
},
{
Expand All @@ -290,8 +275,11 @@ export default eslintTs.config(
files: ["**/*.test.ts?(x)"],
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"etc/throw-error": "off",
"sonarjs/assertions-in-tests": "off",
"sonarjs/no-empty-test-file": "off",
"sonarjs/no-nested-functions": "off",
},
},
);
88 changes: 40 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,24 @@
"sideEffects": true,
"exports": {
".": {
"import": "./dist/main.js",
"require": "./dist/main.cjs",
"types": "./dist/main.d.ts",
"default": "./dist/main.js"
"import": "./dist/main.js",
"require": "./dist/main.cjs"
},
"./register": {
"import": "./dist/register.js",
"require": "./dist/register.cjs",
"types": "./dist/register.d.ts",
"default": "./dist/register.js"
"import": "./dist/register.js",
"require": "./dist/register.cjs"
},
"./vitest": {
"import": "./dist/vitest.js",
"require": "./dist/vitest.cjs",
"types": "./dist/vitest/plugin.d.ts",
"default": "./dist/vitest.js"
"import": "./dist/vitest.js",
"require": "./dist/vitest.cjs"
},
"./vitest/env": {
"import": "./dist/vitestEnv.js",
"require": "./dist/vitestEnv.cjs",
"types": "./dist/vitest/env.d.ts",
"default": "./dist/vitestEnv.js"
"import": "./dist/vitestEnv.js",
"require": "./dist/vitestEnv.cjs"
},
"./package.json": "./package.json"
},
Expand All @@ -59,62 +55,58 @@
},
"scripts": {
"build": "vite build",
"check": "yarn compile && yarn lint && yarn test --run",
"check": "yarn build && yarn compile && yarn lint && yarn test --run",
"compile": "tsc",
"lint": "eslint .",
"release": "semantic-release",
"test": "vitest"
"test": "NODE_OPTIONS=\"--no-experimental-detect-module\" vitest"
},
"packageManager": "yarn@4.3.1",
"packageManager": "yarn@4.5.3",
"dependencies": {
"@babel/core": "^7.24.7",
"@babel/register": "^7.24.6",
"@babel/core": "^7.26.0",
"@babel/register": "^7.25.9",
"babel-plugin-extension-resolver": "^1.0.12",
"debug": "^4.3.5",
"debug": "^4.3.7",
"dot-prop-immutable": "^2.1.1",
"rewiremock": "^3.14.5",
"supports-color": "^9.4.0",
"ts-pattern": "^5.2.0"
"ts-pattern": "^5.5.0"
},
"devDependencies": {
"@assertive-ts/core": "^2.1.0",
"@eslint/compat": "^1.1.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.6.0",
"@react-native/babel-preset": "^0.74.85",
"@stylistic/eslint-plugin": "^2.3.0",
"@testing-library/react-native": "^12.5.1",
"@eslint/js": "^9.16.0",
"@react-native/babel-preset": "^0.76.3",
"@stylistic/eslint-plugin": "^2.11.0",
"@testing-library/react-native": "^12.9.0",
"@types/babel__core": "^7.20.5",
"@types/babel__register": "^7.17.3",
"@types/debug": "^4.1.12",
"@types/eslint__eslintrc": "^2.1.1",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.14.10",
"@types/react": "^18.3.3",
"@types/node": "^22.10.1",
"@types/react": "^18.3.12",
"@types/react-test-renderer": "^18.3.0",
"@types/sinon": "^17.0.3",
"eslint": "^9.6.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-etc": "^2.0.3",
"eslint-plugin-extra-rules": "^0.0.0-development",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.5.2",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-sonarjs": "^1.0.3",
"globals": "^15.8.0",
"eslint": "^9.16.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsdoc": "^50.6.0",
"eslint-plugin-perfectionist": "^4.1.2",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-sonarjs": "^2.0.4",
"globals": "^15.12.0",
"react": "18.3.1",
"react-native": "^0.74.3",
"react-native-svg": "^15.3.0",
"react-native": "^0.76.3",
"react-native-svg": "^15.9.0",
"react-test-renderer": "^18.3.1",
"semantic-release": "^24.0.0",
"semantic-release": "^24.2.0",
"semantic-release-yarn": "^3.0.2",
"sinon": "^18.0.0",
"tslib": "^2.6.3",
"typescript": "^5.5.3",
"typescript-eslint": "^7.15.0",
"vite": "^5.3.3",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.6.0"
"sinon": "^19.0.2",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vite": "^6.0.1",
"vite-plugin-dts": "^4.3.0",
"vitest": "^2.1.6"
},
"peerDependencies": {
"@react-native/babel-preset": ">=0.73.18",
Expand Down
2 changes: 1 addition & 1 deletion register.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./dist/register";
export type * from "./dist/register";
Loading

0 comments on commit bc4d4b7

Please sign in to comment.