Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/main' into default-value…
Browse files Browse the repository at this point in the history
…-inline-content
  • Loading branch information
octogonz committed Nov 26, 2024
2 parents d77ce2a + 0355420 commit 07deca4
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 40 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

25 changes: 25 additions & 0 deletions eslint-plugin/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
{
"name": "eslint-plugin-tsdoc",
"entries": [
{
"version": "0.4.0",
"tag": "eslint-plugin-tsdoc_v0.4.0",
"date": "Sat, 23 Nov 2024 00:23:35 GMT",
"comments": {
"patch": [
{
"comment": "Include CHANGELOG.md in published releases again"
}
],
"minor": [
{
"comment": "Leverage `parserOptions.tsConfigRootDir` to reduce file system probing. This field is commonly used when eslint is configured with `@typescript-eslint/parser`."
}
],
"dependency": [
{
"comment": "Updating dependency \"@microsoft/tsdoc\" to `0.15.1`"
},
{
"comment": "Updating dependency \"@microsoft/tsdoc-config\" to `0.17.1`"
}
]
}
},
{
"version": "0.3.0",
"tag": "eslint-plugin-tsdoc_v0.3.0",
Expand Down
13 changes: 12 additions & 1 deletion eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Change Log - eslint-plugin-tsdoc

This log was last generated on Tue, 28 May 2024 21:34:19 GMT and should not be manually modified.
This log was last generated on Sat, 23 Nov 2024 00:23:35 GMT and should not be manually modified.

## 0.4.0
Sat, 23 Nov 2024 00:23:35 GMT

### Minor changes

- Leverage `parserOptions.tsConfigRootDir` to reduce file system probing. This field is commonly used when eslint is configured with `@typescript-eslint/parser`.

### Patches

- Include CHANGELOG.md in published releases again

## 0.3.0
Tue, 28 May 2024 21:34:19 GMT
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-tsdoc",
"version": "0.3.0",
"version": "0.4.0",
"description": "An ESLint plugin that validates TypeScript doc comments",
"keywords": [
"TypeScript",
Expand Down
11 changes: 9 additions & 2 deletions eslint-plugin/src/ConfigCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const CACHE_MAX_SIZE: number = 100;
export class ConfigCache {
// findConfigPathForFolder() result --> loaded tsdoc.json configuration
private static _cachedConfigs: Map<string, ICachedConfig> = new Map<string, ICachedConfig>();
private static _cachedPaths: Map<string, string> = new Map();

/**
* Node.js equivalent of performance.now().
Expand All @@ -35,11 +36,17 @@ export class ConfigCache {
return seconds * 1000 + nanoseconds / 1000000;
}

public static getForSourceFile(sourceFilePath: string): TSDocConfigFile {
public static getForSourceFile(
sourceFilePath: string,
tsConfigRootDir?: string | undefined
): TSDocConfigFile {
const sourceFileFolder: string = path.dirname(path.resolve(sourceFilePath));

// First, determine the file to be loaded. If not found, the configFilePath will be an empty string.
const configFilePath: string = TSDocConfigFile.findConfigPathForFolder(sourceFileFolder);
// If the eslint config has specified where the tsconfig file is, use that path directly without probing the filesystem.
const configFilePath: string = tsConfigRootDir
? path.join(tsConfigRootDir, TSDocConfigFile.FILENAME)
: TSDocConfigFile.findConfigPathForFolder(sourceFileFolder);

// If configFilePath is an empty string, then we'll use the folder of sourceFilePath as our cache key
// (instead of an empty string)
Expand Down
7 changes: 5 additions & 2 deletions eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ const plugin: IPlugin = {
}
},
create: (context: eslint.Rule.RuleContext) => {
const sourceFilePath: string = context.getFilename();
const sourceFilePath: string = 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: string | undefined = context.parserOptions.tsconfigRootDir;
Debug.log(`Linting: "${sourceFilePath}"`);

const tsdocConfiguration: TSDocConfiguration = new TSDocConfiguration();

try {
const tsdocConfigFile: TSDocConfigFile = ConfigCache.getForSourceFile(sourceFilePath);
const tsdocConfigFile: TSDocConfigFile = ConfigCache.getForSourceFile(sourceFilePath, tsConfigDir);
if (!tsdocConfigFile.fileNotFound) {
if (tsdocConfigFile.hasErrors) {
context.report({
Expand Down
17 changes: 17 additions & 0 deletions tsdoc-config/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
{
"name": "@microsoft/tsdoc-config",
"entries": [
{
"version": "0.17.1",
"tag": "@microsoft/tsdoc-config_v0.17.1",
"date": "Sat, 23 Nov 2024 00:23:35 GMT",
"comments": {
"patch": [
{
"comment": "Include CHANGELOG.md in published releases again"
}
],
"dependency": [
{
"comment": "Updating dependency \"@microsoft/tsdoc\" to `0.15.1`"
}
]
}
},
{
"version": "0.17.0",
"tag": "@microsoft/tsdoc-config_v0.17.0",
Expand Down
9 changes: 8 additions & 1 deletion tsdoc-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - @microsoft/tsdoc-config

This log was last generated on Tue, 28 May 2024 21:34:19 GMT and should not be manually modified.
This log was last generated on Sat, 23 Nov 2024 00:23:35 GMT and should not be manually modified.

## 0.17.1
Sat, 23 Nov 2024 00:23:35 GMT

### Patches

- Include CHANGELOG.md in published releases again

## 0.17.0
Tue, 28 May 2024 21:34:19 GMT
Expand Down
2 changes: 1 addition & 1 deletion tsdoc-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/tsdoc-config",
"version": "0.17.0",
"version": "0.17.1",
"description": "A loader for the tsdoc.json file",
"keywords": [
"TypeScript",
Expand Down
12 changes: 12 additions & 0 deletions tsdoc/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@microsoft/tsdoc",
"entries": [
{
"version": "0.15.1",
"tag": "@microsoft/tsdoc_v0.15.1",
"date": "Sat, 23 Nov 2024 00:23:35 GMT",
"comments": {
"patch": [
{
"comment": "Include CHANGELOG.md in published releases again"
}
]
}
},
{
"version": "0.15.0",
"tag": "@microsoft/tsdoc_v0.15.0",
Expand Down
9 changes: 8 additions & 1 deletion tsdoc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - @microsoft/tsdoc

This log was last generated on Tue, 28 May 2024 21:34:19 GMT and should not be manually modified.
This log was last generated on Sat, 23 Nov 2024 00:23:35 GMT and should not be manually modified.

## 0.15.1
Sat, 23 Nov 2024 00:23:35 GMT

### Patches

- Include CHANGELOG.md in published releases again

## 0.15.0
Tue, 28 May 2024 21:34:19 GMT
Expand Down
2 changes: 1 addition & 1 deletion tsdoc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/tsdoc",
"version": "0.15.0",
"version": "0.15.1",
"description": "A parser for the TypeScript doc comment syntax",
"keywords": [
"TypeScript",
Expand Down

0 comments on commit 07deca4

Please sign in to comment.