1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Enable the unicorn/prefer-negative-index ESLint plugin rule

Please see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md
This commit is contained in:
Jonas Jenwald 2023-03-21 11:37:46 +01:00
parent b119cde030
commit 96e34fbb7d
5 changed files with 7 additions and 6 deletions

View file

@ -471,12 +471,12 @@ function validateCSSFont(cssFontInfo) {
// See https://developer.mozilla.org/en-US/docs/Web/CSS/string.
if (/^".*"$/.test(fontFamily)) {
if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
if (/[^\\]"/.test(fontFamily.slice(1, -1))) {
warn(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
return false;
}
} else if (/^'.*'$/.test(fontFamily)) {
if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
if (/[^\\]'/.test(fontFamily.slice(1, -1))) {
warn(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
return false;
}