forked from mysticatea/eslint-plugin-node
-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add "tsconfigPath" option to ts ext mapping
- Loading branch information
Showing
8 changed files
with
145 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use strict" | ||
|
||
const { getTsconfig, parseTsconfig } = require("get-tsconfig") | ||
const fsCache = new Map() | ||
|
||
/** | ||
* Attempts to get the ExtensionMap from the tsconfig given the path to the tsconfig file. | ||
* | ||
* @param {string} filename - The path to the tsconfig.json file | ||
* @returns {import("get-tsconfig").TsConfigJsonResolved} | ||
*/ | ||
function getTSConfig(filename) { | ||
return parseTsconfig(filename, fsCache) | ||
} | ||
|
||
/** | ||
* Attempts to get the ExtensionMap from the tsconfig of a given file. | ||
* | ||
* @param {string} filename - The path to the file we need to find the tsconfig.json of | ||
* @returns {import("get-tsconfig").TsConfigResult} | ||
*/ | ||
function getTSConfigForFile(filename) { | ||
return getTsconfig(filename, "tsconfig.json", fsCache) | ||
} | ||
|
||
module.exports = { | ||
getTSConfig, | ||
getTSConfigForFile, | ||
} | ||
|
||
module.exports.schema = { type: "string" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters