mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-19 06:10:56 +08:00
Merge branch 'eslint_rollback' of github.com:Akylas/NativeScript
This commit is contained in:
@ -25,6 +25,7 @@
|
|||||||
"no-prototype-builtins": "off",
|
"no-prototype-builtins": "off",
|
||||||
"no-inner-declarations": "off",
|
"no-inner-declarations": "off",
|
||||||
"no-constant-condition": "off",
|
"no-constant-condition": "off",
|
||||||
|
"no-useless-escape": "off",
|
||||||
"@nrwl/nx/enforce-module-boundaries": [
|
"@nrwl/nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ export function parseRepeat(value: string, start = 0, keyword = parseKeyword(val
|
|||||||
return null;
|
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>> {
|
export function parseUnit(text: string, start = 0): Parsed<Unit<string>> {
|
||||||
unitRegEx.lastIndex = start;
|
unitRegEx.lastIndex = start;
|
||||||
const result = unitRegEx.exec(text);
|
const result = unitRegEx.exec(text);
|
||||||
@ -743,7 +743,7 @@ export function parseSimpleIdentifierSelector(text: string, start = 0): Parsed<T
|
|||||||
return { start, end, value };
|
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> {
|
export function parseAttributeSelector(text: string, start: number): Parsed<AttributeSelector> {
|
||||||
attributeSelectorRegEx.lastIndex = start;
|
attributeSelectorRegEx.lastIndex = start;
|
||||||
const result = attributeSelectorRegEx.exec(text);
|
const result = attributeSelectorRegEx.exec(text);
|
||||||
@ -852,13 +852,13 @@ export interface QualifiedRule {
|
|||||||
|
|
||||||
const whitespaceRegEx = /[\s\t\n\r\f]*/gmy;
|
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 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 doubleQuoteStringRegEx = /"((?:[^\n\r\f\"]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?"|$)/gmy; // Besides $n, parse escape
|
||||||
|
|
||||||
const commentRegEx = /(\/\*(?:[^*]|\*[^/])*\*\/)/gmy;
|
const commentRegEx = /(\/\*(?:[^\*]|\*[^\/])*\*\/)/gmy;
|
||||||
const numberRegEx = /[+-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][+-]?\d+)?/gmy;
|
const numberRegEx = /[\+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][\+\-]?\d+)?/gmy;
|
||||||
// eslint-disable-next-line no-control-regex
|
// 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
|
// 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;
|
type InputToken = '(' | ')' | '{' | '}' | '[' | ']' | ':' | ';' | ',' | ' ' | '^=' | '|=' | '$=' | '*=' | '~=' | '<!--' | '-->' | undefined | /* <EOF-token> */ InputTokenObject | FunctionInputToken | FunctionToken | SimpleBlock | AtKeywordToken;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable prefer-rest-params */
|
||||||
declare let __startCPUProfiler: any;
|
declare let __startCPUProfiler: any;
|
||||||
declare let __stopCPUProfiler: any;
|
declare let __stopCPUProfiler: any;
|
||||||
|
|
||||||
@ -98,10 +99,10 @@ export function isRunning(name: string): boolean {
|
|||||||
function countersProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
function countersProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
||||||
profileNames.push(name);
|
profileNames.push(name);
|
||||||
|
|
||||||
return <any>function (...args) {
|
return <any>function () {
|
||||||
start(name);
|
start(name);
|
||||||
try {
|
try {
|
||||||
return fn(...args);
|
return fn.apply(this, arguments);
|
||||||
} finally {
|
} finally {
|
||||||
stop(name);
|
stop(name);
|
||||||
}
|
}
|
||||||
@ -110,19 +111,19 @@ function countersProfileFunctionFactory<F extends Function>(fn: F, name: string,
|
|||||||
|
|
||||||
function timelineProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
function timelineProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
||||||
return type === MemberType.Instance
|
return type === MemberType.Instance
|
||||||
? <any>function (...args) {
|
? <any>function () {
|
||||||
const start = time();
|
const start = time();
|
||||||
try {
|
try {
|
||||||
return fn(...args);
|
return fn.apply(this, arguments);
|
||||||
} finally {
|
} finally {
|
||||||
const end = time();
|
const end = time();
|
||||||
console.log(`Timeline: Modules: ${name} ${this} (${start}ms. - ${end}ms.)`);
|
console.log(`Timeline: Modules: ${name} ${this} (${start}ms. - ${end}ms.)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
: function (...args) {
|
: function () {
|
||||||
const start = time();
|
const start = time();
|
||||||
try {
|
try {
|
||||||
return fn(...args);
|
return fn.apply(this, arguments);
|
||||||
} finally {
|
} finally {
|
||||||
const end = time();
|
const end = time();
|
||||||
console.log(`Timeline: Modules: ${name} (${start}ms. - ${end}ms.)`);
|
console.log(`Timeline: Modules: ${name} (${start}ms. - ${end}ms.)`);
|
||||||
|
@ -100,15 +100,17 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
|
|||||||
_this.cancel();
|
_this.cancel();
|
||||||
};
|
};
|
||||||
const _then = promise.then;
|
const _then = promise.then;
|
||||||
promise.then = function (...args) {
|
promise.then = function () {
|
||||||
const r = _then(...args);
|
// eslint-disable-next-line prefer-rest-params
|
||||||
|
const r = _then.apply(promise, arguments);
|
||||||
_this.fixupAnimationPromise(r);
|
_this.fixupAnimationPromise(r);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
};
|
};
|
||||||
const _catch = promise.catch;
|
const _catch = promise.catch;
|
||||||
promise.catch = function (...args) {
|
promise.catch = function () {
|
||||||
const r = _catch(...args);
|
// eslint-disable-next-line prefer-rest-params
|
||||||
|
const r = _catch.apply(promise, arguments);
|
||||||
_this.fixupAnimationPromise(r);
|
_this.fixupAnimationPromise(r);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// regex that contains all symbols applicable for expression used to AI detect an expression.
|
// regex that contains all symbols applicable for expression used to AI detect an expression.
|
||||||
const expressionSymbolsRegex = /[+-*/%?:<>=!|&()^~]/;
|
const expressionSymbolsRegex = /[\+\-\*\/%\?:<>=!\|&\(\)^~]/;
|
||||||
|
|
||||||
export namespace bindingConstants {
|
export namespace bindingConstants {
|
||||||
export const sourceProperty = 'sourceProperty';
|
export const sourceProperty = 'sourceProperty';
|
||||||
|
@ -11,7 +11,7 @@ export const RESOURCE_PREFIX = 'res://';
|
|||||||
export const FILE_PREFIX = 'file:///';
|
export const FILE_PREFIX = 'file:///';
|
||||||
|
|
||||||
export function escapeRegexSymbols(source: string): string {
|
export function escapeRegexSymbols(source: string): string {
|
||||||
const escapeRegex = /[-[]\/{}()*+?.\\^$|]/g;
|
const escapeRegex = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
|
||||||
|
|
||||||
return source.replace(escapeRegex, '\\$&');
|
return source.replace(escapeRegex, '\\$&');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user