Skip to content

Commit

Permalink
refactor: fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonGolms committed Nov 18, 2023
1 parent 0124e10 commit b31c609
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/commands/qrcode/qrcode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CATEGORIES } from '../../config/categories';
import { CreateQrCode } from '../../types';
import type { CreateQrCode } from '../../types';
import { writeFile } from '../../utils/file';
import { composeQrCode, composeSetupUri } from './qrcode.utils';

Expand All @@ -15,6 +15,7 @@ export const createQrCode = async ({ category, flag, name, output, pairingCode,

try {
await writeFile({ name, output, svg, ...rest });
// eslint-disable-next-line no-console
console.log(`HomeKit QR Code successfully generated: ${name}.${output}`);
} catch (error) {
console.error(error);
Expand Down
5 changes: 3 additions & 2 deletions src/commands/qrcode/qrcode.utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { QRCodeToStringOptions, toString } from 'qrcode';
import { ComposeQrCode, ComposeSetupUri } from '../../types';
import type { QRCodeToStringOptions } from 'qrcode';
import { toString } from 'qrcode';
import type { ComposeQrCode, ComposeSetupUri } from '../../types';

const QR_CODE_STRING_OPTIONS: QRCodeToStringOptions = {
errorCorrectionLevel: 'quartile',
Expand Down
3 changes: 2 additions & 1 deletion src/commands/tag/tag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CreateTag } from '../../types';
import type { CreateTag } from '../../types';
import { writeFile } from '../../utils/file';
import { composeTag } from './tag.utils';

Expand All @@ -7,6 +7,7 @@ export const createTag = async ({ name, output, pairingCode, ...rest }: CreateTa

try {
await writeFile({ name, output, svg, ...rest });
// eslint-disable-next-line no-console
console.log(`HomeKit tag successfully generated: ${name}.${output}`);
} catch (error) {
console.error(error);
Expand Down
4 changes: 2 additions & 2 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CATEGORIES } from '../config/categories';
import { OUTPUT_FORMATS } from '../config/output';
import type { CATEGORIES } from '../config/categories';
import type { OUTPUT_FORMATS } from '../config/output';

export type Category = keyof typeof CATEGORIES;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/file.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import { CreateFileBuffer, WriteFile } from '../types';
import type { CreateFileBuffer, WriteFile } from '../types';
import { createImage } from './image';

const createFileBuffer = async ({ output, svg, zoom }: CreateFileBuffer): Promise<Buffer> => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/image.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Resvg } from '@resvg/resvg-js';
import { CreateImage } from '../types';
import type { CreateImage } from '../types';

export const createImage = ({ svg, zoom = 5 }: CreateImage) => {
const resvg = new Resvg(svg, {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/isValidCategory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CATEGORIES } from '../config/categories';
import { Category } from '../types';
import type { Category } from '../types';

export const isValidCategory = (category: unknown): category is Category => {
return typeof category === 'string' && Object.keys(CATEGORIES).includes(category);
Expand Down
2 changes: 1 addition & 1 deletion src/yargs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import yargs from 'yargs/yargs';
import { CATEGORIES } from './config/categories';
import { OUTPUT_FORMATS } from './config/output';
import { Category, OutputFormat } from './types';
import type { Category, OutputFormat } from './types';
import { isPairingCode } from './utils/number';

export const argv = yargs(process.argv.slice(2))
Expand Down

0 comments on commit b31c609

Please sign in to comment.