Skip to content

Commit 8df95e6

Browse files
committed
Some additional fixes
1 parent 60c12f9 commit 8df95e6

File tree

4 files changed

+19
-32
lines changed

4 files changed

+19
-32
lines changed

eslint-plugin/src/index.ts

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import {
33
TSDocParser,
44
TextRange,
55
TSDocConfiguration,
6-
StandardTags,
7-
TSDocTagDefinition,
8-
TSDocTagSyntaxKind,
96
ParserContext
107
} from "@microsoft/tsdoc";
118
import {
@@ -33,6 +30,7 @@ const plugin: IPlugin = {
3330
meta: {
3431
messages: {
3532
"error-loading-config-file": "Error loading TSDoc config file:\n{{details}}",
33+
"error-applying-config": "Error applying TSDoc configuration: {{details}}",
3634
...tsdocMessageIds
3735
},
3836
type: "problem",
@@ -53,38 +51,25 @@ const plugin: IPlugin = {
5351
if (!tsdocConfigFile.fileNotFound) {
5452
if (tsdocConfigFile.hasErrors) {
5553
context.report({
56-
loc: {
57-
line: 1,
58-
column: 1
59-
},
54+
loc: { line: 1, column: 1 },
6055
messageId: "error-loading-config-file",
6156
data: {
6257
details: tsdocConfigFile.getErrorSummary()
6358
}
6459
});
6560
}
6661

67-
tsdocConfigFile.configureParser(tsdocConfiguration);
68-
} else {
69-
// If we weren't able to find a tsdoc-config.json file, then by default we will use a lax configuration
70-
// that allows every standard tag regardless of standardization group.
71-
tsdocConfiguration.setSupportForTags(StandardTags.allDefinitions, true);
72-
73-
// Also allow the three AEDoc tags.
74-
tsdocConfiguration.addTagDefinitions([
75-
new TSDocTagDefinition({
76-
tagName: '@betaDocumentation',
77-
syntaxKind: TSDocTagSyntaxKind.ModifierTag
78-
}),
79-
new TSDocTagDefinition({
80-
tagName: '@internalRemarks',
81-
syntaxKind: TSDocTagSyntaxKind.BlockTag
82-
}),
83-
new TSDocTagDefinition({
84-
tagName: '@preapproved',
85-
syntaxKind: TSDocTagSyntaxKind.ModifierTag
86-
})
87-
], true);
62+
try {
63+
tsdocConfigFile.configureParser(tsdocConfiguration);
64+
} catch (e) {
65+
context.report({
66+
loc: { line: 1, column: 1 },
67+
messageId: "error-applying-config",
68+
data: {
69+
details: e.message
70+
}
71+
});
72+
}
8873
}
8974

9075
const tsdocParser: TSDocParser = new TSDocParser(tsdocConfiguration);

rush.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@
379379
{
380380
"packageName": "@microsoft/tsdoc-config",
381381
"projectFolder": "tsdoc-config",
382-
"shouldPublish": false
382+
"shouldPublish": true
383383
},
384384
{
385385
"packageName": "eslint-plugin-tsdoc",

tsdoc-config/src/TSDocConfigFile.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,9 @@ export class TSDocConfigFile {
325325
extendsFile.configureParser(configuration);
326326
}
327327

328-
// The apply this one
328+
// Then apply this one
329329
for (const tagDefinition of this.tagDefinitions) {
330330
configuration.addTagDefinition(tagDefinition);
331-
configuration.setSupportForTag(tagDefinition, true);
332331
}
333332
}
334333
}

tsdoc/src/configuration/TSDocConfiguration.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export class TSDocConfiguration {
3030
}
3131

3232
/**
33-
* The TSDoc block tag names that will be interpreted as modifier tags.
33+
* The TSDoc tags that are defined in this configuration.
34+
*
35+
* @remarks
36+
* The subset of "supported" tags is tracked by {@link TSDocConfiguration.supportedTagDefinitions}.
3437
*/
3538
public get tagDefinitions(): ReadonlyArray<TSDocTagDefinition> {
3639
return this._tagDefinitions;

0 commit comments

Comments
 (0)