Skip to content

Commit

Permalink
style: eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
schoero committed Jan 1, 2025
1 parent 2384802 commit d16f8cb
Show file tree
Hide file tree
Showing 29 changed files with 22 additions and 56 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Once you have imported SwissQRBill and PDFKit, it is quite easy to create a simp

```js
import { createWriteStream } from "node:fs";

import PDFDocument from "pdfkit";
import { SwissQRBill } from "swissqrbill/pdf";

Expand Down
3 changes: 1 addition & 2 deletions docs/how-to-create-a-complete-qr-bill.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

## Introduction

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][stackblitz]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][stackblitz]

In this guide you will learn how you can use SwissQRBill to create a complete PDF file and then attach the QR slip to the bottom of the page.
We will use [PDFKit][npm-pdfkit] to create a PDF document with a Logo, title and the address of the biller, as well as the recipient.
Expand Down
12 changes: 4 additions & 8 deletions docs/importing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ Each example below is available as a StackBlitz project.

#### Node.js: ES Module import

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][node-esm-javascript]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][node-esm-javascript]

Importing the library in Node.js using ES modules is straight forward. You can use the following import statement:

Expand All @@ -37,8 +36,7 @@ import { SwissQRBill } from "swissqrbill/svg";

#### Node.js: CommonJS import

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][node-cjs-javascript]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][node-cjs-javascript]

SwissQRBill provides a CommonJS module for legacy Node.js applications. You can require the library as follows:

Expand All @@ -55,8 +53,7 @@ const { SwissQRBill } = require("swissqrbill/svg");

### Browser: Bundling with webpack

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][browser-bundling-with-webpack]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][browser-bundling-with-webpack]

> **Warning**
>
Expand All @@ -66,8 +63,7 @@ As PDFKit internally relies on several different built in modules of Node.js, it

### Browser: Pre-built bundle

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][browser-pre-built-bundle]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][browser-pre-built-bundle]

> **Warning**
>
Expand Down
3 changes: 1 addition & 2 deletions examples/browser-bundling-with-webpack/src/pdf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from "fs";

import BlobStream from "blob-stream";
import fs from "fs";
import PDFDocument from "pdfkit";
import HelveticaBold from "pdfkit/js/data/Helvetica-Bold.afm";
import Helvetica from "pdfkit/js/data/Helvetica.afm";
Expand Down
1 change: 0 additions & 1 deletion examples/how-to-create-a-complete-qr-bill/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createWriteStream } from "fs";

import PDFDocument from "pdfkit";
import { SwissQRBill, Table } from "swissqrbill/pdf";
import { mm2pt } from "swissqrbill/utils";
Expand Down
1 change: 0 additions & 1 deletion examples/node-cjs-javascript/src/pdf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { createWriteStream } = require("fs");

const PDFDocument = require("pdfkit");
const { SwissQRBill } = require("swissqrbill/pdf");

Expand Down
1 change: 0 additions & 1 deletion examples/node-cjs-javascript/src/svg.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { writeFileSync } = require("fs");

const { SwissQRBill } = require("swissqrbill/svg");

const data = require("./data.js");
Expand Down
1 change: 0 additions & 1 deletion examples/node-esm-javascript/src/pdf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createWriteStream } from "fs";

import PDFDocument from "pdfkit";
import { SwissQRBill } from "swissqrbill/pdf";

Expand Down
1 change: 0 additions & 1 deletion examples/node-esm-javascript/src/svg.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { writeFileSync } from "fs";

import { SwissQRBill } from "swissqrbill/svg";

import { data } from "./data.js";
Expand Down
3 changes: 1 addition & 2 deletions src/pdf/swissqrbill.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { describe, expect, it } from "vitest";

import { SwissQRBill } from "swissqrbill:pdf";
import { minimalRequired } from "swissqrbill:tests:data/valid-data.js";
import { TestDocument } from "swissqrbill:tests:utils/pdf.js";
import { mm2pt } from "swissqrbill:utils";
import { describe, expect, it } from "vitest";


describe("qr-bill", async () => {
Expand Down
3 changes: 1 addition & 2 deletions src/pdf/swissqrcode.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { describe, expect, it, test } from "vitest";

import { SwissQRCode } from "swissqrbill:pdf";
import { minimalRequiredWithAlternativeScheme1and2 } from "swissqrbill:tests:data/valid-data.js";
import { TestDocument } from "swissqrbill:tests:utils/pdf.js";
import { mm2pt } from "swissqrbill:utils";
import { describe, expect, it, test } from "vitest";


describe("swissqrcode", () => {
Expand Down
3 changes: 1 addition & 2 deletions src/pdf/table.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from "vitest";

import { Table } from "swissqrbill:pdf";
import {
alignmentOverrides,
Expand All @@ -18,6 +16,7 @@ import {
tupleShorthand
} from "swissqrbill:tests:data/table.js";
import { TestDocument } from "swissqrbill:tests:utils/pdf.js";
import { describe, expect, it } from "vitest";


describe("table", async () => {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/cleaner.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { describe, expect, it } from "vitest";

import { cleanData } from "swissqrbill:shared:cleaner.js";
import { describe, expect, it } from "vitest";

import type { Data } from "swissqrbill:types";

Expand Down
3 changes: 1 addition & 2 deletions src/shared/errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { describe, expect, it } from "vitest";

import { getErrorCodeByMessage, ValidationErrors } from "swissqrbill:errors";
import { } from "swissqrbill:shared:cleaner.js";
import { describe, expect, it } from "vitest";


describe("getErrorCodeByMessage", () => {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/qr-code.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, test } from "vitest";

import { } from "swissqrbill:shared:cleaner.js";
import { generateQRData } from "swissqrbill:shared:qr-code.js";
import {
Expand All @@ -23,6 +21,7 @@ import {
minimalRequiredWithMaxedOutMessage,
minimalRequiredWithMessage
} from "swissqrbill:tests:data/valid-data.js";
import { describe, expect, test } from "vitest";


describe("generateQRData", () => {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/translations.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { describe, expect, test } from "vitest";

import { minimalRequired } from "swissqrbill:tests:data/valid-data.js";
import { pdf } from "swissqrbill:tests:utils/pdf.js";
import { svg } from "swissqrbill:tests:utils/svg.js";
import { describe, expect, test } from "vitest";


describe("translations", async () => {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, test } from "vitest";

import {
calculateQRReferenceChecksum,
calculateSCORReferenceChecksum,
Expand All @@ -15,6 +13,7 @@ import {
isSCORReference,
isSCORReferenceValid
} from "swissqrbill:utils";
import { describe, expect, test } from "vitest";


// https://github.com/swico/qr-bill#qr-iban
Expand Down
3 changes: 1 addition & 2 deletions src/shared/validator.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from "vitest";

import { resolveMessageParams, ValidationErrors } from "swissqrbill:errors";
import { cleanData } from "swissqrbill:shared:cleaner.js";
import { validateData } from "swissqrbill:shared:validator.js";
Expand Down Expand Up @@ -94,6 +92,7 @@ import {
minimalRequiredWithMaxedOutMessage,
minimalRequiredWithMessage
} from "swissqrbill:tests:data/valid-data.js";
import { describe, expect, it } from "vitest";


describe("validator", async () => {
Expand Down
1 change: 0 additions & 1 deletion src/svg/swissqrbill.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { calc, SVG } from "svg-engine";

import { cleanData } from "swissqrbill:shared:cleaner.js";
import { translations } from "swissqrbill:shared:translations.js";
import { validateData } from "swissqrbill:shared:validator.js";
Expand Down
3 changes: 1 addition & 2 deletions src/svg/swissqrcode.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { describe, expect, test } from "vitest";

import { SwissQRCode } from "swissqrbill:svg";
import { minimalRequiredWithAlternativeScheme1and2 } from "swissqrbill:tests:data/valid-data.js";
import { TestDocument } from "swissqrbill:tests:utils/svg.js";
import { mm2pt } from "swissqrbill:utils";
import { describe, expect, test } from "vitest";


describe("swissqrcode", () => {
Expand Down
1 change: 0 additions & 1 deletion src/svg/swissqrcode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SVG } from "svg-engine";

import { renderQRCode, renderSwissCross } from "swissqrbill:shared:qr-code.js";

// eslint-disable-next-line eslint-plugin-unused-imports/no-unused-imports
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/data.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, test } from "vitest";

import {
creditorWithBuildingNumber,
creditorWithBuildingNumberString,
Expand All @@ -23,6 +21,7 @@ import {
} from "swissqrbill:tests:data/valid-data.js";
import { pdf } from "swissqrbill:tests:utils/pdf.js";
import { svg } from "swissqrbill:tests:utils/svg.js";
import { describe, expect, test } from "vitest";


describe("data", async () => {
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/options.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { describe, expect, test } from "vitest";

import { minimalRequired } from "swissqrbill:tests:data/valid-data.js";
import { pdf } from "swissqrbill:tests:utils/pdf.js";
import { svg } from "swissqrbill:tests:utils/svg.js";
import { describe, expect, test } from "vitest";


describe("options", async () => {
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/validation-error.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { describe, expect, it } from "vitest";

import { ValidationError, ValidationErrors } from "swissqrbill:errors";
import { cleanData } from "swissqrbill:shared:cleaner";
import { validateData } from "swissqrbill:shared:validator";
import { missingCreditor } from "swissqrbill:tests:data/invalid-data";
import { getValidationError } from "swissqrbill:tests:utils/errors";
import { describe, expect, it } from "vitest";


describe("errors", () => {
Expand Down
3 changes: 1 addition & 2 deletions tests/utils/buffer.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { describe, expect, it } from "vitest";

import { splitBuffer } from "swissqrbill:tests:utils/buffer.js";
import { describe, expect, it } from "vitest";


describe("buffer", () => {
Expand Down
3 changes: 1 addition & 2 deletions tests/utils/errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { describe, expect, it } from "vitest";

import { ValidationError, ValidationErrors } from "swissqrbill:errors";
import { describe, expect, it } from "vitest";

import { getValidationError } from "./errors";

Expand Down
3 changes: 1 addition & 2 deletions tests/utils/fill.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { describe, expect, it } from "vitest";

import { fillUntil } from "swissqrbill:tests:utils/fill.js";
import { describe, expect, it } from "vitest";


describe("fill", () => {
Expand Down
2 changes: 0 additions & 2 deletions tests/utils/pdf.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { mkdir, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { buffer } from "node:stream/consumers";

import PDFDocument from "pdfkit";

import { SwissQRBill } from "swissqrbill:pdf";
import { splitBuffer } from "swissqrbill:tests:utils/buffer.js";

Expand Down
2 changes: 0 additions & 2 deletions tests/utils/svg.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { mkdirSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";

import SVG from "svg-engine";

import { SwissQRBill } from "swissqrbill:svg";

import type { Data, SVGOptions } from "swissqrbill:types";
Expand Down

0 comments on commit d16f8cb

Please sign in to comment.