Skip to content

Commit

Permalink
feat: Enable TS option verbatimModuleSyntax (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
meyfa authored Dec 14, 2024
1 parent 9221261 commit 096c81a
Show file tree
Hide file tree
Showing 23 changed files with 37 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/cache.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { formatDate, parseDate } from './util/date-format.js'
import { Adapter } from 'fs-adapters'
import { CanteenPlan, DateSpec } from 'ka-mensa-fetch'
import type { Adapter } from 'fs-adapters'
import type { CanteenPlan, DateSpec } from 'ka-mensa-fetch'

/**
* ENOENT error code.
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/canteens-controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Canteen, Line, canteens } from 'ka-mensa-fetch'
import { type Canteen, type Line, canteens } from 'ka-mensa-fetch'
import { NotFoundError } from '../errors.js'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/legend-controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LegendItem, legend } from 'ka-mensa-fetch'
import { type LegendItem, legend } from 'ka-mensa-fetch'

/**
* API controller for retrieving the legend.
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/plans-controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CanteenLine, CanteenPlan, DateSpec } from 'ka-mensa-fetch'
import { Cache } from '../cache.js'
import type { CanteenLine, CanteenPlan, DateSpec } from 'ka-mensa-fetch'
import type { Cache } from '../cache.js'
import { NotFoundError } from '../errors.js'

/**
Expand Down
4 changes: 2 additions & 2 deletions src/fixup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CanteenPlan, DateSpec, matchCanteenByName, matchLineByName } from 'ka-mensa-fetch'
import { Cache } from './cache.js'
import { type CanteenPlan, type DateSpec, matchCanteenByName, matchLineByName } from 'ka-mensa-fetch'
import type { Cache } from './cache.js'

/**
* Fix a single plan. This fills in missing data (specifically: IDs) by matching it against existing data
Expand Down
4 changes: 2 additions & 2 deletions src/http-server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { onTermination } from 'omniwheel'
import { Cache } from './cache.js'
import fastify, { FastifyInstance } from 'fastify'
import type { Cache } from './cache.js'
import fastify, { type FastifyInstance } from 'fastify'
import cors from '@fastify/cors'
import { sendError } from './response.js'
import { ApiError, BadRequestError, InternalServerError, NotFoundError } from './errors.js'
Expand Down
8 changes: 4 additions & 4 deletions src/job.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CanteenPlan, DateSpec, fetchMensa } from 'ka-mensa-fetch'
import { type CanteenPlan, type DateSpec, fetchMensa } from 'ka-mensa-fetch'
import { group } from 'group-items'
import moment from 'moment'
import ms from 'ms'
import { Config } from './config.js'
import type { Config } from './config.js'
import { getSessionCookie } from './get-session-cookie.js'
import { Cache } from './cache.js'
import type { Cache } from './cache.js'
import { formatDate } from './util/date-format.js'
import { Logger } from 'winston'
import type { Logger } from 'winston'

/**
* Maximum age of a plan that is still considered valid for caching. If a plan
Expand Down
4 changes: 2 additions & 2 deletions src/response.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FastifyReply } from 'fastify'
import { ApiError } from './errors.js'
import type { FastifyReply } from 'fastify'
import type { ApiError } from './errors.js'

/**
* Respond with an error message.
Expand Down
2 changes: 1 addition & 1 deletion src/routes/canteens.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CanteensController } from '../controllers/canteens-controller.js'
import { FastifyPluginAsync } from 'fastify'
import type { FastifyPluginAsync } from 'fastify'
import { sendResult } from '../response.js'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/routes/default.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FastifyPluginAsync } from 'fastify'
import type { FastifyPluginAsync } from 'fastify'
import { sendResult } from '../response.js'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/routes/meta/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { legendRoute } from './legend.js'
import { FastifyPluginAsync } from 'fastify'
import type { FastifyPluginAsync } from 'fastify'

/**
* Create the route that combines meta information routes.
Expand Down
2 changes: 1 addition & 1 deletion src/routes/meta/legend.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LegendController } from '../../controllers/legend-controller.js'
import { FastifyPluginAsync } from 'fastify'
import type { FastifyPluginAsync } from 'fastify'
import { sendResult } from '../../response.js'

/**
Expand Down
6 changes: 3 additions & 3 deletions src/routes/plans.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DateSpec, canteens } from 'ka-mensa-fetch'
import { Cache } from '../cache.js'
import { type DateSpec, canteens } from 'ka-mensa-fetch'
import type { Cache } from '../cache.js'
import { parseDate } from '../util/date-format.js'
import { PlansController } from '../controllers/plans-controller.js'
import { BadRequestError } from '../errors.js'
import { parseCommaFilter } from '../util/parse-comma-filter.js'
import { FastifyPluginAsync } from 'fastify'
import type { FastifyPluginAsync } from 'fastify'
import { sendResult } from '../response.js'

const CANTEEN_IDS = canteens.map(({ id }) => id)
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DirectoryAdapter } from 'fs-adapters'
import { Config, getConfig } from './config.js'
import { type Config, getConfig } from './config.js'
import { Cache } from './cache.js'
import { runFetchJob } from './job.js'
import { onTermination } from 'omniwheel'
Expand Down
2 changes: 1 addition & 1 deletion src/util/date-format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DateSpec } from 'ka-mensa-fetch'
import type { DateSpec } from 'ka-mensa-fetch'

/**
* Format the given date spec into a string YYYY-MM-DD.
Expand Down
4 changes: 2 additions & 2 deletions test/fixup.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'node:assert'
import { Cache } from '../src/cache.js'
import { MemoryAdapter, ReadWriteOptions } from 'fs-adapters'
import { CanteenPlan, canteens, DateSpec } from 'ka-mensa-fetch'
import { MemoryAdapter, type ReadWriteOptions } from 'fs-adapters'
import { type CanteenPlan, canteens, type DateSpec } from 'ka-mensa-fetch'
import { fixupCache } from '../src/fixup.js'

/**
Expand Down
2 changes: 1 addition & 1 deletion test/routes/404.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Cache } from '../../src/cache.js'
import { MemoryAdapter } from 'fs-adapters'
import assert from 'node:assert'
import { HttpStatus } from 'omniwheel'
import { FastifyInstance } from 'fastify'
import type { FastifyInstance } from 'fastify'
import winston from 'winston'
import { defaultOptions } from './fixtures.js'

Expand Down
2 changes: 1 addition & 1 deletion test/routes/canteens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MemoryAdapter } from 'fs-adapters'
import assert from 'node:assert'
import { HttpStatus } from 'omniwheel'
import { canteens } from 'ka-mensa-fetch'
import { FastifyInstance } from 'fastify'
import type { FastifyInstance } from 'fastify'
import winston from 'winston'
import { defaultOptions } from './fixtures.js'

Expand Down
2 changes: 1 addition & 1 deletion test/routes/default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Cache } from '../../src/cache.js'
import { MemoryAdapter } from 'fs-adapters'
import assert from 'node:assert'
import { HttpStatus } from 'omniwheel'
import { FastifyInstance } from 'fastify'
import type { FastifyInstance } from 'fastify'
import winston from 'winston'
import { defaultOptions } from './fixtures.js'

Expand Down
2 changes: 1 addition & 1 deletion test/routes/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpServerOptions } from '../../src/http-server.js'
import type { HttpServerOptions } from '../../src/http-server.js'

export const defaultOptions: HttpServerOptions = {
host: '127.0.0.1',
Expand Down
2 changes: 1 addition & 1 deletion test/routes/meta/legend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MemoryAdapter } from 'fs-adapters'
import assert from 'node:assert'
import { HttpStatus } from 'omniwheel'
import { legend } from 'ka-mensa-fetch'
import { FastifyInstance } from 'fastify'
import type { FastifyInstance } from 'fastify'
import winston from 'winston'
import { defaultOptions } from '../fixtures.js'

Expand Down
2 changes: 1 addition & 1 deletion test/routes/plans.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Cache } from '../../src/cache.js'
import { MemoryAdapter } from 'fs-adapters'
import assert from 'node:assert'
import { HttpStatus } from 'omniwheel'
import { FastifyInstance, LightMyRequestResponse } from 'fastify'
import type { FastifyInstance, LightMyRequestResponse } from 'fastify'
import { canteens } from 'ka-mensa-fetch'
import winston from 'winston'
import { defaultOptions } from './fixtures.js'
Expand Down
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"compilerOptions": {
"lib": ["ES2022"],
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "Node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true,
"inlineSourceMap": true,
"outDir": "./dist"
},
Expand Down

0 comments on commit 096c81a

Please sign in to comment.