From 0099cf27e2117fe4bc9bfb26fc40a8d35b31080f Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Wed, 14 Aug 2024 17:15:02 +0200 Subject: [PATCH] Enable noUnusedImports and noUnusedVariables in Biome --- __mocks__/_failing_page.ts | 10 +++++----- __mocks__/_failing_pdf.ts | 6 +++--- __mocks__/_silently_failing_pdf.ts | 6 +++--- biome.json | 4 ++++ packages/react-pdf/src/LinkService.ts | 2 +- packages/react-pdf/src/StructTreeItem.tsx | 1 - sample/create-react-app-5/src/Sample.tsx | 2 +- sample/next-app/app/Sample.tsx | 2 +- sample/next-pages/pages/Sample.tsx | 2 +- sample/parcel2/Sample.tsx | 2 +- sample/vite/Sample.tsx | 2 +- sample/webpack5/Sample.tsx | 2 +- test/Test.tsx | 4 ++-- 13 files changed, 24 insertions(+), 21 deletions(-) diff --git a/__mocks__/_failing_page.ts b/__mocks__/_failing_page.ts index c1fb78e8b..fb1f1ec8b 100644 --- a/__mocks__/_failing_page.ts +++ b/__mocks__/_failing_page.ts @@ -9,17 +9,17 @@ export default { // Intentionally empty }, }, - getAnnotations: () => new Promise((resolve, reject) => reject(new Error())), - getOperatorList: () => new Promise((resolve, reject) => reject(new Error())), - getStructTree: () => new Promise((resolve, reject) => reject(new Error())), - getTextContent: () => new Promise((resolve, reject) => reject(new Error())), + getAnnotations: () => new Promise((_resolve, reject) => reject(new Error())), + getOperatorList: () => new Promise((_resolve, reject) => reject(new Error())), + getStructTree: () => new Promise((_resolve, reject) => reject(new Error())), + getTextContent: () => new Promise((_resolve, reject) => reject(new Error())), getViewport: () => ({ width: 600, height: 800, rotation: 0, }), render: () => ({ - promise: new Promise((resolve, reject) => reject(new Error())), + promise: new Promise((_resolve, reject) => reject(new Error())), cancel: () => { // Intentionally empty }, diff --git a/__mocks__/_failing_pdf.ts b/__mocks__/_failing_pdf.ts index a78226e7e..146070152 100644 --- a/__mocks__/_failing_pdf.ts +++ b/__mocks__/_failing_pdf.ts @@ -5,8 +5,8 @@ export default { fingerprint: 'a62067476e69734bb8eb60122615dfbf', numPages: 4, }, - getDestination: () => new Promise((resolve, reject) => reject(new Error())), - getOutline: () => new Promise((resolve, reject) => reject(new Error())), - getPage: () => new Promise((resolve, reject) => reject(new Error())), + getDestination: () => new Promise((_resolve, reject) => reject(new Error())), + getOutline: () => new Promise((_resolve, reject) => reject(new Error())), + getPage: () => new Promise((_resolve, reject) => reject(new Error())), numPages: 4, } as unknown as PDFDocumentProxy; diff --git a/__mocks__/_silently_failing_pdf.ts b/__mocks__/_silently_failing_pdf.ts index c4fdffb0d..e4297197b 100644 --- a/__mocks__/_silently_failing_pdf.ts +++ b/__mocks__/_silently_failing_pdf.ts @@ -8,10 +8,10 @@ export default { numPages: 4, }, getDestination: () => - new Promise((resolve, reject) => reject(new RenderingCancelledException('Cancelled'))), + new Promise((_resolve, reject) => reject(new RenderingCancelledException('Cancelled'))), getOutline: () => - new Promise((resolve, reject) => reject(new RenderingCancelledException('Cancelled'))), + new Promise((_resolve, reject) => reject(new RenderingCancelledException('Cancelled'))), getPage: () => - new Promise((resolve, reject) => reject(new RenderingCancelledException('Cancelled'))), + new Promise((_resolve, reject) => reject(new RenderingCancelledException('Cancelled'))), numPages: 4, } as unknown as PDFDocumentProxy; diff --git a/biome.json b/biome.json index 02caffa10..c8ebc01be 100644 --- a/biome.json +++ b/biome.json @@ -12,6 +12,10 @@ "complexity": { "noUselessSwitchCase": "off" }, + "correctness": { + "noUnusedImports": "warn", + "noUnusedVariables": "warn" + }, "suspicious": { "noConsoleLog": "warn" } diff --git a/packages/react-pdf/src/LinkService.ts b/packages/react-pdf/src/LinkService.ts index edf7ea316..1770c7ff8 100644 --- a/packages/react-pdf/src/LinkService.ts +++ b/packages/react-pdf/src/LinkService.ts @@ -89,7 +89,7 @@ export default class LinkService implements IPDFLinkService { return 0; } - set rotation(value) { + set rotation(_value) { // Intentionally empty } diff --git a/packages/react-pdf/src/StructTreeItem.tsx b/packages/react-pdf/src/StructTreeItem.tsx index 361d83566..743e27041 100644 --- a/packages/react-pdf/src/StructTreeItem.tsx +++ b/packages/react-pdf/src/StructTreeItem.tsx @@ -20,7 +20,6 @@ export default function StructTreeItem({ }: StructTreeItemProps): React.ReactElement { const attributes = useMemo(() => getAttributes(node), [node]); - // biome-ignore lint/correctness/useExhaustiveDependencies: Looks like a Biome error const children = useMemo(() => { if (!isStructTreeNode(node)) { return null; diff --git a/sample/create-react-app-5/src/Sample.tsx b/sample/create-react-app-5/src/Sample.tsx index a75b76bb6..b80d46c5e 100644 --- a/sample/create-react-app-5/src/Sample.tsx +++ b/sample/create-react-app-5/src/Sample.tsx @@ -66,7 +66,7 @@ export default function Sample() {
- {Array.from(new Array(numPages), (el, index) => ( + {Array.from(new Array(numPages), (_el, index) => (
- {Array.from(new Array(numPages), (el, index) => ( + {Array.from(new Array(numPages), (_el, index) => (
- {Array.from(new Array(numPages), (el, index) => ( + {Array.from(new Array(numPages), (_el, index) => (
- {Array.from(new Array(numPages), (el, index) => ( + {Array.from(new Array(numPages), (_el, index) => (
- {Array.from(new Array(numPages), (el, index) => ( + {Array.from(new Array(numPages), (_el, index) => (
- {Array.from(new Array(numPages), (el, index) => ( + {Array.from(new Array(numPages), (_el, index) => ( {render ? ( displayAll ? ( - Array.from(new Array(numPages), (el, index) => ( + Array.from(new Array(numPages), (_el, index) => ( )}
- {Array.from(new Array(numPages), (el, index) => ( + {Array.from(new Array(numPages), (_el, index) => (