From c5963a4cb5027860462c1fba82b82137e2902fde Mon Sep 17 00:00:00 2001 From: dev-yakuza Date: Sat, 18 Jan 2025 15:35:45 +0900 Subject: [PATCH] deps: Update ESLint from v8 to v9 --- .cspell.json | 2 +- .eslintrc.js | 103 --- .prettierrc.js | 7 - .prettierrc.json | 7 + Develop/README.md | 2 +- Example/README.md | 2 +- eslint.config.js | 234 +++++ lefthook.yml | 4 +- package-lock.json | 839 +++++++----------- package.json | 11 +- .../components/Background/index.tsx | 9 +- .../components/DisplayImageArea/index.tsx | 1 + .../ImageDetail/components/Footer/index.tsx | 1 + .../ImageDetail/components/Header/index.tsx | 1 + .../components/ImageArea/index.tsx | 36 +- .../components/{index.tsx => index.ts} | 0 src/components/ImageDetail/index.tsx | 418 ++++----- src/components/OriginImage/index.tsx | 4 +- src/components/{index.tsx => index.ts} | 0 src/hooks/useOriginImageLayout/index.ts | 4 +- src/index.tsx | 248 +++--- 21 files changed, 921 insertions(+), 1012 deletions(-) delete mode 100644 .eslintrc.js delete mode 100644 .prettierrc.js create mode 100644 .prettierrc.json create mode 100644 eslint.config.js rename src/components/ImageDetail/components/{index.tsx => index.ts} (100%) rename src/components/{index.tsx => index.ts} (100%) diff --git a/.cspell.json b/.cspell.json index 41fea18..63fc6b6 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,7 +1,7 @@ { "version": "0.2", "ignorePaths": [ - ".eslintrc.js", + "eslint.config.js", ".gitignore", "*.lock", "*.snap", diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 175733d..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,103 +0,0 @@ -module.exports = { - env: { - es6: true, - node: true, - jest: true, - }, - extends: [ - 'eslint:recommended', - 'plugin:react/recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'plugin:jsdoc/recommended-error', - ], - globals: { - Atomics: 'readonly', - SharedArrayBuffer: 'readonly', - }, - parser: '@typescript-eslint/parser', - parserOptions: { - project: './tsconfig.json', - ecmaFeatures: { - jsx: true, - }, - ecmaVersion: 2018, - sourceType: 'module', - }, - plugins: [ - 'react', - 'react-hooks', - '@typescript-eslint', - 'unused-imports', - 'import', - 'functional', - 'unicorn', - ], - rules: { - indent: ['error', 2, { SwitchCase: 1 }], - 'linebreak-style': ['error', 'unix'], - quotes: ['error', 'single'], - semi: ['error', 'always'], - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/consistent-type-imports': 'error', - '@typescript-eslint/require-await': 'error', - '@typescript-eslint/member-ordering': [ - 'error', - { - default: ['field', 'signature', 'constructor', 'method'], - }, - ], - '@typescript-eslint/method-signature-style': ['error', 'method'], - '@typescript-eslint/unbound-method': 'off', - 'react/display-name': 'off', - 'react/react-in-jsx-scope': 'off', - 'react/jsx-no-useless-fragment': 'error', - 'react/jsx-handler-names': [ - 'error', - { - eventHandlerPrefix: 'handle', - eventHandlerPropPrefix: 'on', - }, - ], - 'unused-imports/no-unused-imports': 'error', - 'import/order': [ - 'error', - { - groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], - alphabetize: { order: 'asc', caseInsensitive: true }, - pathGroups: [ - { - pattern: 'react**', - group: 'external', - position: 'before', - }, - ], - pathGroupsExcludedImportTypes: ['builtin'], - }, - ], - 'import/exports-last': 'error', - 'functional/prefer-readonly-type': [ - 'error', - { - allowLocalMutation: true, - allowMutableReturnType: true, - ignoreClass: true, - }, - ], - 'unicorn/no-null': 'error', - 'require-await': 'off', - eqeqeq: 'error', - 'no-empty-function': 'off', - semi: 'off', - complexity: 'error', - 'max-depth': 'error', - }, - settings: { - react: { - version: 'detect', - }, - }, -} diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 8f6d1dd..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - tabWidth: 2, - semi: false, - singleQuote: true, - jsxSingleQuote: true, - printWidth: 100, -} diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..3a45863 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "tabWidth": 2, + "semi": false, + "singleQuote": true, + "jsxSingleQuote": true, + "printWidth": 100 +} diff --git a/Develop/README.md b/Develop/README.md index 12470c3..8bd066d 100644 --- a/Develop/README.md +++ b/Develop/README.md @@ -2,7 +2,7 @@ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped # Getting Started ->**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding. +> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding. ## Step 1: Start the Metro Server diff --git a/Example/README.md b/Example/README.md index 12470c3..8bd066d 100644 --- a/Example/README.md +++ b/Example/README.md @@ -2,7 +2,7 @@ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped # Getting Started ->**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding. +> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding. ## Step 1: Start the Metro Server diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..371dfca --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,234 @@ +import js from '@eslint/js' +import globals from 'globals' +import tseslint from 'typescript-eslint' +import eslintPluginReactRefresh from 'eslint-plugin-react-refresh' +import eslintPluginReactHooks from 'eslint-plugin-react-hooks' +import eslintPluginReact from 'eslint-plugin-react' +import eslintPluginJSDoc from 'eslint-plugin-jsdoc' +import eslintPluginUnicorn from 'eslint-plugin-unicorn' +import eslintPluginImport from 'eslint-plugin-import' +import eslintPluginFunctional from 'eslint-plugin-functional' +import eslintPluginUnusedImports from 'eslint-plugin-unused-imports' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: { + ...globals.browser, + ...globals.jest, + ...globals.node, + }, + parserOptions: { + project: ['./tsconfig.json'], + tsconfigRootDir: import.meta.dirname, + }, + }, + settings: { + react: { + version: 'detect', + }, + }, + plugins: { + 'react-refresh': eslintPluginReactRefresh, + 'react-hooks': eslintPluginReactHooks, + react: eslintPluginReact, + jsdoc: eslintPluginJSDoc, + unicorn: eslintPluginUnicorn, + import: eslintPluginImport, + functional: eslintPluginFunctional, + 'unused-imports': eslintPluginUnusedImports, + }, + rules: { + ...eslintPluginReactHooks.configs.recommended.rules, + ...eslintPluginReactRefresh.configs.recommended.rules, + ...eslintPluginReact.configs.recommended.rules, + ...eslintPluginJSDoc.configs.recommended.rules, + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/consistent-type-imports': 'error', + '@typescript-eslint/explicit-member-accessibility': 'off', + '@typescript-eslint/indent': 'off', + '@typescript-eslint/member-delimiter-style': 'off', + '@typescript-eslint/no-confusing-void-expression': [ + 'error', + { + ignoreArrowShorthand: true, + ignoreVoidOperator: true, + }, + ], + '@typescript-eslint/no-invalid-this': 'error', + '@typescript-eslint/no-invalid-void-type': 'error', + '@typescript-eslint/no-loop-func': 'error', + '@typescript-eslint/no-loss-of-precision': 'error', + '@typescript-eslint/no-parameter-properties': 'off', + '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', + '@typescript-eslint/no-unnecessary-condition': 'error', + '@typescript-eslint/no-unnecessary-type-arguments': 'error', + '@typescript-eslint/no-unused-expressions': 'error', + '@typescript-eslint/no-use-before-define': [ + 'error', + { + variables: false, + }, + ], + '@typescript-eslint/prefer-enum-initializers': 'error', + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-includes': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', + '@typescript-eslint/prefer-optional-chain': 'error', + '@typescript-eslint/prefer-reduce-type-parameter': 'error', + '@typescript-eslint/prefer-string-starts-ends-with': 'error', + '@typescript-eslint/prefer-ts-expect-error': 'error', + '@typescript-eslint/promise-function-async': 'error', + '@typescript-eslint/return-await': 'error', + '@typescript-eslint/strict-boolean-expressions': 'error', + '@typescript-eslint/switch-exhaustiveness-check': 'error', + '@typescript-eslint/no-redeclare': 'error', + '@typescript-eslint/no-shadow': 'error', + '@typescript-eslint/member-ordering': 'error', + '@typescript-eslint/method-signature-style': ['error', 'method'], + '@typescript-eslint/consistent-indexed-object-style': 'error', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/no-inferrable-types': 'error', + 'functional/prefer-readonly-type': [ + 'error', + { + allowLocalMutation: true, + allowMutableReturnType: true, + ignoreClass: true, + }, + ], + 'unused-imports/no-unused-imports': 'error', + 'import/no-duplicates': 'error', + 'import/exports-last': 'error', + 'import/order': [ + 'error', + { + groups: [ + 'builtin', + 'external', + 'internal', + ['parent', 'sibling'], + 'object', + 'type', + 'index', + ], + + pathGroups: [ + { + pattern: '{react,react-dom/**}', + group: 'external', + position: 'before', + }, + { + pattern: '@/**', + group: 'internal', + }, + { + pattern: '.', + group: 'index', + }, + { + pattern: './App', + group: 'index', + }, + ], + + pathGroupsExcludedImportTypes: ['react'], + 'newlines-between': 'always', + + alphabetize: { + order: 'asc', + caseInsensitive: true, + }, + }, + ], + 'unicorn/no-useless-spread': 'error', + 'unicorn/no-null': 'error', + 'react/react-in-jsx-scope': 'off', + 'react/jsx-no-useless-fragment': 'error', + 'react/jsx-handler-names': [ + 'error', + { + eventHandlerPrefix: 'handle', + eventHandlerPropPrefix: 'on', + }, + ], + 'no-invalid-this': 'off', + 'no-loop-func': 'off', + 'no-loss-of-precision': 'off', + 'no-redeclare': 'off', + 'no-shadow': 'off', + 'no-throw-literal': 'error', + 'no-unused-expressions': 'off', + 'no-return-await': 'off', + 'sort-imports': [ + 'error', + { + ignoreCase: true, + ignoreDeclarationSort: true, + ignoreMemberSort: false, + allowSeparatedGroups: true, + }, + ], + 'linebreak-style': ['error', 'unix'], + 'nonblock-statement-body-position': ['error', 'beside'], + 'no-console': [ + 'error', + { + allow: ['debug', 'warn', 'error'], + }, + ], + 'prefer-destructuring': [ + 'error', + { + VariableDeclarator: { + array: false, + object: true, + }, + + AssignmentExpression: { + array: true, + object: true, + }, + }, + { + enforceForRenamedProperties: false, + }, + ], + 'require-await': 'off', + 'max-depth': 'error', + 'object-shorthand': 'error', + 'no-unneeded-ternary': 'error', + camelcase: [ + 'error', + { + properties: 'never', + allow: ['_UNSTABLE'], + }, + ], + quotes: [ + 'error', + 'single', + { + avoidEscape: true, + }, + ], + curly: ['error', 'multi-line', 'consistent'], + eqeqeq: [ + 'error', + 'always', + { + null: 'ignore', + }, + ], + complexity: 'error', + indent: ['error', 2, { SwitchCase: 1 }], + semi: 'off', + 'no-empty-function': 'off', + }, + }, +) diff --git a/lefthook.yml b/lefthook.yml index eeee78a..41b5e84 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,12 +1,12 @@ pre-commit: parallel: true commands: - Pretty: + Prettier: root: "src/" run: npx prettier --check {staged_files} ESLint: exclude: 'Develop|Example' glob: 'src/**/*.{js,jsx,ts,tsx}' - run: npx eslint -c .eslintrc.js {staged_files} + run: npx eslint -c eslint.config.js {staged_files} CSpell: run: npx cspell --gitignore --show-suggestions --no-must-find-files {staged_files} diff --git a/package-lock.json b/package-lock.json index 4ec2d0a..67c0344 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,24 +9,28 @@ "version": "3.0.13", "license": "MIT", "devDependencies": { + "@eslint/js": "^9.18.0", "@types/react": "19.0.7", "@types/react-native": "0.72.8", "@typescript-eslint/eslint-plugin": "8.20.0", "@typescript-eslint/parser": "8.20.0", "cspell": "^8.17.2", - "eslint": "8.57.0", - "eslint-plugin-functional": "^6.6.3", + "eslint": "9.18.0", + "eslint-plugin-functional": "^8.0.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsdoc": "^50.6.2", "eslint-plugin-react": "7.37.4", "eslint-plugin-react-hooks": "5.1.0", + "eslint-plugin-react-refresh": "^0.4.18", "eslint-plugin-unicorn": "^56.0.1", "eslint-plugin-unused-imports": "^4.1.4", + "globals": "^15.14.0", "lefthook": "^1.10.8", "prettier": "3.4.2", "react": "19.0.0", "react-native": "0.76.6", - "typescript": "5.7.3" + "typescript": "5.7.3", + "typescript-eslint": "^8.20.0" } }, "node_modules/@ampproject/remapping": { @@ -2193,17 +2197,69 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/config-array": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", + "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.5", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/core": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -2211,7 +2267,7 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -2228,6 +2284,19 @@ "concat-map": "0.0.1" } }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2242,53 +2311,75 @@ } }, "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.18.0.tgz", + "integrity": "sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==", "dev": true, "license": "MIT", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", - "deprecated": "Use @eslint/config-array instead", + "node_modules/@eslint/object-schema": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", + "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" + "@eslint/core": "^0.10.0", + "levn": "^0.4.1" }, "engines": { - "node": ">=10.10.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, - "license": "ISC", + "license": "Apache-2.0", "dependencies": { - "brace-expansion": "^1.1.7" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" }, "engines": { - "node": "*" + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, "node_modules/@humanwhocodes/module-importer": { @@ -2305,13 +2396,19 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", - "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", - "deprecated": "Use @eslint/object-schema instead", + "node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", "dev": true, - "license": "BSD-3-Clause" + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@isaacs/ttlcache": { "version": "1.4.1", @@ -3141,6 +3238,13 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -3178,6 +3282,13 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -3287,19 +3398,6 @@ "typescript": ">=4.8.4 <5.8.0" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ts-api-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", - "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, "node_modules/@typescript-eslint/parser": { "version": "8.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.20.0.tgz", @@ -3367,19 +3465,6 @@ "typescript": ">=4.8.4 <5.8.0" } }, - "node_modules/@typescript-eslint/type-utils/node_modules/ts-api-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", - "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, "node_modules/@typescript-eslint/types": { "version": "8.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.20.0.tgz", @@ -3421,19 +3506,6 @@ "typescript": ">=4.8.4 <5.8.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/ts-api-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", - "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, "node_modules/@typescript-eslint/utils": { "version": "8.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.20.0.tgz", @@ -3489,13 +3561,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz", - "integrity": "sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==", - "dev": true, - "license": "ISC" - }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -3669,16 +3734,6 @@ "dev": true, "license": "MIT" }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/array.prototype.findlast": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", @@ -4962,9 +5017,9 @@ "license": "MIT" }, "node_modules/deepmerge-ts": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-5.1.0.tgz", - "integrity": "sha512-eS8dRJOckyo9maw9Tu5O5RUi/4inFLrnoLkBe3cPfDMx3WZioXtmOew4TXQaxq7Rhl4xjDtR7c6x8nNTxOvbFw==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-7.1.3.tgz", + "integrity": "sha512-qCSH6I0INPxd9Y1VtAiLpnYvz5O//6rCfJXKk0z66Up9/VOSr+1yS8XSKA5IWRxjocFGlzPyaZYe+jxq7OOLtQ==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -5035,32 +5090,6 @@ "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -5346,60 +5375,63 @@ } }, "node_modules/eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", - "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.18.0.tgz", + "integrity": "sha512-+waTfRWQlSbpt3KWE+CjrPPYnbq9kfZIYUqapc0uBXyjTp8aYXZDsUH16m39Ryq3NjAVP4tjuF7KaukeqoCoaA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.10.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.18.0", + "@eslint/plugin-kit": "^0.2.5", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-import-resolver-node": { @@ -5453,92 +5485,35 @@ } }, "node_modules/eslint-plugin-functional": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-functional/-/eslint-plugin-functional-6.6.3.tgz", - "integrity": "sha512-sVbbvNvwX3HVkXAykKyoNLv57r4DPF7f1sy+/8j4YtzLYVQPGljMUWv3T6Kd4lwnnjmcKuj0EkIbS+knL6P5jw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-functional/-/eslint-plugin-functional-8.0.0.tgz", + "integrity": "sha512-3lY0A1cOMZ4PvELU9NNaL20Go5CQoFdGTvPZtrHlfv61spqa+10rI3tSF5bSBxrEqvHv0IsIWvilJ3/mYSfTdw==", "dev": true, "funding": [ { "type": "ko-fi", "url": "https://ko-fi.com/rebeccastevens" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/eslint-plugin-functional" } ], "license": "MIT", "dependencies": { - "@typescript-eslint/utils": "^7.3.1", - "deepmerge-ts": "^5.1.0", - "escape-string-regexp": "^4.0.0", - "is-immutable-type": "^4.0.0", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" + "@typescript-eslint/utils": "^8.20.0", + "deepmerge-ts": "^7.1.3", + "escape-string-regexp": "^5.0.0", + "is-immutable-type": "^5.0.1", + "ts-api-utils": "^2.0.0", + "ts-declaration-location": "^1.0.5" }, "engines": { - "node": ">=16.10.0" + "node": ">=v18.18.0" }, "peerDependencies": { - "eslint": "^8.0.0 || ^9.0.0", - "typescript": ">=4.3.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-functional/node_modules/@typescript-eslint/scope-manager": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz", - "integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/eslint-plugin-functional/node_modules/@typescript-eslint/types": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz", - "integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/eslint-plugin-functional/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz", - "integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "eslint": "^9.0.0", + "typescript": ">=4.7.4" }, "peerDependenciesMeta": { "typescript": { @@ -5546,45 +5521,17 @@ } } }, - "node_modules/eslint-plugin-functional/node_modules/@typescript-eslint/utils": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz", - "integrity": "sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/typescript-estree": "7.18.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - } - }, - "node_modules/eslint-plugin-functional/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz", - "integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==", + "node_modules/eslint-plugin-functional/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", "dev": true, "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "7.18.0", - "eslint-visitor-keys": "^3.4.3" - }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint-plugin-import": { @@ -5704,37 +5651,6 @@ "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-plugin-jsdoc/node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.14.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint-plugin-react": { "version": "7.37.4", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.4.tgz", @@ -5781,6 +5697,16 @@ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" } }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.18.tgz", + "integrity": "sha512-IRGEoFn3OKalm3hjfolEWGqoF/jPqeEYFp+C8B0WMzwGwBMvlRDQd06kghDhF0C61uJ6WfSDhEZE/sAQjduKgw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=8.40" + } + }, "node_modules/eslint-plugin-react/node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -5880,19 +5806,6 @@ "eslint": ">=8.56.0" } }, - "node_modules/eslint-plugin-unicorn/node_modules/globals": { - "version": "15.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.13.0.tgz", - "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/eslint-plugin-unused-imports": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.1.4.tgz", @@ -5910,9 +5823,9 @@ } }, "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -5920,7 +5833,7 @@ "estraverse": "^5.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -5983,32 +5896,44 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "license": "MIT", "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/eslint/node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" + "keyv": "^4.5.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16" } }, "node_modules/eslint/node_modules/minimatch": { @@ -6038,18 +5963,31 @@ } }, "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -6675,16 +6613,13 @@ } }, "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "version": "15.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", + "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", "dev": true, "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -6707,27 +6642,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -7314,151 +7228,21 @@ } }, "node_modules/is-immutable-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-immutable-type/-/is-immutable-type-4.0.0.tgz", - "integrity": "sha512-gyFBCXv+NikTs8/PGZhgjbMmFZQ5jvHGZIsVu6+/9Bk4K7imlWBIDN7hTr9fNioGzFg71I4YM3z8f0aKXarTAw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/is-immutable-type/-/is-immutable-type-5.0.1.tgz", + "integrity": "sha512-LkHEOGVZZXxGl8vDs+10k3DvP++SEoYEAJLRk6buTFi6kD7QekThV7xHS0j6gpnUCQ0zpud/gMDGiV4dQneLTg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@typescript-eslint/type-utils": "^7.2.0", - "ts-api-utils": "^1.3.0", - "ts-declaration-location": "^1.0.0" + "@typescript-eslint/type-utils": "^8.0.0", + "ts-api-utils": "^2.0.0", + "ts-declaration-location": "^1.0.4" }, "peerDependencies": { "eslint": "*", "typescript": ">=4.7.4" } }, - "node_modules/is-immutable-type/node_modules/@typescript-eslint/scope-manager": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz", - "integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/is-immutable-type/node_modules/@typescript-eslint/type-utils": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.18.0.tgz", - "integrity": "sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/typescript-estree": "7.18.0", - "@typescript-eslint/utils": "7.18.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/is-immutable-type/node_modules/@typescript-eslint/types": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz", - "integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/is-immutable-type/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz", - "integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/is-immutable-type/node_modules/@typescript-eslint/utils": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz", - "integrity": "sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/typescript-estree": "7.18.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - } - }, - "node_modules/is-immutable-type/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz", - "integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "7.18.0", - "eslint-visitor-keys": "^3.4.3" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/is-map": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", @@ -7499,16 +7283,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -9753,16 +9527,6 @@ "dev": true, "license": "MIT" }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -11514,13 +11278,6 @@ "node": "*" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT" - }, "node_modules/throat": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz", @@ -11604,16 +11361,16 @@ "license": "MIT" }, "node_modules/ts-api-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", - "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=16" + "node": ">=18.12" }, "peerDependencies": { - "typescript": ">=4.2.0" + "typescript": ">=4.8.4" } }, "node_modules/ts-declaration-location": { @@ -11711,19 +11468,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typed-array-buffer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", @@ -11816,6 +11560,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.20.0.tgz", + "integrity": "sha512-Kxz2QRFsgbWj6Xcftlw3Dd154b3cEPFqQC+qMZrMypSijPd4UanKKvoKDrJ4o8AIfZFKAF+7sMaEIR8mTElozA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.20.0", + "@typescript-eslint/parser": "8.20.0", + "@typescript-eslint/utils": "8.20.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", diff --git a/package.json b/package.json index ffd953b..1332eb1 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "react-native-image-modal", "version": "3.0.13", "description": "image full screen modal for react native", + "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { @@ -36,23 +37,27 @@ }, "homepage": "https://github.com/dev-yakuza/react-native-image-modal#readme", "devDependencies": { + "@eslint/js": "^9.18.0", "@types/react": "19.0.7", "@types/react-native": "0.72.8", "@typescript-eslint/eslint-plugin": "8.20.0", "@typescript-eslint/parser": "8.20.0", "cspell": "^8.17.2", - "eslint": "8.57.0", - "eslint-plugin-functional": "^6.6.3", + "eslint": "9.18.0", + "eslint-plugin-functional": "^8.0.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsdoc": "^50.6.2", "eslint-plugin-react": "7.37.4", "eslint-plugin-react-hooks": "5.1.0", + "eslint-plugin-react-refresh": "^0.4.18", "eslint-plugin-unicorn": "^56.0.1", "eslint-plugin-unused-imports": "^4.1.4", + "globals": "^15.14.0", "lefthook": "^1.10.8", "prettier": "3.4.2", "react": "19.0.0", "react-native": "0.76.6", - "typescript": "5.7.3" + "typescript": "5.7.3", + "typescript-eslint": "^8.20.0" } } diff --git a/src/components/ImageDetail/components/Background/index.tsx b/src/components/ImageDetail/components/Background/index.tsx index 7bb02dd..a30e854 100644 --- a/src/components/ImageDetail/components/Background/index.tsx +++ b/src/components/ImageDetail/components/Background/index.tsx @@ -1,6 +1,7 @@ -import type { ColorValue } from 'react-native' import { Animated, StyleSheet } from 'react-native' +import type { ColorValue } from 'react-native' + const styles = StyleSheet.create({ background: { position: 'absolute', @@ -25,11 +26,7 @@ const Background = ({ return ( ) } diff --git a/src/components/ImageDetail/components/DisplayImageArea/index.tsx b/src/components/ImageDetail/components/DisplayImageArea/index.tsx index f7096d7..ae48659 100644 --- a/src/components/ImageDetail/components/DisplayImageArea/index.tsx +++ b/src/components/ImageDetail/components/DisplayImageArea/index.tsx @@ -1,4 +1,5 @@ import type { ReactNode } from 'react' + import { Animated, Dimensions, Platform, StatusBar, StyleSheet } from 'react-native' const styles = StyleSheet.create({ diff --git a/src/components/ImageDetail/components/Footer/index.tsx b/src/components/ImageDetail/components/Footer/index.tsx index 86286ba..253b553 100644 --- a/src/components/ImageDetail/components/Footer/index.tsx +++ b/src/components/ImageDetail/components/Footer/index.tsx @@ -1,4 +1,5 @@ import type { ReactNode } from 'react' + import { Animated, StyleSheet } from 'react-native' const styles = StyleSheet.create({ diff --git a/src/components/ImageDetail/components/Header/index.tsx b/src/components/ImageDetail/components/Header/index.tsx index d58ca88..8ab0951 100644 --- a/src/components/ImageDetail/components/Header/index.tsx +++ b/src/components/ImageDetail/components/Header/index.tsx @@ -1,4 +1,5 @@ import type { ReactNode } from 'react' + import { Animated, SafeAreaView, StatusBar, StyleSheet, Text, TouchableOpacity } from 'react-native' const styles = StyleSheet.create({ diff --git a/src/components/ImageDetail/components/ImageArea/index.tsx b/src/components/ImageDetail/components/ImageArea/index.tsx index ef59a8d..8d484e6 100644 --- a/src/components/ImageDetail/components/ImageArea/index.tsx +++ b/src/components/ImageDetail/components/ImageArea/index.tsx @@ -1,29 +1,31 @@ -import type { MutableRefObject } from 'react' -import { useRef, type ReactNode } from 'react' -import type { - GestureResponderEvent, - ImageResizeMode, - ImageSourcePropType, - ImageStyle, - PanResponderGestureState, - StyleProp, -} from 'react-native' -import { StyleSheet, Image, PanResponder, View } from 'react-native' -import { Animated } from 'react-native' -import type { OnMove, OnTap, RenderImageComponentParams } from '../../../../types' +import { useRef } from 'react' +import type { ReactNode, RefObject } from 'react' + +import { Animated, Image, PanResponder, StyleSheet, View } from 'react-native' + import { - VISIBLE_OPACITY, getCenterPositionBetweenTouches, getDistanceBetweenTouches, getDistanceFromLastPosition, + getImagePositionFromDistanceInScale, getMaxPosition, getOpacityFromSwipe, - getImagePositionFromDistanceInScale, getPositionFromDistanceInScale, getZoomAndPositionFromDoubleTap, getZoomFromDistance, + VISIBLE_OPACITY, } from './utils' +import type { OnMove, OnTap, RenderImageComponentParams } from '../../../../types' +import type { + GestureResponderEvent, + ImageResizeMode, + ImageSourcePropType, + ImageStyle, + PanResponderGestureState, + StyleProp, +} from 'react-native' + const INITIAL_SCALE = 1 const LONG_PRESS_TIME = 800 const DOUBLE_CLICK_INTERVAL = 250 @@ -46,7 +48,7 @@ interface Props { readonly resizeMode?: ImageResizeMode readonly imageStyle?: StyleProp readonly swipeToDismiss: boolean - readonly isAnimated: MutableRefObject + readonly isAnimated: RefObject readonly animationDuration: number readonly animatedOpacity: Animated.Value readonly animatedScale: Animated.Value @@ -343,7 +345,7 @@ const ImageArea = ({ overflow: 'hidden', flex: 1, }} - {..._imagePanResponder?.panHandlers} + {..._imagePanResponder.panHandlers} > ( - ( - { - renderToHardwareTextureAndroid, - isTranslucent = false, - isOpen, - origin, - source, - resizeMode = 'contain', - backgroundColor = '#000000', - swipeToDismiss, - hideCloseButton = false, - imageStyle, - parentLayout, - animationDuration, - renderHeader, - renderFooter, - renderImageComponent, - onTap, - onDoubleTap, - onLongPress, - didOpen, - onMove, - responderRelease, - willClose, - onClose, - }: Props, - ref, - ) => { - const { width: windowWidth, height: windowHeight } = Dimensions.get('window') - const originImagePosition = { - x: origin.x - (parentLayout?.x ?? 0) / 2, - y: origin.y - (parentLayout?.y ?? 0), - } - const { width: originImageWidth, height: originImageHeight } = origin +const ImageDetailComponent = forwardRef(function ImageDetailComponent( + { + renderToHardwareTextureAndroid, + isTranslucent = false, + isOpen, + origin, + source, + resizeMode = 'contain', + backgroundColor = '#000000', + swipeToDismiss, + hideCloseButton = false, + imageStyle, + parentLayout, + animationDuration, + renderHeader, + renderFooter, + renderImageComponent, + onTap, + onDoubleTap, + onLongPress, + didOpen, + onMove, + responderRelease, + willClose, + onClose, + }: Props, + ref, +) { + const { width: windowWidth, height: windowHeight } = Dimensions.get('window') + const originImagePosition = { + x: origin.x - (parentLayout?.x ?? 0) / 2, + y: origin.y - (parentLayout?.y ?? 0), + } + const { width: originImageWidth, height: originImageHeight } = origin - const animatedScale = new Animated.Value(INITIAL_SCALE) - const animatedPosition = new Animated.ValueXY({ x: 0, y: 0 }) - const animatedFrame = new Animated.Value(0) - const animatedOpacity = new Animated.Value(0) - const animatedImagePosition = new Animated.ValueXY(originImagePosition) - const animatedImageWidth = new Animated.Value(originImageWidth) - const animatedImageHeight = new Animated.Value(originImageHeight) + const animatedScale = new Animated.Value(INITIAL_SCALE) + const animatedPosition = new Animated.ValueXY({ x: 0, y: 0 }) + const animatedFrame = new Animated.Value(0) + const animatedOpacity = new Animated.Value(0) + const animatedImagePosition = new Animated.ValueXY(originImagePosition) + const animatedImageWidth = new Animated.Value(originImageWidth) + const animatedImageHeight = new Animated.Value(originImageHeight) - const isAnimated = useRef(true) + const isAnimated = useRef(true) - const handleClose = (): void => { - isAnimated.current = true - willClose?.() + const handleClose = (): void => { + isAnimated.current = true + willClose?.() - setTimeout(() => { - Animated.parallel([ - Animated.timing(animatedFrame, { - toValue: 0, - useNativeDriver: false, - duration: animationDuration, - }), - Animated.timing(animatedScale, { - toValue: INITIAL_SCALE, - useNativeDriver: false, - duration: animationDuration, - }), - Animated.timing(animatedPosition, { - toValue: 0, - useNativeDriver: false, - duration: animationDuration, - }), - Animated.timing(animatedOpacity, { - toValue: 0, - useNativeDriver: false, - duration: animationDuration, - }), - Animated.timing(animatedImagePosition, { - toValue: originImagePosition, - useNativeDriver: false, - duration: animationDuration * 2, - }), - Animated.timing(animatedImageWidth, { - toValue: originImageWidth, - useNativeDriver: false, - duration: animationDuration * 2, - }), - Animated.timing(animatedImageHeight, { - toValue: originImageHeight, - useNativeDriver: false, - duration: animationDuration * 2, - }), - ]).start(() => { - onClose() - isAnimated.current = false - }) + setTimeout(() => { + Animated.parallel([ + Animated.timing(animatedFrame, { + toValue: 0, + useNativeDriver: false, + duration: animationDuration, + }), + Animated.timing(animatedScale, { + toValue: INITIAL_SCALE, + useNativeDriver: false, + duration: animationDuration, + }), + Animated.timing(animatedPosition, { + toValue: 0, + useNativeDriver: false, + duration: animationDuration, + }), + Animated.timing(animatedOpacity, { + toValue: 0, + useNativeDriver: false, + duration: animationDuration, + }), + Animated.timing(animatedImagePosition, { + toValue: originImagePosition, + useNativeDriver: false, + duration: animationDuration * 2, + }), + Animated.timing(animatedImageWidth, { + toValue: originImageWidth, + useNativeDriver: false, + duration: animationDuration * 2, + }), + Animated.timing(animatedImageHeight, { + toValue: originImageHeight, + useNativeDriver: false, + duration: animationDuration * 2, + }), + ]).start(() => { + onClose() + isAnimated.current = false }) - } + }) + } - const handleOpen = () => { - isAnimated.current = true + const handleOpen = () => { + isAnimated.current = true - setTimeout(() => { - Animated.parallel([ - Animated.timing(animatedFrame, { - toValue: 1, - useNativeDriver: false, - duration: animationDuration, - }), - Animated.timing(animatedOpacity, { - toValue: 1, - useNativeDriver: false, - duration: animationDuration, - }), - Animated.timing(animatedImagePosition, { - toValue: { - x: 0, - y: 0, - }, - useNativeDriver: false, - duration: animationDuration * 2, - }), - Animated.timing(animatedImageWidth, { - toValue: windowWidth, - useNativeDriver: false, - duration: animationDuration * 2, - }), - Animated.timing(animatedImageHeight, { - toValue: windowHeight, - useNativeDriver: false, - duration: animationDuration * 2, - }), - ]).start(() => { - isAnimated.current = false - if (isOpen) { - didOpen?.() - } - }) + setTimeout(() => { + Animated.parallel([ + Animated.timing(animatedFrame, { + toValue: 1, + useNativeDriver: false, + duration: animationDuration, + }), + Animated.timing(animatedOpacity, { + toValue: 1, + useNativeDriver: false, + duration: animationDuration, + }), + Animated.timing(animatedImagePosition, { + toValue: { + x: 0, + y: 0, + }, + useNativeDriver: false, + duration: animationDuration * 2, + }), + Animated.timing(animatedImageWidth, { + toValue: windowWidth, + useNativeDriver: false, + duration: animationDuration * 2, + }), + Animated.timing(animatedImageHeight, { + toValue: windowHeight, + useNativeDriver: false, + duration: animationDuration * 2, + }), + ]).start(() => { + isAnimated.current = false + if (isOpen) { + didOpen?.() + } }) - } + }) + } - useEffect(() => { - handleOpen() - }, [ - animatedOpacity, - animatedImagePosition, - animatedImageWidth, - animatedImageHeight, - animatedFrame, - ]) + useEffect(() => { + handleOpen() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ + animatedOpacity, + animatedImagePosition, + animatedImageWidth, + animatedImageHeight, + animatedFrame, + ]) - useImperativeHandle(ref, () => ({ - close: handleClose, - })) + useImperativeHandle(ref, () => ({ + close: handleClose, + })) - return ( - + + - - - - -
-