Skip to content

Commit

Permalink
fix(valid-types): ensure requires checking works without module:;
Browse files Browse the repository at this point in the history
fixes #840
  • Loading branch information
brettz9 committed Feb 17, 2022
1 parent 9e78b57 commit 0cfdfd7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/getDefaultTagStructureForMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,10 @@ const getDefaultTagStructureForMode = (mode) => {
[
'requires', new Map([
// <someModuleName>
[
'nameContents', 'namepath-referencing',
],

[
'nameRequired', true,
],
Expand Down
1 change: 1 addition & 0 deletions src/rules/validTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default iterateJsdoc(({
if (tagName) {
// eslint-disable-next-line default-case
switch (tagName) {
case 'requires':
case 'module': {
if (!namepath.startsWith('module:')) {
handled = tryParsePathIgnoreError(`module:${namepath}`);
Expand Down
9 changes: 9 additions & 0 deletions test/rules/assertions/validTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1610,5 +1610,14 @@ export default {
ecmaVersion: 2_017,
},
},
{
code: `
/**
* @module module:scenarios/scenarios
* @requires scenarios/effects
*/
`,
ignoreReadme: true,
},
],
};

0 comments on commit 0cfdfd7

Please sign in to comment.