From 313107be44481605dcb1edc48bb628961a65534d Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Fri, 19 Jul 2024 17:51:34 -0700 Subject: [PATCH] Attempt to use Flow's new StringPrefix feature --- .flowconfig | 2 +- package-lock.json | 74 +++++++++---------- package.json | 4 +- .../src/types/StrictReactDOMProps.js | 3 +- tools/flow-typed/react-strict-dom.js | 5 -- 5 files changed, 41 insertions(+), 47 deletions(-) diff --git a/.flowconfig b/.flowconfig index f21da35..5a1b32b 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,5 +1,5 @@ [version] -0.240.0 +0.241.0 [ignore] .*/malformed_package_json/.* diff --git a/package-lock.json b/package-lock.json index 8d0709f..67d8c19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,8 +34,8 @@ "eslint-plugin-promise": "^6.0.0", "eslint-plugin-react": "^7.33.1", "eslint-plugin-react-hooks": "^4.5.0", - "flow-api-translator": "^0.22.0", - "flow-bin": "^0.240.0", + "flow-api-translator": "^0.23.0", + "flow-bin": "^0.241.0", "husky": "^8.0.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", @@ -11407,19 +11407,19 @@ "license": "ISC" }, "node_modules/flow-api-translator": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/flow-api-translator/-/flow-api-translator-0.22.0.tgz", - "integrity": "sha512-xeqGds/uMwyBNcg3XERVvjJx8cJda4eO/XzfNsq3cc64nkVog5xNrKikMrgfp18Djx+vpV/EdgSpNfFwYOa6Dg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/flow-api-translator/-/flow-api-translator-0.23.0.tgz", + "integrity": "sha512-mc5lkw5qv8zDLbmu89aEMg1VmlhY+MF+aQey9zNaoZQ/U4Mce8q6SkEpvL5wLNRY42EGYtRdtWpvTqHf8w5tEA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.16.0", "@typescript-eslint/parser": "7.2.0", "@typescript-eslint/visitor-keys": "7.2.0", "flow-enums-runtime": "^0.0.6", - "hermes-eslint": "0.22.0", - "hermes-estree": "0.22.0", - "hermes-parser": "0.22.0", - "hermes-transform": "0.22.0", + "hermes-eslint": "0.23.0", + "hermes-estree": "0.23.0", + "hermes-parser": "0.23.0", + "hermes-transform": "0.23.0", "typescript": "5.3.2" }, "peerDependencies": { @@ -11427,69 +11427,69 @@ } }, "node_modules/flow-api-translator/node_modules/hermes-eslint": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/hermes-eslint/-/hermes-eslint-0.22.0.tgz", - "integrity": "sha512-WnD0xPY1Clvd4F68g2esS89C0NGeu/pn3sdqGXXdnlgr3jZtG5lugscRATS+0+mXOtZ6PTxSClVr2JL4BNor2Q==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/hermes-eslint/-/hermes-eslint-0.23.0.tgz", + "integrity": "sha512-fbeKXUxdSo15g4dwnUIDh97Z9O6xdfax3rUfslH0rgZKivJ3pByvSYbPclkh6BZERlBfhIDYHMoiWexGla8lxw==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", - "hermes-estree": "0.22.0", - "hermes-parser": "0.22.0" + "hermes-estree": "0.23.0", + "hermes-parser": "0.23.0" } }, "node_modules/flow-api-translator/node_modules/hermes-estree": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.22.0.tgz", - "integrity": "sha512-FLBt5X9OfA8BERUdc6aZS36Xz3rRuB0Y/mfocSADWEJfomc1xfene33GdyAmtTkKTBXTN/EgAy+rjTKkkZJHlw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.23.0.tgz", + "integrity": "sha512-Rkp0PNLGpORw4ktsttkVbpYJbrYKS3hAnkxu8D9nvQi6LvSbuPa+tYw/t2u3Gjc35lYd/k95YkjqyTcN4zspag==", "dev": true }, "node_modules/flow-api-translator/node_modules/hermes-parser": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.22.0.tgz", - "integrity": "sha512-gn5RfZiEXCsIWsFGsKiykekktUoh0PdFWYocXsUdZIyWSckT6UIyPcyyUIPSR3kpnELWeK3n3ztAse7Mat6PSA==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.23.0.tgz", + "integrity": "sha512-xLwM4ylfHGwrm+2qXfO1JT/fnqEDGSnpS/9hQ4VLtqTexSviu2ZpBgz07U8jVtndq67qdb/ps0qvaWDZ3fkTyg==", "dev": true, "dependencies": { - "hermes-estree": "0.22.0" + "hermes-estree": "0.23.0" } }, "node_modules/flow-api-translator/node_modules/hermes-transform": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/hermes-transform/-/hermes-transform-0.22.0.tgz", - "integrity": "sha512-+PxlBaDQgRgs5JJgbT+lZT+1bJdn5gzlRB9+/BZVTlW3hUlyvrQ0lI4qKZuv+R8DWUSd8+omMDQKZG83WOgaIw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/hermes-transform/-/hermes-transform-0.23.0.tgz", + "integrity": "sha512-hDoqAcwTqWKOTjXbrwMsiSnBd1+cIGSN11TGL+EdCQLkOhzqXir6O59INKocex3VgfsZi3KACM2AMzKNybKLYQ==", "dev": true, "dependencies": { "@babel/code-frame": "^7.16.0", "esquery": "^1.4.0", "flow-enums-runtime": "^0.0.6", - "hermes-eslint": "0.22.0", - "hermes-estree": "0.22.0", - "hermes-parser": "0.22.0", + "hermes-eslint": "0.23.0", + "hermes-estree": "0.23.0", + "hermes-parser": "0.23.0", "string-width": "4.2.3" }, "peerDependencies": { "prettier": "^3.0.0 || ^2.7.1", - "prettier-plugin-hermes-parser": "0.22.0" + "prettier-plugin-hermes-parser": "0.23.0" } }, "node_modules/flow-api-translator/node_modules/prettier-plugin-hermes-parser": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/prettier-plugin-hermes-parser/-/prettier-plugin-hermes-parser-0.22.0.tgz", - "integrity": "sha512-NhyUjM6uYW87vbPe1RZnWTbGtbzvwNNaIy4RnKJOa1KKOBryq9Gc8xXBwJF65fLIMRitnGkERhwXwTBEfcM1IQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-hermes-parser/-/prettier-plugin-hermes-parser-0.23.0.tgz", + "integrity": "sha512-EMwgZFcKDyVfUCvIy/kxVc4siYEOYPt7lLqtaELVadKYNbOLUFjYW3QKGZ8jzidUy4DonfFbi/hJOXJ5vfRzxA==", "dev": true, "peer": true, "dependencies": { - "hermes-estree": "0.22.0", - "hermes-parser": "0.22.0", - "prettier-plugin-hermes-parser": "0.22.0" + "hermes-estree": "0.23.0", + "hermes-parser": "0.23.0", + "prettier-plugin-hermes-parser": "0.23.0" }, "peerDependencies": { "prettier": "^3.0.0 || ^2.7.1" } }, "node_modules/flow-bin": { - "version": "0.240.0", - "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.240.0.tgz", - "integrity": "sha512-6FUQrQLxHZ6mj1qSZvRJt8Qr1ngBDiDSDBlDMrLM3NFf5/wyHmO/iF43FpyzMIagjLpxHWdsZwKxHVREZBNOwA==", + "version": "0.241.0", + "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.241.0.tgz", + "integrity": "sha512-R1WROxAuWCOF5gMVqVYbb3iUvqP2OQyaYLSrkUxZrLonvjUJeedGx7nv79tdkoB7eRja3kY+/lQ/nbPtkFsqOA==", "dev": true, "bin": { "flow": "cli.js" diff --git a/package.json b/package.json index 4666f85..5828f6d 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "eslint-plugin-promise": "^6.0.0", "eslint-plugin-react": "^7.33.1", "eslint-plugin-react-hooks": "^4.5.0", - "flow-api-translator": "^0.22.0", - "flow-bin": "^0.240.0", + "flow-api-translator": "^0.23.0", + "flow-bin": "^0.241.0", "husky": "^8.0.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", diff --git a/packages/react-strict-dom/src/types/StrictReactDOMProps.js b/packages/react-strict-dom/src/types/StrictReactDOMProps.js index e815083..ae4a2de 100644 --- a/packages/react-strict-dom/src/types/StrictReactDOMProps.js +++ b/packages/react-strict-dom/src/types/StrictReactDOMProps.js @@ -280,9 +280,9 @@ type EventProps = $ReadOnly<{ }>; export type StrictReactDOMProps = $ReadOnly<{ + [StringPrefix<'data-'>]: ?string, ...AriaProps, ...EventProps, - ...ReactStrictDOMDataProps, autoCapitalize?: ?( | 'off' | 'none' @@ -293,7 +293,6 @@ export type StrictReactDOMProps = $ReadOnly<{ ), autoFocus?: ?boolean, children?: React$Node, - 'data-testid'?: ?string, dir?: ?('auto' | 'ltr' | 'rtl'), elementTiming?: ?string, enterKeyHint?: ?( diff --git a/tools/flow-typed/react-strict-dom.js b/tools/flow-typed/react-strict-dom.js index 053f4c8..2af74e8 100644 --- a/tools/flow-typed/react-strict-dom.js +++ b/tools/flow-typed/react-strict-dom.js @@ -7,11 +7,6 @@ * @flow strict */ -// This type allows Meta (and other users) to define data-* -// props used by their components to work around Flow's current -// lack of support for typing arbitrary data-* props. -declare type ReactStrictDOMDataProps = {}; - // This type allows Meta to internally override it with an // internationalization type which is a string at runtimeā€¦ // but Flow doesn't know that.