Index: common/eslint/bin/run_eslint |
diff --git a/systrace/bin/systrace b/common/eslint/bin/run_eslint |
similarity index 50% |
copy from systrace/bin/systrace |
copy to common/eslint/bin/run_eslint |
index bce86a7fd1460a4c3b82d3c72dccc26682acf497..4fe98971f48240e3264e78405a21170b9da86b5e 100755 |
--- a/systrace/bin/systrace |
+++ b/common/eslint/bin/run_eslint |
@@ -1,5 +1,4 @@ |
#!/usr/bin/env python |
- |
# Copyright 2016 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
@@ -7,10 +6,21 @@ |
import os |
import sys |
-_SYSTRACE_DIR = os.path.abspath( |
+ |
+_ESLINT_PATH = os.path.abspath( |
os.path.join(os.path.dirname(__file__), os.path.pardir)) |
-sys.path.insert(0, _SYSTRACE_DIR) |
-from systrace import run_systrace |
+ |
+ |
+def _AddToPathIfNeeded(path): |
+ if path not in sys.path: |
+ sys.path.insert(0, path) |
+ |
if __name__ == '__main__': |
- sys.exit(run_systrace.main()) |
+ _AddToPathIfNeeded(_ESLINT_PATH) |
+ from eslint import eslint |
+ |
+ if len(sys.argv) == 1: |
+ print eslint.RunEslintGlobal() |
+ else: |
+ print eslint.RunEslint(sys.argv[1:]) |