Ver Fonte

fix lint running

Adam Shaw há 5 anos atrás
pai
commit
d2c057bbab
2 ficheiros alterados com 24 adições e 13 exclusões
  1. 1 1
      gulpfile.js
  2. 23 12
      scripts/eslint-dir.js

+ 1 - 1
gulpfile.js

@@ -401,7 +401,7 @@ exports.lintPackageMeta = function() {
 
 
 exports.lint = series(exports.lintPackageMeta, () => {
-  return eslintAll() ? Promise.resolve() : Promise.reject()
+  return eslintAll() ? Promise.resolve() : Promise.reject(new Error('One or more lint tasks failed'))
 })
 
 exports.lintBuilt = series(exports.lintBuiltCss, exports.lintBuiltDts)

+ 23 - 12
scripts/eslint-dir.js

@@ -26,19 +26,9 @@ function eslintDir(dir) {
 }
 
 
-function getAllDirs() {
-  return publicPackageStructs.map((struct) => struct.dir)
-}
-
-
-function eslintAll() {
-  let dirs = process.argv.splice(2)
+function eslintDirs(dirs) {
   let anyErrors = false
 
-  if (!dirs.length || dirs[0] === 'all') {
-    dirs = getAllDirs()
-  }
-
   for (let dir of dirs) {
     if (!eslintDir(dir)) {
       anyErrors = true
@@ -49,6 +39,27 @@ function eslintAll() {
 }
 
 
+function eslintAll() {
+  return eslintDirs(getAllDirs())
+}
+
+
+function getAllDirs() {
+  return publicPackageStructs.map((struct) => struct.dir)
+}
+
+
 if (require.main === module) {
-  eslintAll()
+  let dirs = process.argv.splice(2)
+  let success
+
+  if (!dirs.length || dirs[0] === 'all') {
+    success = eslintAll()
+  } else {
+    success = eslintDirs(dirs)
+  }
+
+  if (!success) {
+    process.exit(1)
+  }
 }