Skip to content

Commit

Permalink
Enable noUnusedImports and noUnusedVariables in Biome
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Aug 14, 2024
1 parent 736f3f3 commit 0099cf2
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 21 deletions.
10 changes: 5 additions & 5 deletions __mocks__/_failing_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((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<void>((_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
},
Expand Down
6 changes: 3 additions & 3 deletions __mocks__/_failing_pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 3 additions & 3 deletions __mocks__/_silently_failing_pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 4 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"complexity": {
"noUselessSwitchCase": "off"
},
"correctness": {
"noUnusedImports": "warn",
"noUnusedVariables": "warn"
},
"suspicious": {
"noConsoleLog": "warn"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-pdf/src/LinkService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class LinkService implements IPDFLinkService {
return 0;
}

set rotation(value) {
set rotation(_value) {
// Intentionally empty
}

Expand Down
1 change: 0 additions & 1 deletion packages/react-pdf/src/StructTreeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sample/create-react-app-5/src/Sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function Sample() {
</div>
<div className="Example__container__document" ref={setContainerRef}>
<Document file={file} onLoadSuccess={onDocumentLoadSuccess} options={options}>
{Array.from(new Array(numPages), (el, index) => (
{Array.from(new Array(numPages), (_el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
Expand Down
2 changes: 1 addition & 1 deletion sample/next-app/app/Sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function Sample() {
</div>
<div className="Example__container__document" ref={setContainerRef}>
<Document file={file} onLoadSuccess={onDocumentLoadSuccess} options={options}>
{Array.from(new Array(numPages), (el, index) => (
{Array.from(new Array(numPages), (_el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
Expand Down
2 changes: 1 addition & 1 deletion sample/next-pages/pages/Sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Sample() {
</div>
<div className="Example__container__document" ref={setContainerRef}>
<Document file={file} onLoadSuccess={onDocumentLoadSuccess} options={options}>
{Array.from(new Array(numPages), (el, index) => (
{Array.from(new Array(numPages), (_el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
Expand Down
2 changes: 1 addition & 1 deletion sample/parcel2/Sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function Sample() {
</div>
<div className="Example__container__document" ref={setContainerRef}>
<Document file={file} onLoadSuccess={onDocumentLoadSuccess} options={options}>
{Array.from(new Array(numPages), (el, index) => (
{Array.from(new Array(numPages), (_el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
Expand Down
2 changes: 1 addition & 1 deletion sample/vite/Sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function Sample() {
</div>
<div className="Example__container__document" ref={setContainerRef}>
<Document file={file} onLoadSuccess={onDocumentLoadSuccess} options={options}>
{Array.from(new Array(numPages), (el, index) => (
{Array.from(new Array(numPages), (_el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
Expand Down
2 changes: 1 addition & 1 deletion sample/webpack5/Sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function Sample() {
</div>
<div className="Example__container__document" ref={setContainerRef}>
<Document file={file} onLoadSuccess={onDocumentLoadSuccess} options={options}>
{Array.from(new Array(numPages), (el, index) => (
{Array.from(new Array(numPages), (_el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
Expand Down
4 changes: 2 additions & 2 deletions test/Test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default function Test() {
<div className="Test__container__content__document">
{render ? (
displayAll ? (
Array.from(new Array(numPages), (el, index) => (
Array.from(new Array(numPages), (_el, index) => (
<Page
key={`page_${index + 1}`}
{...pageProps}
Expand Down Expand Up @@ -327,7 +327,7 @@ export default function Test() {
</div>
)}
<div className="Test__container__content__thumbnails">
{Array.from(new Array(numPages), (el, index) => (
{Array.from(new Array(numPages), (_el, index) => (
<Thumbnail
key={`thumbnail_${index + 1}`}
className="custom-classname-thumbnail"
Expand Down

0 comments on commit 0099cf2

Please sign in to comment.