diff --git a/src/annotations/annotations.ts b/src/annotations/annotations.ts index b3004cb..e9ea3f4 100644 --- a/src/annotations/annotations.ts +++ b/src/annotations/annotations.ts @@ -49,7 +49,7 @@ interface IRenderOptions extends DecorationInstanceRenderOptions, ThemableDecora const defaultHeatmapHotColor = '#f66a0a'; const defaultHeatmapColdColor = '#0a60f6'; -const escapeMarkdownRegEx = /[`\>\#\*\_\-\+\.]/g; +const escapeMarkdownRegex = /[`\>\#\*\_\-\+\.]/g; // const sampleMarkdown = '## message `not code` *not important* _no underline_ \n> don\'t quote me \n- don\'t list me \n+ don\'t list me \n1. don\'t list me \nnot h1 \n=== \nnot h2 \n---\n***\n---\n___'; const markdownHeaderReplacement = `${GlyphChars.ZeroWidthSpace}===`; @@ -153,7 +153,7 @@ export class Annotations { message // Escape markdown - .replace(escapeMarkdownRegEx, '\\$&') + .replace(escapeMarkdownRegex, '\\$&') // Escape markdown header (since the above regex won't match it) .replace(/^===/gm, markdownHeaderReplacement) // Keep under the same block-quote diff --git a/src/git/remotes/bitbucket-server.ts b/src/git/remotes/bitbucket-server.ts index 8a72a12..4ce22e1 100644 --- a/src/git/remotes/bitbucket-server.ts +++ b/src/git/remotes/bitbucket-server.ts @@ -2,8 +2,8 @@ import { Range } from 'vscode'; import { RemoteProvider } from './provider'; -const issueEnricherRegEx = /(^|\s)(issue #([0-9]+))\b/gi; -const prEnricherRegEx = /(^|\s)(pull request #([0-9]+))\b/gi; +const issueEnricherRegex = /(^|\s)(issue #([0-9]+))\b/gi; +const prEnricherRegex = /(^|\s)(pull request #([0-9]+))\b/gi; export class BitbucketServerRemote extends RemoteProvider { constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) { @@ -27,9 +27,9 @@ export class BitbucketServerRemote extends RemoteProvider { return ( message // Matches issue #123 - .replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`) + .replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`) // Matches pull request #123 - .replace(prEnricherRegEx, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`) + .replace(prEnricherRegex, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`) ); } diff --git a/src/git/remotes/bitbucket.ts b/src/git/remotes/bitbucket.ts index bb18dca..0446425 100644 --- a/src/git/remotes/bitbucket.ts +++ b/src/git/remotes/bitbucket.ts @@ -2,8 +2,8 @@ import { Range } from 'vscode'; import { RemoteProvider } from './provider'; -const issueEnricherRegEx = /(^|\s)(issue #([0-9]+))\b/gi; -const prEnricherRegEx = /(^|\s)(pull request #([0-9]+))\b/gi; +const issueEnricherRegex = /(^|\s)(issue #([0-9]+))\b/gi; +const prEnricherRegex = /(^|\s)(pull request #([0-9]+))\b/gi; export class BitbucketRemote extends RemoteProvider { constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) { @@ -22,9 +22,9 @@ export class BitbucketRemote extends RemoteProvider { return ( message // Matches issue #123 - .replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`) + .replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`) // Matches pull request #123 - .replace(prEnricherRegEx, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`) + .replace(prEnricherRegex, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`) ); } diff --git a/src/git/remotes/github.ts b/src/git/remotes/github.ts index 1673f2b..72c0258 100644 --- a/src/git/remotes/github.ts +++ b/src/git/remotes/github.ts @@ -2,8 +2,8 @@ import { Range } from 'vscode'; import { RemoteProvider } from './provider'; -const issueEnricherRegEx = /(^|\s)((?:#|gh-)([0-9]+))\b/gi; -const issueEnricher3rdParyRegEx = /\b((\w+-?\w+(?!-)\/\w+-?\w+(?!-))#([0-9]+))\b/g; +const issueEnricherRegex = /(^|\s)((?:#|gh-)([0-9]+))\b/gi; +const issueEnricher3rdParyRegex = /\b((\w+-?\w+(?!-)\/\w+-?\w+(?!-))#([0-9]+))\b/g; export class GitHubRemote extends RemoteProvider { constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) { @@ -22,10 +22,10 @@ export class GitHubRemote extends RemoteProvider { return ( message // Matches #123 or gh-123 or GH-123 - .replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`) + .replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`) // Matches eamodio/vscode-gitlens#123 .replace( - issueEnricher3rdParyRegEx, + issueEnricher3rdParyRegex, `[$1](${this.protocol}://${this.domain}/$2/issues/$3 "Open Issue #$3 from $2")` ) ); diff --git a/src/git/remotes/gitlab.ts b/src/git/remotes/gitlab.ts index e424bfd..742da2a 100644 --- a/src/git/remotes/gitlab.ts +++ b/src/git/remotes/gitlab.ts @@ -2,7 +2,7 @@ import { Range } from 'vscode'; import { RemoteProvider } from './provider'; -const issueEnricherRegEx = /(^|\s)(#([0-9]+))\b/gi; +const issueEnricherRegex = /(^|\s)(#([0-9]+))\b/gi; export class GitLabRemote extends RemoteProvider { constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) { @@ -19,7 +19,7 @@ export class GitLabRemote extends RemoteProvider { enrichMessage(message: string): string { // Matches #123 - return message.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`); + return message.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`); } protected getUrlForBranches(): string { diff --git a/src/system/string.ts b/src/system/string.ts index 798f9d4..55530b4 100644 --- a/src/system/string.ts +++ b/src/system/string.ts @@ -154,11 +154,11 @@ export namespace Strings { } // Removes \ / : * ? " < > | and C0 and C1 control codes - const illegalCharsForFSRegEx = /[\\/:*?"<>|\x00-\x1f\x80-\x9f]/g; + const illegalCharsForFSRegex = /[\\/:*?"<>|\x00-\x1f\x80-\x9f]/g; export function sanitizeForFileSystem(s: string, replacement: string = '_') { if (!s) return s; - return s.replace(illegalCharsForFSRegEx, replacement); + return s.replace(illegalCharsForFSRegex, replacement); } export function sha1(s: string, encoding: HexBase64Latin1Encoding = 'base64'): string { diff --git a/src/ui/shared/colors.ts b/src/ui/shared/colors.ts index 3f896a6..710a9ba 100644 --- a/src/ui/shared/colors.ts +++ b/src/ui/shared/colors.ts @@ -1,4 +1,4 @@ -const cssColorRegEx = /^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d\.]+%?)?\))$/i; +const cssColorRegex = /^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d\.]+%?)?\))$/i; function adjustLight(color: number, amount: number) { const cc = color + amount; @@ -31,7 +31,7 @@ export function opacity(color: string, percentage: number) { export function toRgba(color: string) { color = color.trim(); - const result = cssColorRegEx.exec(color); + const result = cssColorRegex.exec(color); if (result == null) return null; if (result[1] === '#') {