Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Lint React imports

Manav Rathi8dac7e494031
diff --git a/packages/build-config/eslintrc-typescript.js b/packages/build-config/eslintrc-typescript.js
index 783330cad8..faaa0bfa8a 100644
--- a/packages/build-config/eslintrc-typescript.js
+++ b/packages/build-config/eslintrc-typescript.js
@@ -5,11 +5,19 @@ module.exports = {
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
- plugins: ["@typescript-eslint"],
+ plugins: ["@typescript-eslint", "react-namespace-import"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
- ignorePatterns: [".eslintrc.js"],
root: true,
+ ignorePatterns: [".eslintrc.js"],
+ rules: {
+ // The recommended way to import React is:
+ //
+ // import * as React from "react";
+ //
+ // This rule enforces that.
+ "react-namespace-import/no-namespace-import": "error",
+ },
};
diff --git a/packages/build-config/package.json b/packages/build-config/package.json
index 4bacb61f38..d3278c3f58 100644
--- a/packages/build-config/package.json
+++ b/packages/build-config/package.json
@@ -5,6 +5,7 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7",
"@typescript-eslint/parser": "^7",
+ "eslint-plugin-react-namespace-import": "^1.0.5",
"prettier-plugin-organize-imports": "^3.2.4"
}
}
diff --git a/packages/ui/components/Card.tsx b/packages/ui/components/Card.tsx
index 6853d236be..ee19e9f52f 100644
--- a/packages/ui/components/Card.tsx
+++ b/packages/ui/components/Card.tsx
@@ -1,3 +1,5 @@
+import * as React from "react";
+
export const Card: React.FC = () => {
return <div>Hello</div>;
};
diff --git a/yarn.lock b/yarn.lock
index e82a02da75..3dda3d3b94 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -579,7 +579,7 @@
"@sentry/types" "7.77.0"
"@sentry/utils" "7.77.0"
-"@sentry/[email protected]", "@sentry/cli@^1.74.6":
+"@sentry/cli@^1.74.6":
version "1.75.0"
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.75.0.tgz#4a5e71b5619cd4e9e6238cc77857c66f6b38d86a"
integrity sha512-vT8NurHy00GcN8dNqur4CMIYvFH3PaKdkX3qllVvi4syybKqjwoz+aWRCvprbYv0knweneFkLt1SmBWqazUMfA==
@@ -1978,6 +1978,11 @@ eslint-plugin-jsx-a11y@^6.7.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"
integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==
+eslint-plugin-react-namespace-import@^1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-react-namespace-import/-/eslint-plugin-react-namespace-import-1.0.5.tgz#9da74bb169d13336a187abd3c42e22d2fe10f91d"
+ integrity sha512-0gUj6hSRL8cTxyLtVvbu/Rzr3aEmO4fUyJIc3qkGum2Lth+atx3z/JJgBd+PUpaksdv0D6gmBBHwjmn/nPAobQ==
+
eslint-plugin-react@^7.33.2, eslint-plugin-react@latest:
version "7.33.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz#69ee09443ffc583927eafe86ffebb470ee737608"
@@ -2976,7 +2981,7 @@ [email protected]:
dependencies:
libsodium "^0.7.0"
[email protected], libsodium@^0.7.0:
+libsodium@^0.7.0:
version "0.7.9"
resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.9.tgz#4bb7bcbf662ddd920d8795c227ae25bbbfa3821b"
integrity sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A==