Enable the unicorn/prefer-string-replace-all ESLint plugin rule

Note that the `replaceAll` method still requires that a *global* regular expression is used, however by using this method it's immediately obvious when looking at the code that all occurrences will be replaced; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#parameters

Please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md
This commit is contained in:
Jonas Jenwald 2023-03-23 12:34:08 +01:00
parent 5f64621d46
commit 1fc09f0235
26 changed files with 58 additions and 56 deletions

View file

@ -1144,7 +1144,7 @@ class PDFDocument {
}
let fontFamily = descriptor.get("FontFamily");
// For example, "Wingdings 3" is not a valid font name in the css specs.
fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
fontFamily = fontFamily.replaceAll(/[ ]+(\d)/g, "$1");
const fontWeight = descriptor.get("FontWeight");
// Angle is expressed in degrees counterclockwise in PDF