diff --git a/.eslintrc.js b/.eslintrc.js index 070c14b7e..8dd992a44 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -143,6 +143,7 @@ module.exports = { 'keyword-spacing': ['error', { 'before': true, 'after': true }], 'no-multi-spaces': ['error'], 'prefer-object-spread': ['error'], + 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }], // Regarding the keyword blacklist: // - err: We generally avoid using too many abbreviations, so it should diff --git a/packages/lib/SyncTargetOneDrive.ts b/packages/lib/SyncTargetOneDrive.ts index 34dfb420a..de2d99ff1 100644 --- a/packages/lib/SyncTargetOneDrive.ts +++ b/packages/lib/SyncTargetOneDrive.ts @@ -108,6 +108,7 @@ export default class SyncTargetOneDrive extends BaseSyncTarget { // the appDir might contain non-ASCII characters // /[^\u0021-\u00ff]/ is used in Node.js to detect the unescaped characters. // See https://github.com/nodejs/node/blob/bbbf97b6dae63697371082475dc8651a6a220336/lib/_http_client.js#L176 + // eslint-disable-next-line prefer-regex-literals -- Old code before rule was applied const baseDir = RegExp(/[^\u0021-\u00ff]/).exec(appDir) !== null ? encodeURI(appDir) : appDir; const fileApi = new FileApi(baseDir, new FileApiDriverOneDrive(this.api())); fileApi.setSyncTargetId(this.syncTargetId()); diff --git a/packages/renderer/MdToHtml/setupLinkify.ts b/packages/renderer/MdToHtml/setupLinkify.ts index 36b89cd21..c03f1db0c 100644 --- a/packages/renderer/MdToHtml/setupLinkify.ts +++ b/packages/renderer/MdToHtml/setupLinkify.ts @@ -6,6 +6,7 @@ export default function(markdownIt: any) { const tail = text.slice(pos); if (!self.re.file) { // matches all local file URI on Win/Unix/MacOS systems including reserved characters in some OS (i.e. no OS specific sanity check) + // eslint-disable-next-line prefer-regex-literals -- Old code before rule was applied self.re.file = new RegExp('^[\\/]{2,3}[\\S]+'); } if (self.re.file.test(tail)) {