]> git.proxmox.com Git - pve-eslint.git/commitdiff
factor out path expansion
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 6 Jun 2020 10:12:30 +0000 (12:12 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 6 Jun 2020 11:29:24 +0000 (13:29 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/app.js
src/eslint.js

index 740741fa33848b20d1395ddcc2ca919604d27814..9ef2b95bacf7384fc48a7bff8c310aa9e65387ac 100644 (file)
@@ -223,14 +223,17 @@ const defaultConfig = {
      },
 };
 
+let pathExpand = (p) => {
+    if (p.match(/^[^/]/)) {
+       p = process.cwd() + "/" + p;
+    }
+    return p;
+};
+
 let config = defaultConfig;
 if (program.config) {
-    let cfgpath = program.config;
-    if (cfgpath.match(/^[^/]/)) {
-       cfgpath = process.cwd() + "/" + cfgpath;
-    }
     config = {
-       "extends": cfgpath,
+       "extends": pathExpand(program.config),
     };
 }
 
index 59b3b487e3eb35f88fb87164a08a5cb8e0707e92..0fa18d84edec24770b96e0fbcadbf8de9f13cbfc 100755 (executable)
@@ -149209,4 +149209,4 @@ var objectKeys = Object.keys || function (obj) {
 };
 
 /***/ })
-/******/ ]);
\ No newline at end of file
+/******/ ]);