mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-21 12:05:24 -04:00
ignore module error Signed-off-by: houhaoyu <houhaoyu@huawei.com> Change-Id: Id97e6c2e7a0aafbde07d0683f7ba4a54b835b2bf
This commit is contained in:
@@ -38,7 +38,8 @@ import {
|
||||
dollarCollection,
|
||||
appComponentCollection,
|
||||
decoratorParamsCollection,
|
||||
extendCollection
|
||||
extendCollection,
|
||||
importModuleCollection
|
||||
} from './ets_checker';
|
||||
|
||||
configure({
|
||||
@@ -286,13 +287,20 @@ export class ResultStates {
|
||||
private validateError(message: string): boolean {
|
||||
const propInfoReg: RegExp = /Cannot find name\s*'(\$?\$?[_a-zA-Z0-9]+)'/;
|
||||
const stateInfoReg: RegExp = /Property\s*'(\$?[_a-zA-Z0-9]+)' does not exist on type/;
|
||||
const importInfoReg: RegExp = /Cannot find namespace\s*'([_a-zA-Z0-9]+)'\./;
|
||||
if (this.matchMessage(message, props, propInfoReg) ||
|
||||
this.matchMessage(message, props, stateInfoReg)) {
|
||||
this.matchMessage(message, props, stateInfoReg) ||
|
||||
this.matchMessage(message, [...importModuleCollection], importInfoReg)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private matchMessage(message: string, nameArr: any, reg: RegExp): boolean {
|
||||
importModuleCollection.forEach(item => {
|
||||
if (message.includes(item)) {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
if (reg.test(message)) {
|
||||
const match: string[] = message.match(reg);
|
||||
if (match[1] && nameArr.includes(match[1])) {
|
||||
|
||||
@@ -134,6 +134,7 @@ export const dollarCollection: Set<string> = new Set();
|
||||
export const appComponentCollection: Set<string> = new Set();
|
||||
export const decoratorParamsCollection: Set<string> = new Set();
|
||||
export const extendCollection: Set<string> = new Set();
|
||||
export const importModuleCollection: Set<string> = new Set();
|
||||
|
||||
function checkUISyntax(source: string, fileName: string): void {
|
||||
if (/\.ets$/.test(fileName)) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import path from 'path';
|
||||
|
||||
export const NATIVE_MODULE: Set<string> = new Set(
|
||||
['system.app', 'ohos.app', 'system.router', 'system.curves', 'ohos.curves', 'system.matrix4', 'ohos.matrix4']);
|
||||
export const VALIDATE_MODULE: string[] = ['application', 'util', 'screen'];
|
||||
export const VALIDATE_MODULE: string[] = ['application', 'util', 'screen', 'mediaquery'];
|
||||
export const SYSTEM_PLUGIN: string = 'system';
|
||||
export const OHOS_PLUGIN: string = 'ohos';
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ import {
|
||||
} from './utils';
|
||||
import { projectConfig } from '../main';
|
||||
import { collectExtend } from './process_ui_syntax';
|
||||
import { importModuleCollection } from "./ets_checker";
|
||||
|
||||
export interface ComponentCollection {
|
||||
entryComponent: string;
|
||||
@@ -748,6 +749,9 @@ export function processSystemApi(content: string, isProcessWhiteList: boolean =
|
||||
let moduleType: string = item2 || item5;
|
||||
let systemKey: string = item3 || item6;
|
||||
let systemValue: string = item1 || item4;
|
||||
if (!VALIDATE_MODULE.includes(systemValue)){
|
||||
importModuleCollection.add(systemValue);
|
||||
}
|
||||
if (!isProcessWhiteList && validateWhiteListModule(moduleType, systemKey)) {
|
||||
return item;
|
||||
} else if (isProcessWhiteList) {
|
||||
|
||||
Reference in New Issue
Block a user