Skip to content

Commit

Permalink
Add .json ext to ts config path if necessary (resolves #480)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jan 29, 2024
1 parent 470437d commit fe3d17d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/knip/src/plugins/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const isEnabled: IsPluginEnabledCallback = ({ dependencies }) => hasDependency(d
const CONFIG_FILE_PATTERNS = ['tsconfig.json', 'tsconfig.*.json'];

const resolveExtensibleConfig = async (configFilePath: string) => {
const localConfig: TsConfigJson | undefined = await loadJSON(configFilePath);
const filePath = configFilePath.replace(/(\.json)?$/, '.json');
const localConfig: TsConfigJson | undefined = await loadJSON(filePath);

if (!localConfig) return;

Expand Down
2 changes: 1 addition & 1 deletion packages/knip/src/util/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { extname } from './path.js';
import { timerify } from './Performance.js';
import { jitiCJS, jitiESM } from './register.js';

export const FAKE_PATH = '__FAKE__';
export const FAKE_PATH = '__FAKE__.json';

const load = async (filePath: string) => {
// TODO: Turn into a config issue warning
Expand Down

0 comments on commit fe3d17d

Please sign in to comment.