Skip to content

Commit

Permalink
fix(check-values): avoid capturing carriage return with license che…
Browse files Browse the repository at this point in the history
…ck; fixes #783
  • Loading branch information
brettz9 committed Sep 7, 2021
1 parent bab8396 commit 98a6d35
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .README/rules/check-values.md
Expand Up @@ -31,7 +31,7 @@ If present as an array, will be used in place of SPDX identifiers.
A string to be converted into a `RegExp` (with `u` flag) and whose first
parenthetical grouping, if present, will match the portion of the license
description to check (if no grouping is present, then the whole portion
matched will be used). Defaults to `/([^\n]*)/gu`, i.e., the SPDX expression
matched will be used). Defaults to `/([^\n\r]*)/gu`, i.e., the SPDX expression
is expected before any line breaks.

Note that the `/` delimiters are optional, but necessary to add flags.
Expand Down
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -5737,7 +5737,7 @@ If present as an array, will be used in place of SPDX identifiers.
A string to be converted into a `RegExp` (with `u` flag) and whose first
parenthetical grouping, if present, will match the portion of the license
description to check (if no grouping is present, then the whole portion
matched will be used). Defaults to `/([^\n]*)/gu`, i.e., the SPDX expression
matched will be used). Defaults to `/([^\n\r]*)/gu`, i.e., the SPDX expression
is expected before any line breaks.

Note that the `/` delimiters are optional, but necessary to add flags.
Expand Down Expand Up @@ -5999,6 +5999,12 @@ function quux (foo) {
function quux (foo) {
}
/**
* @module test
* @license MIT
*/
'use strict';
````
Expand Down
2 changes: 1 addition & 1 deletion src/rules/checkValues.js
Expand Up @@ -12,7 +12,7 @@ export default iterateJsdoc(({
allowedLicenses = null,
allowedAuthors = null,
numericOnlyVariation = false,
licensePattern = '/([^\n]*)/gu',
licensePattern = '/([^\n\r]*)/gu',
} = options;

utils.forEachPreferredTag('version', (jsdocParameter, targetTagName) => {
Expand Down
9 changes: 9 additions & 0 deletions test/rules/assertions/checkValues.js
Expand Up @@ -433,5 +433,14 @@ export default {
}
`,
},
{
code: `
/**
* @module test
* @license MIT\r
*/
'use strict';
`,
},
],
};

0 comments on commit 98a6d35

Please sign in to comment.