mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
fix: rollback regexp eslint changes
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
"no-prototype-builtins": "off",
|
||||
"no-inner-declarations": "off",
|
||||
"no-constant-condition": "off",
|
||||
"no-useless-escape": "off",
|
||||
"@nrwl/nx/enforce-module-boundaries": [
|
||||
"error",
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ export function parseRepeat(value: string, start = 0, keyword = parseKeyword(val
|
||||
return null;
|
||||
}
|
||||
|
||||
const unitRegEx = /\s*([+-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][+-]?\d+)?)([a-zA-Z]+|%)?\s*/gy;
|
||||
const unitRegEx = /\s*([\+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][\+\-]?\d+)?)([a-zA-Z]+|%)?\s*/gy;
|
||||
export function parseUnit(text: string, start = 0): Parsed<Unit<string>> {
|
||||
unitRegEx.lastIndex = start;
|
||||
const result = unitRegEx.exec(text);
|
||||
@ -743,7 +743,7 @@ export function parseSimpleIdentifierSelector(text: string, start = 0): Parsed<T
|
||||
return { start, end, value };
|
||||
}
|
||||
|
||||
const attributeSelectorRegEx = /\[\s*([_-\w][_-\w\d]*)\s*(?:(=|\^=|\$=|\*=|~=|\|=)\s*(?:([_-\w][_-\w\d]*)|"((?:[^\\"]|\\(?:"|n|r|f|\\|0-9a-f))*)"|'((?:[^\\']|\\(?:'|n|r|f|\\|0-9a-f))*)')\s*)?\]/gy;
|
||||
const attributeSelectorRegEx = /\[\s*([_-\w][_-\w\d]*)\s*(?:(=|\^=|\$=|\*=|\~=|\|=)\s*(?:([_-\w][_-\w\d]*)|"((?:[^\\"]|\\(?:"|n|r|f|\\|0-9a-f))*)"|'((?:[^\\']|\\(?:'|n|r|f|\\|0-9a-f))*)')\s*)?\]/gy;
|
||||
export function parseAttributeSelector(text: string, start: number): Parsed<AttributeSelector> {
|
||||
attributeSelectorRegEx.lastIndex = start;
|
||||
const result = attributeSelectorRegEx.exec(text);
|
||||
@ -852,13 +852,13 @@ export interface QualifiedRule {
|
||||
|
||||
const whitespaceRegEx = /[\s\t\n\r\f]*/gmy;
|
||||
|
||||
const singleQuoteStringRegEx = /'((?:[^\n\r\f']|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?'|$)/gmy; // Besides $n, parse escape
|
||||
const doubleQuoteStringRegEx = /"((?:[^\n\r\f"]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?"|$)/gmy; // Besides $n, parse escape
|
||||
const singleQuoteStringRegEx = /'((?:[^\n\r\f\']|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?'|$)/gmy; // Besides $n, parse escape
|
||||
const doubleQuoteStringRegEx = /"((?:[^\n\r\f\"]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?"|$)/gmy; // Besides $n, parse escape
|
||||
|
||||
const commentRegEx = /(\/\*(?:[^*]|\*[^/])*\*\/)/gmy;
|
||||
const numberRegEx = /[+-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][+-]?\d+)?/gmy;
|
||||
const commentRegEx = /(\/\*(?:[^\*]|\*[^\/])*\*\/)/gmy;
|
||||
const numberRegEx = /[\+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][\+\-]?\d+)?/gmy;
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const nameRegEx = /-?(?:(?:[a-zA-Z_]|[^\x00-\x7F]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))(?:[a-zA-Z_0-9-]*|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)/gmy;
|
||||
const nameRegEx = /-?(?:(?:[a-zA-Z_]|[^\x00-\x7F]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))(?:[a-zA-Z_0-9\-]*|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)/gmy;
|
||||
// const nonQuoteURLRegEx = /(:?[^\)\s\t\n\r\f\'\"\(]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*/gym; // TODO: non-printable code points omitted
|
||||
|
||||
type InputToken = '(' | ')' | '{' | '}' | '[' | ']' | ':' | ';' | ',' | ' ' | '^=' | '|=' | '$=' | '*=' | '~=' | '<!--' | '-->' | undefined | /* <EOF-token> */ InputTokenObject | FunctionInputToken | FunctionToken | SimpleBlock | AtKeywordToken;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// regex that contains all symbols applicable for expression used to AI detect an expression.
|
||||
const expressionSymbolsRegex = /[+-*/%?:<>=!|&()^~]/;
|
||||
const expressionSymbolsRegex = /[\+\-\*\/%\?:<>=!\|&\(\)^~]/;
|
||||
|
||||
export namespace bindingConstants {
|
||||
export const sourceProperty = 'sourceProperty';
|
||||
|
@ -11,7 +11,7 @@ export const RESOURCE_PREFIX = 'res://';
|
||||
export const FILE_PREFIX = 'file:///';
|
||||
|
||||
export function escapeRegexSymbols(source: string): string {
|
||||
const escapeRegex = /[-[]\/{}()*+?.\\^$|]/g;
|
||||
const escapeRegex = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
|
||||
|
||||
return source.replace(escapeRegex, '\\$&');
|
||||
}
|
||||
|
Reference in New Issue
Block a user