Skip to content

feat: add multiple-share-scope example#4419

Merged
ScriptedAlchemy merged 2 commits intomasterfrom
feat/multiple-share-scope
Mar 6, 2026
Merged

feat: add multiple-share-scope example#4419
ScriptedAlchemy merged 2 commits intomasterfrom
feat/multiple-share-scope

Conversation

@2heal1
Copy link
Member

@2heal1 2heal1 commented Mar 5, 2026

No description provided.

@@ -0,0 +1,14 @@
import { Helmet } from '@modern-js/runtime/head';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import Helmet.

Copilot Autofix

AI 13 days ago

In general, unused imports should be removed to keep the code clean and avoid confusion. Since Helmet is not used anywhere in page.tsx, the best fix that does not alter existing runtime behavior is simply to delete the unused import line.

Specifically, in multiple-share-scope/provider-react-17/src/routes/page.tsx, remove line 1 (import { Helmet } from '@modern-js/runtime/head';). No additional methods, imports, or definitions are needed, and no other lines require adjustment.

Suggested changeset 1
multiple-share-scope/provider-react-17/src/routes/page.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/multiple-share-scope/provider-react-17/src/routes/page.tsx b/multiple-share-scope/provider-react-17/src/routes/page.tsx
--- a/multiple-share-scope/provider-react-17/src/routes/page.tsx
+++ b/multiple-share-scope/provider-react-17/src/routes/page.tsx
@@ -1,4 +1,3 @@
-import { Helmet } from '@modern-js/runtime/head';
 import './index.css';
 // import Provider from 'provider';
 
EOF
@@ -1,4 +1,3 @@
import { Helmet } from '@modern-js/runtime/head';
import './index.css';
// import Provider from 'provider';

Copilot is powered by AI and may make mistakes. Always verify output.
import React, { useState } from 'react';

const LandingPage = (props: any): JSX.Element => {
const [count, setCount] = useState(0);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable setCount.

Copilot Autofix

AI 13 days ago

In general, to fix an unused variable from a React useState call, either remove the unused binding or replace it with a placeholder (like _) so only the actually used parts are declared. This preserves functionality while eliminating the unused variable.

Here, the component only reads count and never calls setCount. The best fix is to destructure only the first element of the state tuple and ignore the setter. In TypeScript/React, we can do this by omitting the second element in the array destructuring. Concretely, in multiple-share-scope/provider-react-18/src/components/LandingPage.tsx, line 5 should be changed from const [count, setCount] = useState(0); to const [count] = useState(0);. No other lines or imports need to change, and no new methods or definitions are required.

Suggested changeset 1
multiple-share-scope/provider-react-18/src/components/LandingPage.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/multiple-share-scope/provider-react-18/src/components/LandingPage.tsx b/multiple-share-scope/provider-react-18/src/components/LandingPage.tsx
--- a/multiple-share-scope/provider-react-18/src/components/LandingPage.tsx
+++ b/multiple-share-scope/provider-react-18/src/components/LandingPage.tsx
@@ -2,7 +2,7 @@
 import React, { useState } from 'react';
 
 const LandingPage = (props: any): JSX.Element => {
-  const [count, setCount] = useState(0);
+  const [count] = useState(0);
   console.log(props);
   return <div className={styles.libRow}>landing-page react 18 {count} </div>;
 };
EOF
@@ -2,7 +2,7 @@
import React, { useState } from 'react';

const LandingPage = (props: any): JSX.Element => {
const [count, setCount] = useState(0);
const [count] = useState(0);
console.log(props);
return <div className={styles.libRow}>landing-page react 18 {count} </div>;
};
Copilot is powered by AI and may make mistakes. Always verify output.
@ScriptedAlchemy ScriptedAlchemy merged commit 5a6a91e into master Mar 6, 2026
9 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the feat/multiple-share-scope branch March 6, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants