From c98159b452dfd42cd84607b3eebe79b8feabb785 Mon Sep 17 00:00:00 2001 From: antonk52 Date: Fri, 16 Feb 2024 22:40:17 +0000 Subject: [PATCH 1/9] move file --- package-lock.json | 3 +++ src/{index.ts => index.js} | 0 tsconfig.json | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) rename src/{index.ts => index.js} (100%) diff --git a/package-lock.json b/package-lock.json index 27b9121..ebe9fd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,9 @@ }, "engines": { "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/src/index.ts b/src/index.js similarity index 100% rename from src/index.ts rename to src/index.js diff --git a/tsconfig.json b/tsconfig.json index 6f930ed..f485e8c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "allowJs": true, + "checkJs": true, "alwaysStrict": true, "esModuleInterop": false, "lib": ["es2018"], @@ -19,6 +20,6 @@ "outDir": "./dist", "baseUrl": "./src" }, - "include": ["src/**/*.ts"], + "include": ["src/**/*.ts", "src/**/*.js"], "exclude": ["src/**/spec", "./package.json"] } From 32ce7afd51bdad856231b4015b6f5e6f45b8e6c1 Mon Sep 17 00:00:00 2001 From: antonk52 Date: Fri, 16 Feb 2024 22:45:58 +0000 Subject: [PATCH 2/9] refactor lilconfig to js --- package.json | 10 +-- src/index.d.ts | 54 +++++++++++++ src/index.js | 200 +++++++++++++++++-------------------------------- 3 files changed, 127 insertions(+), 137 deletions(-) create mode 100644 src/index.d.ts diff --git a/package.json b/package.json index c97df08..078bcd5 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,11 @@ "name": "lilconfig", "version": "3.1.0", "description": "A zero-dependency alternative to cosmiconfig", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "src/index.js", + "types": "src/index.d.ts", "scripts": { - "prebuild": "npm run clean", - "build": "tsc --declaration", - "postbuild": "du -h ./dist/*", - "clean": "rm -rf ./dist", "test": "NODE_OPTIONS=--experimental-vm-modules ./node_modules/.bin/jest --coverage", - "lint": "eslint ./src/*.ts" + "lint": "eslint ./src/*.js" }, "keywords": [ "cosmiconfig", diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..b0efc30 --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,54 @@ +export type LilconfigResult = null | { + filepath: string; + config: any; + isEmpty?: boolean; +}; +interface OptionsBase { + cache?: boolean; + stopDir?: string; + searchPlaces?: string[]; + ignoreEmptySearchPlaces?: boolean; + packageProp?: string | string[]; +} +export type Transform = + | TransformSync + | ((result: LilconfigResult) => Promise); +export type TransformSync = (result: LilconfigResult) => LilconfigResult; +type LoaderResult = any; +export type LoaderSync = (filepath: string, content: string) => LoaderResult; +export type Loader = + | LoaderSync + | ((filepath: string, content: string) => Promise); +export type Loaders = Record; +export type LoadersSync = Record; +export interface Options extends OptionsBase { + loaders?: Loaders; + transform?: Transform; +} +export interface OptionsSync extends OptionsBase { + loaders?: LoadersSync; + transform?: TransformSync; +} +export declare const defaultLoadersSync: LoadersSync; +export declare const defaultLoaders: Loaders; +type ClearCaches = { + clearLoadCache: () => void; + clearSearchCache: () => void; + clearCaches: () => void; +}; +type AsyncSearcher = { + search(searchFrom?: string): Promise; + load(filepath: string): Promise; +} & ClearCaches; +export declare function lilconfig( + name: string, + options?: Partial, +): AsyncSearcher; +type SyncSearcher = { + search(searchFrom?: string): LilconfigResult; + load(filepath: string): LilconfigResult; +} & ClearCaches; +export declare function lilconfigSync( + name: string, + options?: OptionsSync, +): SyncSearcher; diff --git a/src/index.js b/src/index.js index a2f9bd6..bc88187 100644 --- a/src/index.js +++ b/src/index.js @@ -1,48 +1,12 @@ -import * as path from 'path'; -import * as fs from 'fs'; -import * as os from 'os'; +// @ts-check +const path = require('path'); +const fs = require('fs'); +const os = require('os'); const fsReadFileAsync = fs.promises.readFile; -export type LilconfigResult = null | { - filepath: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - config: any; - isEmpty?: boolean; -}; - -interface OptionsBase { - cache?: boolean; - stopDir?: string; - searchPlaces?: string[]; - ignoreEmptySearchPlaces?: boolean; - packageProp?: string | string[]; -} - -export type Transform = - | TransformSync - | ((result: LilconfigResult) => Promise); -export type TransformSync = (result: LilconfigResult) => LilconfigResult; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type LoaderResult = any; -export type LoaderSync = (filepath: string, content: string) => LoaderResult; -export type Loader = - | LoaderSync - | ((filepath: string, content: string) => Promise); -export type Loaders = Record; -export type LoadersSync = Record; - -export interface Options extends OptionsBase { - loaders?: Loaders; - transform?: Transform; -} - -export interface OptionsSync extends OptionsBase { - loaders?: LoadersSync; - transform?: TransformSync; -} - -function getDefaultSearchPlaces(name: string, sync: boolean): string[] { +/** @type {(name: string, sync: boolean) => string[]} */ +function getDefaultSearchPlaces(name, sync) { return [ 'package.json', `.${name}rc.json`, @@ -61,35 +25,39 @@ function getDefaultSearchPlaces(name: string, sync: boolean): string[] { } /** - * @see #17 + * @type {(p: string) => string} + * + * see #17 * On *nix, if cwd is not under homedir, * the last path will be '', ('/build' -> '') * but it should be '/' actually. * And on Windows, this will never happen. ('C:\build' -> 'C:') */ -function parentDir(p: string): string { +function parentDir(p) { return path.dirname(p) || path.sep; } -const jsonLoader: LoaderSync = (_, content) => JSON.parse(content); -export const defaultLoadersSync: LoadersSync = Object.freeze({ +/** @type {import('./index.d.ts').LoaderSync} */ +const jsonLoader = (_, content) => JSON.parse(content); +/** @type {import('./index.d.ts').LoadersSync} */ +const defaultLoadersSync = Object.freeze({ '.js': require, '.json': require, '.cjs': require, noExt: jsonLoader, }); +module.exports.defaultLoadersSync = defaultLoadersSync; -const dynamicImport = async (id: string) => { +/** @type {import('./index.d.ts').Loader} */ +const dynamicImport = async id => { try { - // to preserve CJS output but keep dynamic import as is - // https://github.com/microsoft/TypeScript/issues/43329#issuecomment-922544562 - const mod = await eval(`import('${id}')`); + const mod = await import(id); return mod.default; } catch (e) { try { return require(id); - } catch (requireE: any) { + } catch (/** @type {any} */ requireE) { if ( requireE.code === 'ERR_REQUIRE_ESM' || (requireE instanceof SyntaxError && @@ -106,35 +74,30 @@ const dynamicImport = async (id: string) => { } }; -export const defaultLoaders: Loaders = Object.freeze({ +/** @type {import('./index.d.ts').Loaders} */ +const defaultLoaders = Object.freeze({ '.js': dynamicImport, '.mjs': dynamicImport, '.cjs': dynamicImport, '.json': jsonLoader, noExt: jsonLoader, }); +module.exports.defaultLoaders = defaultLoaders; -function getOptions( - name: string, - options: OptionsSync, - sync: true, -): Required; -function getOptions( - name: string, - options: Options, - sync: false, -): Required; -function getOptions( - name: string, - options: Options | OptionsSync, - sync: boolean, -): Required { - const conf: Required = { +/** + * @param {string} name + * @param {import('./index.d.ts').Options | import('./index.d.ts').OptionsSync} options + * @param {boolean} sync + * @returns {Required} + */ +function getOptions(name, options, sync) { + /** @type {Required} */ + const conf = { stopDir: os.homedir(), searchPlaces: getDefaultSearchPlaces(name, sync), ignoreEmptySearchPlaces: true, cache: true, - transform: (x: LilconfigResult): LilconfigResult => x, + transform: x => x, packageProp: [name], ...options, loaders: { @@ -159,54 +122,37 @@ function getOptions( return conf; } -function getPackageProp( - props: string | string[], - obj: Record, -): unknown { +/** @type {(props: string | string[], obj: Record) => unknown} */ +function getPackageProp(props, obj) { if (typeof props === 'string' && props in obj) return obj[props]; return ( (Array.isArray(props) ? props : props.split('.')).reduce( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (acc: any, prop): unknown => (acc === undefined ? acc : acc[prop]), + (acc, prop) => (acc === undefined ? acc : acc[prop]), obj, ) || null ); } -function validateFilePath(filepath: string): void { +/** @param {string} filepath */ +function validateFilePath(filepath) { if (!filepath) throw new Error('load must pass a non-empty string'); } -function validateLoader(loader: Loader, ext: string): void | never { +/** @type {(loader: import('./index.d.ts').Loader, ext: string) => void} */ +function validateLoader(loader, ext) { if (!loader) throw new Error(`No loader specified for extension "${ext}"`); if (typeof loader !== 'function') throw new Error('loader is not a function'); } -type ClearCaches = { - clearLoadCache: () => void; - clearSearchCache: () => void; - clearCaches: () => void; +/** @type {(enableCache: boolean) => (c: Map, filepath: string, res: T) => T} */ +const makeEmplace = enableCache => (c, filepath, res) => { + if (enableCache) c.set(filepath, res); + return res; }; -const makeEmplace = - >( - enableCache: boolean, - ) => - (c: Map, filepath: string, res: T): T => { - if (enableCache) c.set(filepath, res); - return res; - }; - -type AsyncSearcher = { - search(searchFrom?: string): Promise; - load(filepath: string): Promise; -} & ClearCaches; - -export function lilconfig( - name: string, - options?: Partial, -): AsyncSearcher { +/** @type {import('./index.d.ts').lilconfig} */ +module.exports.lilconfig = function lilconfig(name, options) { const { ignoreEmptySearchPlaces, loaders, @@ -216,19 +162,19 @@ export function lilconfig( transform, cache, } = getOptions(name, options ?? {}, false); - type R = LilconfigResult | Promise; - const searchCache = new Map(); - const loadCache = new Map(); - const emplace = makeEmplace(cache); + const searchCache = new Map(); + const loadCache = new Map(); + const emplace = makeEmplace(cache); return { - async search(searchFrom = process.cwd()): Promise { - const result: LilconfigResult = { + async search(searchFrom = process.cwd()) { + /** @type {import('./index.d.ts').LilconfigResult} */ + const result = { config: null, filepath: '', }; - const visited: Set = new Set(); + const visited = new Set(); let dir = searchFrom; dirLoop: while (true) { if (cache) { @@ -294,11 +240,11 @@ export function lilconfig( return transformed; }, - async load(filepath: string): Promise { + async load(filepath) { validateFilePath(filepath); const absPath = path.resolve(process.cwd(), filepath); if (cache && loadCache.has(absPath)) { - return loadCache.get(absPath) as LilconfigResult; + return loadCache.get(absPath); } const {base, ext} = path.parse(absPath); const loaderKey = ext || 'noExt'; @@ -317,7 +263,8 @@ export function lilconfig( }), ); } - const result: LilconfigResult = { + /** @type {import('./index.d.ts').LilconfigResult} */ + const result = { config: null, filepath: absPath, }; @@ -360,17 +307,10 @@ export function lilconfig( } }, }; -} - -type SyncSearcher = { - search(searchFrom?: string): LilconfigResult; - load(filepath: string): LilconfigResult; -} & ClearCaches; +}; -export function lilconfigSync( - name: string, - options?: OptionsSync, -): SyncSearcher { +/** @type {import('./index.d.ts').lilconfigSync} */ +module.exports.lilconfigSync = function lilconfigSync(name, options) { const { ignoreEmptySearchPlaces, loaders, @@ -380,19 +320,19 @@ export function lilconfigSync( transform, cache, } = getOptions(name, options ?? {}, true); - type R = LilconfigResult; - const searchCache = new Map(); - const loadCache = new Map(); - const emplace = makeEmplace(cache); + const searchCache = new Map(); + const loadCache = new Map(); + const emplace = makeEmplace(cache); return { - search(searchFrom = process.cwd()): LilconfigResult { - const result: LilconfigResult = { + search(searchFrom = process.cwd()) { + /** @type {import('./index.d.ts').LilconfigResult} */ + const result = { config: null, filepath: '', }; - const visited: Set = new Set(); + const visited = new Set(); let dir = searchFrom; dirLoop: while (true) { if (cache) { @@ -458,11 +398,11 @@ export function lilconfigSync( return transformed; }, - load(filepath: string): LilconfigResult { + load(filepath) { validateFilePath(filepath); const absPath = path.resolve(process.cwd(), filepath); if (cache && loadCache.has(absPath)) { - return loadCache.get(absPath) as LilconfigResult; + return loadCache.get(absPath); } const {base, ext} = path.parse(absPath); const loaderKey = ext || 'noExt'; @@ -478,7 +418,7 @@ export function lilconfigSync( filepath: absPath, }); } - const result: LilconfigResult = { + const result = { config: null, filepath: absPath, }; @@ -519,4 +459,4 @@ export function lilconfigSync( } }, }; -} +}; From 6a0ffcb549379f50ca18a74cc1357f4b76e3ec81 Mon Sep 17 00:00:00 2001 From: antonk52 Date: Fri, 16 Feb 2024 22:50:35 +0000 Subject: [PATCH 3/9] move test to js --- .github/workflows/nodejs.yaml | 2 +- jest.config.js | 3 +-- src/spec/{index.spec.ts => index.spec.js} | 0 src/spec/{old-node-tests.uvu.ts => old-node-tests.uvu.js} | 0 4 files changed, 2 insertions(+), 3 deletions(-) rename src/spec/{index.spec.ts => index.spec.js} (100%) rename src/spec/{old-node-tests.uvu.ts => old-node-tests.uvu.js} (100%) diff --git a/.github/workflows/nodejs.yaml b/.github/workflows/nodejs.yaml index 3736a6a..1734831 100644 --- a/.github/workflows/nodejs.yaml +++ b/.github/workflows/nodejs.yaml @@ -66,7 +66,7 @@ jobs: - name: install dependencies run: npm ci - name: old node tests - run: npx ts-node src/spec/old-node-tests.uvu.ts + run: node src/spec/old-node-tests.uvu.js coveralls: runs-on: ubuntu-latest diff --git a/jest.config.js b/jest.config.js index 6abee82..f697ebf 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,10 +1,9 @@ module.exports = { roots: ['/src'], - preset: 'ts-jest', moduleNameMapper: { '^@/(.*)$': '/src/$1', }, - collectCoverageFrom: ['./src/index.ts'], + collectCoverageFrom: ['./src/index.js'], coverageThreshold: { global: { branches: 97, diff --git a/src/spec/index.spec.ts b/src/spec/index.spec.js similarity index 100% rename from src/spec/index.spec.ts rename to src/spec/index.spec.js diff --git a/src/spec/old-node-tests.uvu.ts b/src/spec/old-node-tests.uvu.js similarity index 100% rename from src/spec/old-node-tests.uvu.ts rename to src/spec/old-node-tests.uvu.js From 927f8fbf31b014f5335bdc7d8537be4dd2799d10 Mon Sep 17 00:00:00 2001 From: antonk52 Date: Fri, 16 Feb 2024 23:05:24 +0000 Subject: [PATCH 4/9] migrate test code to js with tsdoc --- src/spec/index.spec.js | 99 +++++++++++++++++++--------------- src/spec/old-node-tests.uvu.js | 15 +++--- 2 files changed, 64 insertions(+), 50 deletions(-) diff --git a/src/spec/index.spec.js b/src/spec/index.spec.js index 33fbf1b..3c773bb 100644 --- a/src/spec/index.spec.js +++ b/src/spec/index.spec.js @@ -1,15 +1,15 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import * as path from 'path'; -import * as fs from 'fs'; -import {lilconfig, lilconfigSync, LoaderSync, TransformSync} from '..'; -import {cosmiconfig, cosmiconfigSync} from 'cosmiconfig'; -import {transpileModule} from 'typescript'; +// @ts-check +const path = require('path'); +const fs = require('fs'); +const {lilconfig, lilconfigSync} = require('..'); +const {cosmiconfig, cosmiconfigSync} = require('cosmiconfig'); +const {transpileModule} = require('typescript'); /** * Mocking fs solely to test the root directory filepath */ jest.mock('fs', () => { - const fs = jest.requireActual('fs'); + const fs = jest.requireActual('fs'); return { ...fs, @@ -33,7 +33,8 @@ describe('options', () => { const dirname = path.join(__dirname, 'load'); describe('loaders', () => { - const tsLoader: LoaderSync = (_, content) => { + /** @type {import('../index').LoaderSync} */ + const tsLoader = (_, content) => { const res = transpileModule(content, {}).outputText; return eval(res); }; @@ -83,7 +84,9 @@ describe('options', () => { const options = { loaders: { '.js': async () => config, - noExt: (_: string, content: string) => content, + + /** @type {import('../index').LoaderSync} */ + noExt: (_, content) => content, }, }; @@ -391,7 +394,8 @@ describe('options', () => { }); describe('transform', () => { - const transform: TransformSync = result => { + /** @type {import('../index').TransformSync} */ + const transform = result => { if (result == null) return null; return { ...result, @@ -460,12 +464,10 @@ describe('options', () => { }); it('async', async () => { - const result = await lilconfig('test-app').load( - relativeFilepath, - ); - const ccResult = await cosmiconfig('test-app').load( - relativeFilepath, - ); + const result = + await lilconfig('test-app').load(relativeFilepath); + const ccResult = + await cosmiconfig('test-app').load(relativeFilepath); const expected = { config: undefined, @@ -623,7 +625,8 @@ describe('options', () => { searchPlaces, }); const fsLookUps = () => - (fs.promises.access as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.promises.access.mock.calls.length; expect(fsLookUps()).toBe(0); @@ -708,7 +711,8 @@ describe('options', () => { searchPlaces, }); const fsLookUps = () => - (fs.accessSync as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.accessSync.mock.calls.length; expect(fsLookUps()).toBe(0); @@ -787,7 +791,8 @@ describe('options', () => { }); const existingFile = path.join(stopDir, 'cached.config.js'); const fsReadFileCalls = () => - (fs.promises.readFile as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.promises.readFile.mock.calls.length; expect(fsReadFileCalls()).toBe(0); @@ -836,7 +841,8 @@ describe('options', () => { }); const existingFile = path.join(stopDir, 'cached.config.js'); const fsReadFileCalls = () => - (fs.readFileSync as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.readFileSync.mock.calls.length; expect(fsReadFileCalls()).toBe(0); @@ -886,7 +892,8 @@ describe('options', () => { searchPlaces, }); const fsLookUps = () => - (fs.promises.access as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.promises.access.mock.calls.length; expect(fsLookUps()).toBe(0); @@ -915,7 +922,8 @@ describe('options', () => { searchPlaces, }); const fsLookUps = () => - (fs.accessSync as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.accessSync.mock.calls.length; expect(fsLookUps()).toBe(0); @@ -944,7 +952,8 @@ describe('options', () => { }); const existingFile = path.join(stopDir, 'cached.config.js'); const fsReadFileCalls = () => - (fs.promises.readFile as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.promises.readFile.mock.calls.length; expect(fsReadFileCalls()).toBe(0); @@ -970,7 +979,8 @@ describe('options', () => { }); const existingFile = path.join(stopDir, 'cached.config.js'); const fsReadFileCalls = () => - (fs.readFileSync as jest.Mock).mock.calls.length; + // @ts-expect-error + fs.readFileSync.mock.calls.length; expect(fsReadFileCalls()).toBe(0); @@ -1259,7 +1269,8 @@ describe('lilconfigSync', () => { const options = {stopDir: '/'}; const result = lilconfigSync('non-existent', options).search(); expect( - (fs.accessSync as jest.Mock).mock.calls.slice(-10), + // @ts-expect-error + fs.accessSync.mock.calls.slice(-10), ).toEqual([ ['/package.json'], ['/.non-existentrc.json'], @@ -1364,7 +1375,7 @@ describe('lilconfigSync', () => { const options = { loaders: { - '.js'(): void { + '.js'() { throw new LoaderError(); }, }, @@ -1571,9 +1582,8 @@ describe('lilconfig', () => { const filepath = path.join(dirname, 'test-app.js'); const relativeFilepath = filepath.slice(process.cwd().length + 1); const result = await lilconfig('test-app').load(relativeFilepath); - const ccResult = await cosmiconfig('test-app').load( - relativeFilepath, - ); + const ccResult = + await cosmiconfig('test-app').load(relativeFilepath); const expected = { config: {jsTest: true}, @@ -1588,9 +1598,8 @@ describe('lilconfig', () => { const filepath = path.join(dirname, 'test-app.cjs'); const relativeFilepath = filepath.slice(process.cwd().length + 1); const result = await lilconfig('test-app').load(relativeFilepath); - const ccResult = await cosmiconfig('test-app').load( - relativeFilepath, - ); + const ccResult = + await cosmiconfig('test-app').load(relativeFilepath); const expected = { config: {jsTest: true}, @@ -1605,9 +1614,8 @@ describe('lilconfig', () => { const filepath = path.join(dirname, 'test-app.json'); const relativeFilepath = filepath.slice(process.cwd().length + 1); const result = await lilconfig('test-app').load(relativeFilepath); - const ccResult = await cosmiconfig('test-app').load( - relativeFilepath, - ); + const ccResult = + await cosmiconfig('test-app').load(relativeFilepath); const expected = { config: {jsonTest: true}, @@ -1623,9 +1631,8 @@ describe('lilconfig', () => { const relativeFilepath = filepath.slice(process.cwd().length + 1); const result = await lilconfig('test-app').load(relativeFilepath); - const ccResult = await cosmiconfig('test-app').load( - relativeFilepath, - ); + const ccResult = + await cosmiconfig('test-app').load(relativeFilepath); const expected = { config: {noExtJsonFile: true}, @@ -1692,7 +1699,8 @@ describe('lilconfig', () => { options, ).search(); expect( - (fs.promises.access as jest.Mock).mock.calls.slice(-13), + // @ts-expect-error + fs.promises.access.mock.calls.slice(-13), ).toEqual([ ['/package.json'], ['/.non-existentrc.json'], @@ -1800,7 +1808,7 @@ describe('lilconfig', () => { const options = { loaders: { - '.js': (): void => { + '.js': () => { throw new LoaderError(); }, }, @@ -1811,7 +1819,7 @@ describe('lilconfig', () => { .catch(x => x); const ccResult = await cosmiconfig('maybeEmpty', options) .search(searchFrom) - .catch((x: unknown) => x); + .catch(x => x); expect(result instanceof LoaderError).toBeTruthy(); expect(ccResult instanceof LoaderError).toBeTruthy(); @@ -2009,7 +2017,12 @@ describe('npm package api', () => { const cc = require('cosmiconfig'); expect(typeof lc.defaultLoaders).toEqual(typeof cc.defaultLoaders); + expect(typeof lc.defaultLoadersSync).toEqual( + typeof cc.defaultLoadersSync, + ); + // @ts-expect-error: not in types expect(typeof lc.defaultLoadersAsync).toEqual( + // @ts-expect-error: not in types typeof cc.defaultLoadersAsync, ); @@ -2026,12 +2039,12 @@ describe('npm package api', () => { cosmiconfigSync, metaSearchPlaces, ...rest - }: { - [key: string]: unknown; }) => rest; /* eslint-enable @typescript-eslint/no-unused-vars */ + // @ts-expect-error: not in types expect(Object.keys(omitKnownDifferKeys(lc)).sort()).toEqual( + // @ts-expect-error: not in types Object.keys(omitKnownDifferKeys(cc)).sort(), ); }); diff --git a/src/spec/old-node-tests.uvu.js b/src/spec/old-node-tests.uvu.js index 355ab6f..99112e1 100644 --- a/src/spec/old-node-tests.uvu.js +++ b/src/spec/old-node-tests.uvu.js @@ -1,12 +1,13 @@ -import * as uvu from 'uvu'; -import * as assert from 'assert'; -import * as path from 'path'; -import {lilconfig, lilconfigSync, LoaderSync, TransformSync} from '..'; -import {cosmiconfig, cosmiconfigSync} from 'cosmiconfig'; -import {transpileModule} from 'typescript'; +const uvu = require('uvu'); +const assert = require('assert'); +const path = require('path'); +const {lilconfig, lilconfigSync} = require('..'); +const {cosmiconfig, cosmiconfigSync} = require('cosmiconfig'); +const {transpileModule} = require('typescript'); const dirname = path.join(__dirname, 'load'); -const tsLoader: LoaderSync = (_, content) => { +/** @type {import('../index').LoaderSync} */ +const tsLoader = (_, content) => { const res = transpileModule(content, {}).outputText; return eval(res); }; From 6a184ecf381b2b25a2ced2901a7c052e43d97d6c Mon Sep 17 00:00:00 2001 From: antonk52 Date: Fri, 16 Feb 2024 23:15:16 +0000 Subject: [PATCH 5/9] migrate linting and test running to js only --- eslint.config.js | 20 +- package-lock.json | 654 ---------------------------------------------- package.json | 2 - 3 files changed, 5 insertions(+), 671 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 3b30772..95297ac 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,24 +1,14 @@ const eslint = require('@eslint/js'); -const tseslint = require('typescript-eslint'); +const prettierPlugin = require('eslint-plugin-prettier/recommended'); -module.exports = tseslint.config( +module.exports = [ eslint.configs.recommended, - ...tseslint.configs.recommended, + prettierPlugin, { rules: { - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/ban-ts-comment': [ - 'error', - { - 'ts-expect-error': 'allow-with-description', - 'ts-ignore': true, - 'ts-nocheck': true, - 'ts-check': false, - minimumDescriptionLength: 3, - }, - ], + 'no-undef': 'off', 'no-constant-condition': 'off', 'prefer-const': 'error', }, }, -); +]; diff --git a/package-lock.json b/package-lock.json index ebe9fd8..62459d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,9 +17,7 @@ "eslint-plugin-prettier": "^5.1.3", "jest": "^29.7.0", "prettier": "^3.2.5", - "ts-jest": "29.1.2", "typescript": "^5.3.3", - "typescript-eslint": "^7.0.1", "uvu": "^0.5.6" }, "engines": { @@ -1610,24 +1608,12 @@ "pretty-format": "^29.0.0" } }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, "node_modules/@types/node": { "version": "14.18.63", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz", "integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==", "dev": true }, - "node_modules/@types/semver": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", - "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", - "dev": true - }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1649,220 +1635,6 @@ "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.1.tgz", - "integrity": "sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==", - "dev": true, - "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/type-utils": "7.0.1", - "@typescript-eslint/utils": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", - "debug": "^4.3.4", - "graphemer": "^1.4.0", - "ignore": "^5.2.4", - "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.1.tgz", - "integrity": "sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", - "debug": "^4.3.4" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", - "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.1.tgz", - "integrity": "sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==", - "dev": true, - "dependencies": { - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/utils": "7.0.1", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/types": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", - "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", - "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.1.tgz", - "integrity": "sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", - "semver": "^7.5.4" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", - "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.1", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -1973,15 +1745,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -2228,18 +1991,6 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "dependencies": { - "fast-json-stable-stringify": "2.x" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -2598,18 +2349,6 @@ "node": ">=0.3.1" } }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -3160,22 +2899,6 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3353,18 +3076,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -3380,26 +3091,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -5306,12 +4997,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", - "dev": true - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -5345,12 +5030,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -5366,15 +5045,6 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -6222,61 +5892,6 @@ "node": ">=8.0" } }, - "node_modules/ts-api-utils": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.2.1.tgz", - "integrity": "sha512-RIYA36cJn2WiH9Hy77hdF9r7oEwxAtB/TS9/S4Qd90Ap4z5FSiin5zEiTL44OII1Y3IIlEvxwxFUVgrHSZ/UpA==", - "dev": true, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "typescript": ">=4.2.0" - } - }, - "node_modules/ts-jest": { - "version": "29.1.2", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", - "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", - "dev": true, - "dependencies": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", - "jest-util": "^29.0.0", - "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "^7.5.3", - "yargs-parser": "^21.0.1" - }, - "bin": { - "ts-jest": "cli.js" - }, - "engines": { - "node": "^16.10.0 || ^18.0.0 || >=20.0.0" - }, - "peerDependencies": { - "@babel/core": ">=7.0.0-beta.0 <8", - "@jest/types": "^29.0.0", - "babel-jest": "^29.0.0", - "jest": "^29.0.0", - "typescript": ">=4.3 <6" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "@jest/types": { - "optional": true - }, - "babel-jest": { - "optional": true - }, - "esbuild": { - "optional": true - } - } - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -6323,31 +5938,6 @@ "node": ">=14.17" } }, - "node_modules/typescript-eslint": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.0.1.tgz", - "integrity": "sha512-aIquOfwHkGHrMSH57HxLT+1Qzp99YtGxEHXMRD+BXOc8fkuFBbA5BXsMYnoVXFuXOWBdXg8U2rN9Xe4p7LrPSQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/eslint-plugin": "7.0.1", - "@typescript-eslint/parser": "7.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -7791,24 +7381,12 @@ "pretty-format": "^29.0.0" } }, - "@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, "@types/node": { "version": "14.18.63", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz", "integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==", "dev": true }, - "@types/semver": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", - "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", - "dev": true - }, "@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -7830,127 +7408,6 @@ "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, - "@typescript-eslint/eslint-plugin": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.1.tgz", - "integrity": "sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==", - "dev": true, - "requires": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/type-utils": "7.0.1", - "@typescript-eslint/utils": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", - "debug": "^4.3.4", - "graphemer": "^1.4.0", - "ignore": "^5.2.4", - "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - } - }, - "@typescript-eslint/parser": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.1.tgz", - "integrity": "sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==", - "dev": true, - "requires": { - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", - "debug": "^4.3.4" - } - }, - "@typescript-eslint/scope-manager": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", - "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", - "dev": true, - "requires": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1" - } - }, - "@typescript-eslint/type-utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.1.tgz", - "integrity": "sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==", - "dev": true, - "requires": { - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/utils": "7.0.1", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" - } - }, - "@typescript-eslint/types": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", - "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", - "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", - "dev": true, - "requires": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, - "@typescript-eslint/utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.1.tgz", - "integrity": "sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==", - "dev": true, - "requires": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", - "semver": "^7.5.4" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", - "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", - "dev": true, - "requires": { - "@typescript-eslint/types": "7.0.1", - "eslint-visitor-keys": "^3.4.1" - } - }, "@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -8030,12 +7487,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, "babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -8215,15 +7666,6 @@ "update-browserslist-db": "^1.0.13" } }, - "bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "requires": { - "fast-json-stable-stringify": "2.x" - } - }, "bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -8471,15 +7913,6 @@ "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", "dev": true }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -8871,19 +8304,6 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, - "fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - } - }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -9015,15 +8435,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, "globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -9033,20 +8444,6 @@ "type-fest": "^0.20.2" } }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, "graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -10460,12 +9857,6 @@ "p-locate": "^5.0.0" } }, - "lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", - "dev": true - }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -10490,12 +9881,6 @@ "semver": "^7.5.3" } }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, "makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -10511,12 +9896,6 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, "micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -11113,29 +10492,6 @@ "is-number": "^7.0.0" } }, - "ts-api-utils": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.2.1.tgz", - "integrity": "sha512-RIYA36cJn2WiH9Hy77hdF9r7oEwxAtB/TS9/S4Qd90Ap4z5FSiin5zEiTL44OII1Y3IIlEvxwxFUVgrHSZ/UpA==", - "dev": true, - "requires": {} - }, - "ts-jest": { - "version": "29.1.2", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", - "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", - "dev": true, - "requires": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", - "jest-util": "^29.0.0", - "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "^7.5.3", - "yargs-parser": "^21.0.1" - } - }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -11163,16 +10519,6 @@ "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true }, - "typescript-eslint": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.0.1.tgz", - "integrity": "sha512-aIquOfwHkGHrMSH57HxLT+1Qzp99YtGxEHXMRD+BXOc8fkuFBbA5BXsMYnoVXFuXOWBdXg8U2rN9Xe4p7LrPSQ==", - "dev": true, - "requires": { - "@typescript-eslint/eslint-plugin": "7.0.1", - "@typescript-eslint/parser": "7.0.1" - } - }, "update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", diff --git a/package.json b/package.json index 078bcd5..9696938 100644 --- a/package.json +++ b/package.json @@ -33,9 +33,7 @@ "eslint-plugin-prettier": "^5.1.3", "jest": "^29.7.0", "prettier": "^3.2.5", - "ts-jest": "29.1.2", "typescript": "^5.3.3", - "typescript-eslint": "^7.0.1", "uvu": "^0.5.6" }, "funding": "https://github.com/sponsors/antonk52", From 14da69f27ff923f971e9541fd97b7c9600cfc91c Mon Sep 17 00:00:00 2001 From: antonk52 Date: Fri, 16 Feb 2024 23:23:13 +0000 Subject: [PATCH 6/9] update files to publish --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9696938..ad7edac 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "search" ], "files": [ - "dist/*" + "src/index.js", + "src/index.d.ts" ], "repository": { "type": "git", From 9b83744ce9d665bc8dde8cf762244e4d7f293054 Mon Sep 17 00:00:00 2001 From: antonk52 Date: Fri, 16 Feb 2024 23:30:23 +0000 Subject: [PATCH 7/9] fix ci --- .github/workflows/nodejs.yaml | 6 +++--- jest.config.js | 2 +- package.json | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nodejs.yaml b/.github/workflows/nodejs.yaml index 1734831..1b48fbf 100644 --- a/.github/workflows/nodejs.yaml +++ b/.github/workflows/nodejs.yaml @@ -4,7 +4,7 @@ on: [push] jobs: - build: + types: runs-on: ubuntu-latest strategy: matrix: @@ -17,8 +17,8 @@ jobs: node-version: ${{ matrix.node-version }} - name: install dependencies run: npm ci - - name: build - run: npm run build + - name: types + run: npm run types lint: runs-on: ubuntu-latest diff --git a/jest.config.js b/jest.config.js index f697ebf..76b57db 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,7 +6,7 @@ module.exports = { collectCoverageFrom: ['./src/index.js'], coverageThreshold: { global: { - branches: 97, + branches: 92, functions: 99, lines: 99, statements: 99, diff --git a/package.json b/package.json index ad7edac..81ef3a2 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "types": "src/index.d.ts", "scripts": { "test": "NODE_OPTIONS=--experimental-vm-modules ./node_modules/.bin/jest --coverage", - "lint": "eslint ./src/*.js" + "lint": "eslint ./src/*.js", + "types": "tsc --noEmit" }, "keywords": [ "cosmiconfig", From defde17b89491fa0d196b7a7ac4a0c6c85f4e7a7 Mon Sep 17 00:00:00 2001 From: antonk52 Date: Sat, 17 Feb 2024 14:05:34 +0000 Subject: [PATCH 8/9] return missing type for sets --- src/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.js b/src/index.js index bc88187..045794a 100644 --- a/src/index.js +++ b/src/index.js @@ -174,6 +174,7 @@ module.exports.lilconfig = function lilconfig(name, options) { filepath: '', }; + /** @type {Set} */ const visited = new Set(); let dir = searchFrom; dirLoop: while (true) { @@ -332,6 +333,7 @@ module.exports.lilconfigSync = function lilconfigSync(name, options) { filepath: '', }; + /** @type {Set} */ const visited = new Set(); let dir = searchFrom; dirLoop: while (true) { From 2b47a8ca534439211be60328d28bfd1ae0014b42 Mon Sep 17 00:00:00 2001 From: antonk52 Date: Sat, 17 Feb 2024 14:54:52 +0000 Subject: [PATCH 9/9] remove .d.ts from import paths --- src/index.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/index.js b/src/index.js index 045794a..1a3568d 100644 --- a/src/index.js +++ b/src/index.js @@ -37,9 +37,9 @@ function parentDir(p) { return path.dirname(p) || path.sep; } -/** @type {import('./index.d.ts').LoaderSync} */ +/** @type {import('./index').LoaderSync} */ const jsonLoader = (_, content) => JSON.parse(content); -/** @type {import('./index.d.ts').LoadersSync} */ +/** @type {import('./index').LoadersSync} */ const defaultLoadersSync = Object.freeze({ '.js': require, '.json': require, @@ -48,7 +48,7 @@ const defaultLoadersSync = Object.freeze({ }); module.exports.defaultLoadersSync = defaultLoadersSync; -/** @type {import('./index.d.ts').Loader} */ +/** @type {import('./index').Loader} */ const dynamicImport = async id => { try { const mod = await import(id); @@ -74,7 +74,7 @@ const dynamicImport = async id => { } }; -/** @type {import('./index.d.ts').Loaders} */ +/** @type {import('./index').Loaders} */ const defaultLoaders = Object.freeze({ '.js': dynamicImport, '.mjs': dynamicImport, @@ -86,12 +86,12 @@ module.exports.defaultLoaders = defaultLoaders; /** * @param {string} name - * @param {import('./index.d.ts').Options | import('./index.d.ts').OptionsSync} options + * @param {import('./index').Options | import('./index').OptionsSync} options * @param {boolean} sync - * @returns {Required} + * @returns {Required} */ function getOptions(name, options, sync) { - /** @type {Required} */ + /** @type {Required} */ const conf = { stopDir: os.homedir(), searchPlaces: getDefaultSearchPlaces(name, sync), @@ -138,7 +138,7 @@ function validateFilePath(filepath) { if (!filepath) throw new Error('load must pass a non-empty string'); } -/** @type {(loader: import('./index.d.ts').Loader, ext: string) => void} */ +/** @type {(loader: import('./index').Loader, ext: string) => void} */ function validateLoader(loader, ext) { if (!loader) throw new Error(`No loader specified for extension "${ext}"`); if (typeof loader !== 'function') @@ -151,7 +151,7 @@ const makeEmplace = enableCache => (c, filepath, res) => { return res; }; -/** @type {import('./index.d.ts').lilconfig} */ +/** @type {import('./index').lilconfig} */ module.exports.lilconfig = function lilconfig(name, options) { const { ignoreEmptySearchPlaces, @@ -168,7 +168,7 @@ module.exports.lilconfig = function lilconfig(name, options) { return { async search(searchFrom = process.cwd()) { - /** @type {import('./index.d.ts').LilconfigResult} */ + /** @type {import('./index').LilconfigResult} */ const result = { config: null, filepath: '', @@ -264,7 +264,7 @@ module.exports.lilconfig = function lilconfig(name, options) { }), ); } - /** @type {import('./index.d.ts').LilconfigResult} */ + /** @type {import('./index').LilconfigResult} */ const result = { config: null, filepath: absPath, @@ -310,7 +310,7 @@ module.exports.lilconfig = function lilconfig(name, options) { }; }; -/** @type {import('./index.d.ts').lilconfigSync} */ +/** @type {import('./index').lilconfigSync} */ module.exports.lilconfigSync = function lilconfigSync(name, options) { const { ignoreEmptySearchPlaces, @@ -327,7 +327,7 @@ module.exports.lilconfigSync = function lilconfigSync(name, options) { return { search(searchFrom = process.cwd()) { - /** @type {import('./index.d.ts').LilconfigResult} */ + /** @type {import('./index').LilconfigResult} */ const result = { config: null, filepath: '',