mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
chore: fix eslint issues (#9017)
This commit is contained in:
@ -39,7 +39,7 @@ export class ModuleNameResolver {
|
||||
// This call will return a clean path without qualifiers
|
||||
path = stripQualifiers(path);
|
||||
|
||||
let candidates = this.getCandidates(path, ext);
|
||||
const candidates = this.getCandidates(path, ext);
|
||||
result = findMatch(path, ext, candidates, this.context);
|
||||
|
||||
return result;
|
||||
|
@ -25,7 +25,7 @@ function processFile(file: fs.File) {
|
||||
const loadContent = () => file.readTextSync();
|
||||
|
||||
switch (file.extension.toLocaleLowerCase()) {
|
||||
case '.js':
|
||||
case '.js':{
|
||||
const noExtPath = filePathRelativeToApp.substr(0, filePathRelativeToApp.length - '.js'.length);
|
||||
|
||||
register(filePathRelativeToApp, function () {
|
||||
@ -35,6 +35,7 @@ function processFile(file: fs.File) {
|
||||
return global.require(file.path);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case '.css':
|
||||
register(filePathRelativeToApp, loadContent);
|
||||
@ -48,8 +49,8 @@ function processFile(file: fs.File) {
|
||||
if (file.name === 'package.json') {
|
||||
const json = global.require(file.path);
|
||||
if (json.main) {
|
||||
let name = filePathRelativeToApp.substr(0, filePathRelativeToApp.length - 'package.json'.length - 1);
|
||||
let requirePath = fs.path.join(file.parent.path, json.main);
|
||||
const name = filePathRelativeToApp.substr(0, filePathRelativeToApp.length - 'package.json'.length - 1);
|
||||
const requirePath = fs.path.join(file.parent.path, json.main);
|
||||
|
||||
register(name, () => global.require(requirePath));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
const MIN_WH: string = 'minWH';
|
||||
const MIN_W: string = 'minW';
|
||||
const MIN_H: string = 'minH';
|
||||
const MIN_WH = 'minWH';
|
||||
const MIN_W = 'minW';
|
||||
const MIN_H = 'minH';
|
||||
const PRIORITY_STEP = 10000;
|
||||
|
||||
/**
|
||||
@ -120,9 +120,9 @@ const supportedQualifiers: Array<QualifierSpec> = [minWidthHeightQualifier, minW
|
||||
function checkQualifiers(path: string, context: PlatformContext): number {
|
||||
let result = 0;
|
||||
for (let i = 0; i < supportedQualifiers.length; i++) {
|
||||
let qualifier = supportedQualifiers[i];
|
||||
const qualifier = supportedQualifiers[i];
|
||||
if (qualifier.isMatch(path)) {
|
||||
let occurences = qualifier.getMatchOccurences(path);
|
||||
const occurences = qualifier.getMatchOccurences(path);
|
||||
// Always get the last qualifier among identical occurences
|
||||
result = qualifier.getMatchValue(occurences[occurences.length - 1], context);
|
||||
if (result < 0) {
|
||||
@ -142,9 +142,9 @@ function checkQualifiers(path: string, context: PlatformContext): number {
|
||||
export function stripQualifiers(path: string): string {
|
||||
// Strip qualifiers from path if any
|
||||
for (let i = 0; i < supportedQualifiers.length; i++) {
|
||||
let qualifier = supportedQualifiers[i];
|
||||
const qualifier = supportedQualifiers[i];
|
||||
if (qualifier.isMatch(path)) {
|
||||
let occurences = qualifier.getMatchOccurences(path);
|
||||
const occurences = qualifier.getMatchOccurences(path);
|
||||
for (let j = 0; j < occurences.length; j++) {
|
||||
path = path.replace(occurences[j], '');
|
||||
}
|
||||
@ -155,7 +155,7 @@ export function stripQualifiers(path: string): string {
|
||||
}
|
||||
|
||||
export function findMatch(path: string, ext: string, candidates: Array<string>, context: PlatformContext): string {
|
||||
let fullPath: string = ext ? path + ext : path;
|
||||
const fullPath: string = ext ? path + ext : path;
|
||||
let bestValue = -1;
|
||||
let result: string = null;
|
||||
|
||||
|
Reference in New Issue
Block a user