Skip to content

Commit

Permalink
fix: add TS import tag; fixes #1218
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Mar 28, 2024
1 parent 3e88f9a commit 9e9fed5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 9 deletions.
1 change: 1 addition & 0 deletions .README/rules/informative-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ For example, with `{ excludedTags: ["category"] }`, the following comment would
function computeTypes(node) {
// ...
}
```

No tags are excluded by default.

Expand Down
1 change: 1 addition & 0 deletions .README/rules/sort-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ a fixed order that doesn't change into the future, supply your own
'file',
'fileoverview',
'overview',
'import',

// Identifying (name, type)
'typedef',
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/check-tag-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ function quux (foo) {}
* @variation
* @version
* @yields
* @import
* @internal
* @overload
* @satisfies
Expand Down Expand Up @@ -1028,6 +1029,7 @@ function quux (foo) {}
* @variation
* @version
* @yields
* @import
* @internal
* @overload
* @satisfies
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/informative-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* [Options](#user-content-informative-docs-options)
* [`aliases`](#user-content-informative-docs-options-aliases)
* [`excludedTags`](#user-content-informative-docs-options-excludedtags)
* [`uselessWords`](#user-content-informative-docs-options-uselesswords)
* [Context and settings](#user-content-informative-docs-context-and-settings)
* [Failing examples](#user-content-informative-docs-failing-examples)
Expand Down Expand Up @@ -60,6 +61,7 @@ For example, with `{ excludedTags: ["category"] }`, the following comment would
function computeTypes(node) {
// ...
}
```

No tags are excluded by default.

Expand Down
19 changes: 10 additions & 9 deletions docs/rules/sort-tags.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/defaultTagOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const defaultTagOrder = [
'file',
'fileoverview',
'overview',
'import',

// Identifying (name, type)
'typedef',
Expand Down
3 changes: 3 additions & 0 deletions src/tagNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ const jsdocTags = {
const typeScriptTags = {
...jsdocTags,

// https://github.com/microsoft/TypeScript/issues/22160
import: [],

// https://www.typescriptlang.org/tsconfig/#stripInternal
internal: [],

Expand Down
4 changes: 4 additions & 0 deletions test/rules/assertions/checkTagNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@ export default {
{
code: `${ALL_TYPESCRIPT_TAGS_COMMENT}\nfunction quux (foo) {}`,
errors: [
{
line: lineCount(ALL_TYPESCRIPT_TAGS_COMMENT) - 4,
message: 'Invalid JSDoc tag name "import".',
},
{
line: lineCount(ALL_TYPESCRIPT_TAGS_COMMENT) - 3,
message: 'Invalid JSDoc tag name "internal".',
Expand Down

0 comments on commit 9e9fed5

Please sign in to comment.