Skip to content

Commit

Permalink
Add comment explaining semver.parse
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Nov 22, 2024
1 parent 514ae2f commit 1859807
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/template-linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ export default class TemplateLinter {
let sources = [];

try {
/**
* Semver parsing can throw errors, if the version is invalid,
* we want behave as if there was no version specified.
*
* (same as when errors are thrown from sourcesForDocument)
*/
const linterVersion = linterMeta?.version ? semver.parse(linterMeta.version) : null;

sources = this.sourcesForDocument(textDocument, linterVersion);
Expand Down

0 comments on commit 1859807

Please sign in to comment.