Enable the unicorn/prefer-starts-ends-with
ESLint plugin rule
This complements the existing `mozilla/use-includes-instead-of-indexOf` plugin rule, by also disallowing unnecessary regular expressions when comparing strings. Please see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/prefer-starts-ends-with.md for additional information.
This commit is contained in:
parent
f6ffc2bf37
commit
bc31a4be5d
@ -38,6 +38,7 @@
|
|||||||
"no-unsanitized/method": "error",
|
"no-unsanitized/method": "error",
|
||||||
"no-unsanitized/property": "error",
|
"no-unsanitized/property": "error",
|
||||||
"unicorn/no-array-instanceof": "error",
|
"unicorn/no-array-instanceof": "error",
|
||||||
|
"unicorn/prefer-starts-ends-with": "error",
|
||||||
|
|
||||||
// Possible errors
|
// Possible errors
|
||||||
"for-direction": "error",
|
"for-direction": "error",
|
||||||
|
@ -78,7 +78,7 @@ function extractFilenameFromHeader(getResponseHeader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createResponseStatusError(status, url) {
|
function createResponseStatusError(status, url) {
|
||||||
if (status === 404 || (status === 0 && /^file:/.test(url))) {
|
if (status === 404 || (status === 0 && url.startsWith("file:"))) {
|
||||||
return new MissingPDFException('Missing PDF "' + url + '".');
|
return new MissingPDFException('Missing PDF "' + url + '".');
|
||||||
}
|
}
|
||||||
return new UnexpectedResponseException(
|
return new UnexpectedResponseException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user