diff --git a/complex-types.d.ts b/complex-types.d.ts index 6970171..c4419c0 100644 --- a/complex-types.d.ts +++ b/complex-types.d.ts @@ -1,5 +1,15 @@ import type {Literal} from 'mdast' +// eslint-disable-next-line @typescript-eslint/consistent-type-definitions +export interface Math extends Literal { + type: 'math' + meta?: string | null +} + +// eslint-disable-next-line @typescript-eslint/consistent-type-definitions +export interface InlineMath extends Literal { + type: 'inlineMath' +} declare module 'mdast-util-from-markdown' { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface CompileData { @@ -41,17 +51,6 @@ declare module 'mdast-util-to-markdown' { } } -// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -export interface Math extends Literal { - type: 'math' - meta?: string | null -} - -// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -export interface InlineMath extends Literal { - type: 'inlineMath' -} - declare module 'mdast' { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface StaticPhrasingContentMap { diff --git a/index.js b/index.js index 1769819..c7b4e64 100644 --- a/index.js +++ b/index.js @@ -4,8 +4,8 @@ * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle - * @typedef {import('./complex-types').Math} Math - * @typedef {import('./complex-types').InlineMath} InlineMath + * @typedef {import('./complex-types.js').Math} Math + * @typedef {import('./complex-types.js').InlineMath} InlineMath * * @typedef ToOptions * @property {boolean} [singleDollarTextMath=true] diff --git a/package.json b/package.json index 178566d..6d96bc5 100644 --- a/package.json +++ b/package.json @@ -55,10 +55,11 @@ "xo": "^0.53.0" }, "scripts": { - "build": "rimraf \"{index,test}.d.ts\" && tsc && type-coverage", + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", "test-api": "node --conditions development test.js", - "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", "test": "npm run build && npm run format && npm run test-coverage" }, "prettier": { diff --git a/tsconfig.json b/tsconfig.json index e31adf8..da782de 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,17 @@ { - "include": ["*.js"], + "include": ["**/*.js", "complex-types.d.ts"], + "exclude": ["coverage/", "node_modules/"], "compilerOptions": { - "target": "ES2020", - "lib": ["ES2020"], - "module": "ES2020", - "moduleResolution": "node", - "allowJs": true, "checkJs": true, "declaration": true, "emitDeclarationOnly": true, - "allowSyntheticDefaultImports": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es2020"], + "module": "node16", + "newLine": "lf", "skipLibCheck": true, - "strict": true + "strict": true, + "target": "es2020" } }