eslint-plugin-tsdoc
Advanced tools
Comparing version 0.3.0 to 0.4.0
import { TSDocConfigFile } from '@microsoft/tsdoc-config'; | ||
export declare class ConfigCache { | ||
private static _cachedConfigs; | ||
private static _cachedPaths; | ||
/** | ||
@@ -8,4 +9,4 @@ * Node.js equivalent of performance.now(). | ||
private static _getTimeInMs; | ||
static getForSourceFile(sourceFilePath: string): TSDocConfigFile; | ||
static getForSourceFile(sourceFilePath: string, tsConfigRootDir?: string | undefined): TSDocConfigFile; | ||
} | ||
//# sourceMappingURL=ConfigCache.d.ts.map |
@@ -48,6 +48,9 @@ "use strict"; | ||
} | ||
static getForSourceFile(sourceFilePath) { | ||
static getForSourceFile(sourceFilePath, tsConfigRootDir) { | ||
const sourceFileFolder = path.dirname(path.resolve(sourceFilePath)); | ||
// First, determine the file to be loaded. If not found, the configFilePath will be an empty string. | ||
const configFilePath = tsdoc_config_1.TSDocConfigFile.findConfigPathForFolder(sourceFileFolder); | ||
// If the eslint config has specified where the tsconfig file is, use that path directly without probing the filesystem. | ||
const configFilePath = tsConfigRootDir | ||
? path.join(tsConfigRootDir, tsdoc_config_1.TSDocConfigFile.FILENAME) | ||
: tsdoc_config_1.TSDocConfigFile.findConfigPathForFolder(sourceFileFolder); | ||
// If configFilePath is an empty string, then we'll use the folder of sourceFilePath as our cache key | ||
@@ -108,2 +111,3 @@ // (instead of an empty string) | ||
ConfigCache._cachedConfigs = new Map(); | ||
ConfigCache._cachedPaths = new Map(); | ||
//# sourceMappingURL=ConfigCache.js.map |
@@ -29,7 +29,10 @@ "use strict"; | ||
create: (context) => { | ||
const sourceFilePath = context.getFilename(); | ||
const sourceFilePath = context.filename; | ||
// If eslint is configured with @typescript-eslint/parser, there is a parser option | ||
// to explicitly specify where the tsconfig file is. Use that if available. | ||
const tsConfigDir = context.parserOptions.tsconfigRootDir; | ||
Debug_1.Debug.log(`Linting: "${sourceFilePath}"`); | ||
const tsdocConfiguration = new tsdoc_1.TSDocConfiguration(); | ||
try { | ||
const tsdocConfigFile = ConfigCache_1.ConfigCache.getForSourceFile(sourceFilePath); | ||
const tsdocConfigFile = ConfigCache_1.ConfigCache.getForSourceFile(sourceFilePath, tsConfigDir); | ||
if (!tsdocConfigFile.fileNotFound) { | ||
@@ -36,0 +39,0 @@ if (tsdocConfigFile.hasErrors) { |
{ | ||
"name": "eslint-plugin-tsdoc", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "An ESLint plugin that validates TypeScript doc comments", | ||
@@ -25,4 +25,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@microsoft/tsdoc": "0.15.0", | ||
"@microsoft/tsdoc-config": "0.17.0" | ||
"@microsoft/tsdoc": "0.15.1", | ||
"@microsoft/tsdoc-config": "0.17.1" | ||
}, | ||
@@ -29,0 +29,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48916
20
650
+ Added@microsoft/tsdoc@0.15.1(transitive)
+ Added@microsoft/tsdoc-config@0.17.1(transitive)
- Removed@microsoft/tsdoc@0.15.0(transitive)
- Removed@microsoft/tsdoc-config@0.17.0(transitive)
Updated@microsoft/tsdoc@0.15.1