Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/eslint-plugin-jsdoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v48.8.1
Choose a base ref
...
head repository: gajus/eslint-plugin-jsdoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v48.8.2
Choose a head ref
  • 1 commit
  • 6 files changed
  • 1 contributor

Commits on Jul 20, 2024

  1. fix(require-template, check-template-names): avoid erring out wit…

    …h missing or bad typedef type; partial fix for #1269
    brettz9 committed Jul 20, 2024
    Copy the full SHA
    736a23b View commit details
5 changes: 5 additions & 0 deletions docs/rules/check-template-names.md
Original file line number Diff line number Diff line change
@@ -125,5 +125,10 @@ export type Extras<D, U, V> = [D, U, V | undefined];
* @typedef {[D, U, V | undefined]} Extras
* @typedef {[D, U, V | undefined]} Extras
*/

/**
* @typedef Foo
* @prop {string} bar
*/
````

5 changes: 5 additions & 0 deletions docs/rules/require-template.md
Original file line number Diff line number Diff line change
@@ -143,5 +143,10 @@ export type Extras<D, U, V> = [D, U, V | undefined];
* @typedef {[D, U, V | undefined]} Extras
* @typedef {[D, U, V | undefined]} Extras
*/

/**
* @typedef Foo
* @prop {string} bar
*/
````

13 changes: 10 additions & 3 deletions src/rules/checkTemplateNames.js
Original file line number Diff line number Diff line change
@@ -65,9 +65,16 @@ export default iterateJsdoc(({
}

const potentialType = typedefTags[0].type;
const parsedType = mode === 'permissive' ?
tryParseType(/** @type {string} */ (potentialType)) :
parseType(/** @type {string} */ (potentialType), mode)

let parsedType;
try {
parsedType = mode === 'permissive' ?
tryParseType(/** @type {string} */ (potentialType)) :
parseType(/** @type {string} */ (potentialType), mode)
} catch {
// Todo: Should handle types in @prop/erty
return;
}

traverse(parsedType, (nde) => {
const {
13 changes: 10 additions & 3 deletions src/rules/requireTemplate.js
Original file line number Diff line number Diff line change
@@ -76,9 +76,16 @@ export default iterateJsdoc(({
}

const potentialType = typedefTags[0].type;
const parsedType = mode === 'permissive' ?
tryParseType(/** @type {string} */ (potentialType)) :
parseType(/** @type {string} */ (potentialType), mode)

let parsedType;
try {
parsedType = mode === 'permissive' ?
tryParseType(/** @type {string} */ (potentialType)) :
parseType(/** @type {string} */ (potentialType), mode)
} catch {
// Todo: Should handle types in @prop/erty
return;
}

traverse(parsedType, (nde) => {
const {
8 changes: 8 additions & 0 deletions test/rules/assertions/checkTemplateNames.js
Original file line number Diff line number Diff line change
@@ -193,5 +193,13 @@ export default {
*/
`,
},
{
code: `
/**
* @typedef Foo
* @prop {string} bar
*/
`,
},
],
};
8 changes: 8 additions & 0 deletions test/rules/assertions/requireTemplate.js
Original file line number Diff line number Diff line change
@@ -205,5 +205,13 @@ export default {
*/
`,
},
{
code: `
/**
* @typedef Foo
* @prop {string} bar
*/
`,
},
],
};