mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
add eslint rule to disallow look behind regex feature, ignore in git and markdown fyi @lszomoru, @mjbvz
This commit is contained in:
@@ -104,6 +104,7 @@ export function stripAngleBrackets(link: string) {
|
||||
}
|
||||
|
||||
const linkPattern = /(\[((!\[[^\]]*?\]\(\s*)([^\s\(\)]+?)\s*\)\]|(?:\\\]|[^\]])*\])\(\s*)(([^\s\(\)]|\([^\s\(\)]*?\))+)\s*(".*?")?\)/g;
|
||||
// eslint-disable-next-line code-no-look-behind-regex
|
||||
const referenceLinkPattern = /((?<=^|[^\]])\[((?:\\\]|[^\]])+)\])(?!:)(?:[^\[]|$|\[\s*?([^\s\]]*?)\])/g;
|
||||
const definitionPattern = /^([\t ]*\[(?!\^)((?:\\\]|[^\]])+)\]:\s*)([^<]\S*|<[^>]+>)/gm;
|
||||
const inlineCodePattern = /(?:^|[^`])(`+)(?:.+?|.*?(?:(?:\r?\n).+?)*?)(?:\r?\n)?\1(?:$|[^`])/gm;
|
||||
|
||||
@@ -48,6 +48,7 @@ export class InMemoryDocument implements vscode.TextDocument {
|
||||
const before = this._contents.slice(0, offset);
|
||||
const newLines = before.match(/\r\n|\n/g);
|
||||
const line = newLines ? newLines.length : 0;
|
||||
// eslint-disable-next-line code-no-look-behind-regex
|
||||
const preCharacters = before.match(/(?<=\r\n|\n|^).*$/g);
|
||||
return new vscode.Position(line, preCharacters ? preCharacters[0].length : 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user