Enable the unicorn/prefer-regexp-test
ESLint plugin rule
Please see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md
This commit is contained in:
parent
bf78ccac30
commit
20b9887476
@ -59,6 +59,7 @@
|
|||||||
"unicorn/prefer-dom-node-remove": "error",
|
"unicorn/prefer-dom-node-remove": "error",
|
||||||
"unicorn/prefer-logical-operator-over-ternary": "error",
|
"unicorn/prefer-logical-operator-over-ternary": "error",
|
||||||
"unicorn/prefer-modern-dom-apis": "error",
|
"unicorn/prefer-modern-dom-apis": "error",
|
||||||
|
"unicorn/prefer-regexp-test": "error",
|
||||||
"unicorn/prefer-string-starts-ends-with": "error",
|
"unicorn/prefer-string-starts-ends-with": "error",
|
||||||
|
|
||||||
// Possible errors
|
// Possible errors
|
||||||
|
@ -1005,7 +1005,7 @@ class Rename extends ContentObject {
|
|||||||
// is no colon.
|
// is no colon.
|
||||||
if (
|
if (
|
||||||
this[$content].toLowerCase().startsWith("xml") ||
|
this[$content].toLowerCase().startsWith("xml") ||
|
||||||
this[$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))
|
new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[$content])
|
||||||
) {
|
) {
|
||||||
warn("XFA - Rename: invalid XFA name");
|
warn("XFA - Rename: invalid XFA name");
|
||||||
}
|
}
|
||||||
|
@ -876,7 +876,7 @@ class Doc extends PDFObject {
|
|||||||
for (const [name, field] of this._fields.entries()) {
|
for (const [name, field] of this._fields.entries()) {
|
||||||
if (name.startsWith(fieldName)) {
|
if (name.startsWith(fieldName)) {
|
||||||
const finalPart = name.slice(len);
|
const finalPart = name.slice(len);
|
||||||
if (finalPart.match(pattern)) {
|
if (pattern.test(finalPart)) {
|
||||||
children.push(field);
|
children.push(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,9 +214,9 @@ window.onload = function () {
|
|||||||
const extra = match[4];
|
const extra = match[4];
|
||||||
|
|
||||||
gTestItems.push({
|
gTestItems.push({
|
||||||
pass: !state.match(/FAIL$/),
|
pass: !state.endsWith("FAIL"),
|
||||||
// only one of the following three should ever be true
|
// only one of the following three should ever be true
|
||||||
unexpected: !!state.match(/^TEST-UNEXPECTED/),
|
unexpected: state.startsWith("TEST-UNEXPECTED"),
|
||||||
random: random === "(EXPECTED RANDOM)",
|
random: random === "(EXPECTED RANDOM)",
|
||||||
skip: extra === " (SKIP)",
|
skip: extra === " (SKIP)",
|
||||||
url,
|
url,
|
||||||
|
Loading…
Reference in New Issue
Block a user