Pārlūkot izejas kodu

config.lintModules to remove inspector.

sebavan 6 gadi atpakaļ
vecāks
revīzija
85cd5eded5

+ 9 - 0
Tools/Config/config.json

@@ -44,6 +44,15 @@
         "gui",
         "inspector"
     ],
+    "lintModules": [
+        "core",
+        "materialsLibrary",
+        "postProcessesLibrary",
+        "proceduralTexturesLibrary",
+        "loaders",
+        "serializers",
+        "gui"
+    ],
     "viewerModules": [
         "viewer",
         "viewer-assets"

+ 42 - 42
Tools/Gulp/helpers/gulp-validateImports.js

@@ -50,49 +50,8 @@ var validateImports = function(data, fileLocation, options) {
                 }
             }
 
-            // Check Relative.
-            if (!externalModule && !module.startsWith(".")) {
-                errors.push(`Line ${index} Imports needs to be relative. ${module}`);
-            }
-
             // Check if path is correct internal.
-            if (!externalModule) {
-                const directory = path.dirname(fileLocation);
-                let internalModulePath = path.join(directory, module + ".ts");
-                if (!fs.existsSync(internalModulePath)) {
-                    let internalModulePath = path.join(directory, module + ".tsx");
-                    if (!fs.existsSync(internalModulePath)) {
-                        if (fileLocation.indexOf("legacy") > -1 || fileLocation.indexOf("index") > -1) {
-                            let internalModulePath = path.join(directory, module + "index.ts");
-                            if (!fs.existsSync(internalModulePath)) {
-                                let internalModulePath = path.join(directory, module + "/index.ts");
-                                if (!fs.existsSync(internalModulePath)) {
-                                    errors.push(`Line ${index} Imports needs to be full path. ${module}`);
-                                }
-                            }
-                        }
-                        else {
-                            errors.push(`Line ${index} Imports ${module} needs to be full path.`);
-                        }
-                    }
-                }
-
-                if (internalModulePath.indexOf("index.") > -1) {
-                    if (fileLocation.indexOf("legacy") === -1) {
-                        let excluded = false;
-                        for (let exclusion of indexExlclusion) {
-                            if (internalModulePath.indexOf(exclusion) > -1) {
-                                excluded = true;
-                                break;
-                            }
-                        }
-                        if (!excluded) {
-                            errors.push(`Line ${index} Imports ${module} should not be from index for tree shaking.`);
-                        }
-                    }
-                }
-            }
-            else {
+            if (externalModule) {
                 const mapping = {
                     "babylonjs": "core",
                     "babylonjs-loaders": "loaders",
@@ -143,6 +102,47 @@ var validateImports = function(data, fileLocation, options) {
                     }
                 }
             }
+            else {
+                // Check Relative.
+                if (!module.startsWith(".")) {
+                    errors.push(`Line ${index} Imports needs to be relative. ${module}`);
+                }
+
+                const directory = path.dirname(fileLocation);
+                let internalModulePath = path.join(directory, module + ".ts");
+                if (!fs.existsSync(internalModulePath)) {
+                    let internalModulePath = path.join(directory, module + ".tsx");
+                    if (!fs.existsSync(internalModulePath)) {
+                        if (fileLocation.indexOf("legacy") > -1 || fileLocation.indexOf("index") > -1) {
+                            let internalModulePath = path.join(directory, module + "index.ts");
+                            if (!fs.existsSync(internalModulePath)) {
+                                let internalModulePath = path.join(directory, module + "/index.ts");
+                                if (!fs.existsSync(internalModulePath)) {
+                                    errors.push(`Line ${index} Imports needs to be full path. ${module}`);
+                                }
+                            }
+                        }
+                        else {
+                            errors.push(`Line ${index} Imports ${module} needs to be full path.`);
+                        }
+                    }
+                }
+
+                if (internalModulePath.indexOf("index.") > -1) {
+                    if (fileLocation.indexOf("legacy") === -1) {
+                        let excluded = false;
+                        for (let exclusion of indexExlclusion) {
+                            if (internalModulePath.indexOf(exclusion) > -1) {
+                                excluded = true;
+                                break;
+                            }
+                        }
+                        if (!excluded) {
+                            errors.push(`Line ${index} Imports ${module} should not be from index for tree shaking.`);
+                        }
+                    }
+                }
+            }
         }
     }
 

+ 2 - 4
Tools/Gulp/tasks/gulpTasks-importLint.js

@@ -20,12 +20,10 @@ var importLintLibrary = function(settings) {
         }));
 }
 
-const lintModules = config.modules.filter((module) => module != "inspector");
-
 /**
  * Dynamic module linting for library (mat, post processes, ...).
  */
-lintModules.map(function(module) {
+config.lintModules.map(function(module) {
     // Task will be like moduleName-importLint
     gulp.task(module + "-importLint", function() {
         var settings = config[module];
@@ -38,7 +36,7 @@ lintModules.map(function(module) {
  * Full Librairies importLint.
  */
 gulp.task("typescript-libraries-importLint",
-    gulp.series(lintModules.map((module) => {
+    gulp.series(config.lintModules.map((module) => {
         return module + "-importLint";
     })
 ));

+ 2 - 2
Tools/Gulp/tasks/gulpTasks-tsLint.js

@@ -33,7 +33,7 @@ var tsLintExternalLibrary = function(settings) {
 /**
  * Dynamic module linting for external library (mat, post processes, ...).
  */
-config.modules.map(function(module) {
+config.lintModules.map(function(module) {
     // Task will be like moduleName-tsLint
     gulp.task(module + "-tsLint", function() {
         var settings = config[module];
@@ -46,7 +46,7 @@ config.modules.map(function(module) {
  * Full Librairies tsLint.
  */
 gulp.task("typescript-libraries-tsLint",
-    gulp.series(config.modules.map((module) => {
+    gulp.series(config.lintModules.map((module) => {
         return module + "-tsLint";
     })
 ));