Skip to content

Commit 71fa6a9

Browse files
authored
do not run nextjs check on import (#5352)
* do not run nextjs check on import * dang it darglint
1 parent c849cd8 commit 71fa6a9

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

reflex/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,11 +1019,13 @@ def _get_frontend_packages(self, imports: dict[str, set[ImportVar]]):
10191019
Example:
10201020
>>> _get_frontend_packages({"react": "16.14.0", "react-dom": "16.14.0"})
10211021
"""
1022+
dependencies = constants.PackageJson.DEPENDENCIES
1023+
dev_dependencies = constants.PackageJson.DEV_DEPENDENCIES
10221024
page_imports = {
10231025
i
10241026
for i, tags in imports.items()
1025-
if i not in constants.PackageJson.DEPENDENCIES
1026-
and i not in constants.PackageJson.DEV_DEPENDENCIES
1027+
if i not in dependencies
1028+
and i not in dev_dependencies
10271029
and not any(i.startswith(prefix) for prefix in ["/", "$/", ".", "next/"])
10281030
and i != ""
10291031
and any(tag.install for tag in tags)

reflex/constants/installer.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,28 @@ class Commands(SimpleNamespace):
113113

114114
_react_version = _determine_react_version()
115115

116-
DEPENDENCIES = {
117-
"@emotion/react": "11.14.0",
118-
"axios": "1.9.0",
119-
"json5": "2.2.3",
120-
"next": _determine_nextjs_version(),
121-
"next-sitemap": "4.2.3",
122-
"next-themes": "0.4.6",
123-
"react": _react_version,
124-
"react-dom": _react_version,
125-
"react-focus-lock": "2.13.6",
126-
"socket.io-client": "4.8.1",
127-
"universal-cookie": "7.2.2",
128-
}
116+
@classproperty
117+
@classmethod
118+
def DEPENDENCIES(cls) -> dict[str, str]:
119+
"""The dependencies to include in package.json.
120+
121+
Returns:
122+
A dictionary of dependencies with their versions.
123+
"""
124+
return {
125+
"@emotion/react": "11.14.0",
126+
"axios": "1.9.0",
127+
"json5": "2.2.3",
128+
"next": _determine_nextjs_version(),
129+
"next-sitemap": "4.2.3",
130+
"next-themes": "0.4.6",
131+
"react": cls._react_version,
132+
"react-dom": cls._react_version,
133+
"react-focus-lock": "2.13.6",
134+
"socket.io-client": "4.8.1",
135+
"universal-cookie": "7.2.2",
136+
}
137+
129138
DEV_DEPENDENCIES = {
130139
"autoprefixer": "10.4.21",
131140
"postcss": "8.5.3",

0 commit comments

Comments
 (0)