1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Tools: Apply prefer-regex-literals eslint rule

This commit is contained in:
Laurent Cozic 2023-07-03 17:11:12 +01:00
parent 2289e3297a
commit 0c76b731e7
3 changed files with 3 additions and 0 deletions

View File

@ -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

View File

@ -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());

View File

@ -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)) {