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:
parent
b119cde030
commit
96e34fbb7d
@ -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-negative-index": "error",
|
||||||
"unicorn/prefer-regexp-test": "error",
|
"unicorn/prefer-regexp-test": "error",
|
||||||
"unicorn/prefer-string-replace-all": "error",
|
"unicorn/prefer-string-replace-all": "error",
|
||||||
"unicorn/prefer-string-starts-ends-with": "error",
|
"unicorn/prefer-string-starts-ends-with": "error",
|
||||||
|
@ -471,12 +471,12 @@ function validateCSSFont(cssFontInfo) {
|
|||||||
|
|
||||||
// See https://developer.mozilla.org/en-US/docs/Web/CSS/string.
|
// See https://developer.mozilla.org/en-US/docs/Web/CSS/string.
|
||||||
if (/^".*"$/.test(fontFamily)) {
|
if (/^".*"$/.test(fontFamily)) {
|
||||||
if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
|
if (/[^\\]"/.test(fontFamily.slice(1, -1))) {
|
||||||
warn(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
|
warn(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (/^'.*'$/.test(fontFamily)) {
|
} 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}.`);
|
warn(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ class Type1CharString {
|
|||||||
subrNumber = this.stack.pop();
|
subrNumber = this.stack.pop();
|
||||||
const numArgs = this.stack.pop();
|
const numArgs = this.stack.pop();
|
||||||
if (subrNumber === 0 && numArgs === 3) {
|
if (subrNumber === 0 && numArgs === 3) {
|
||||||
const flexArgs = this.stack.splice(this.stack.length - 17, 17);
|
const flexArgs = this.stack.splice(-17, 17);
|
||||||
this.stack.push(
|
this.stack.push(
|
||||||
flexArgs[2] + flexArgs[0], // bcp1x + rpx
|
flexArgs[2] + flexArgs[0], // bcp1x + rpx
|
||||||
flexArgs[3] + flexArgs[1], // bcp1y + rpy
|
flexArgs[3] + flexArgs[1], // bcp1y + rpy
|
||||||
|
@ -26,7 +26,7 @@ const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
|
|||||||
|
|
||||||
function stripQuotes(str) {
|
function stripQuotes(str) {
|
||||||
if (str.startsWith("'") || str.startsWith('"')) {
|
if (str.startsWith("'") || str.startsWith('"')) {
|
||||||
return str.slice(1, str.length - 1);
|
return str.slice(1, -1);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -481,9 +481,9 @@ class XFAObject {
|
|||||||
// - URI
|
// - URI
|
||||||
// For now we don't handle URI other than "." (current document).
|
// For now we don't handle URI other than "." (current document).
|
||||||
if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
|
if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
|
||||||
somExpression = usehref.slice("#som(".length, usehref.length - 1);
|
somExpression = usehref.slice("#som(".length, -1);
|
||||||
} else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
|
} else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
|
||||||
somExpression = usehref.slice(".#som(".length, usehref.length - 1);
|
somExpression = usehref.slice(".#som(".length, -1);
|
||||||
} else if (usehref.startsWith("#")) {
|
} else if (usehref.startsWith("#")) {
|
||||||
id = usehref.slice(1);
|
id = usehref.slice(1);
|
||||||
} else if (usehref.startsWith(".#")) {
|
} else if (usehref.startsWith(".#")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user