OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | |
3 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 4 # found in the LICENSE file. |
6 | 5 |
7 import os | 6 import os |
8 import sys | 7 import sys |
9 | 8 |
10 _SYSTRACE_DIR = os.path.abspath( | 9 |
| 10 _ESLINT_PATH = os.path.abspath( |
11 os.path.join(os.path.dirname(__file__), os.path.pardir)) | 11 os.path.join(os.path.dirname(__file__), os.path.pardir)) |
12 sys.path.insert(0, _SYSTRACE_DIR) | 12 |
13 from systrace import run_systrace | 13 |
| 14 def _AddToPathIfNeeded(path): |
| 15 if path not in sys.path: |
| 16 sys.path.insert(0, path) |
| 17 |
14 | 18 |
15 if __name__ == '__main__': | 19 if __name__ == '__main__': |
16 sys.exit(run_systrace.main()) | 20 _AddToPathIfNeeded(_ESLINT_PATH) |
| 21 from eslint import eslint |
| 22 |
| 23 if len(sys.argv) == 1: |
| 24 print eslint.RunEslintGlobal() |
| 25 else: |
| 26 print eslint.RunEslint(sys.argv[1:]) |
OLD | NEW |