electron/script/eslint.py

37 lines
878 B
Python
Raw Normal View History

2016-01-15 21:52:18 +00:00
#!/usr/bin/env python
import glob
import os
import sys
from lib.config import PLATFORM
2016-01-15 21:52:18 +00:00
from lib.util import execute
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
os.chdir(SOURCE_ROOT)
# Skip eslint on our Windows build machine for now.
if PLATFORM == 'win32' and os.getenv('JANKY_SHA1'):
return
2016-01-15 21:52:18 +00:00
eslint = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'eslint')
if sys.platform in ['win32', 'cygwin']:
eslint += '.cmd'
2016-01-15 22:02:05 +00:00
settings = ['--quiet', '--config']
2016-01-15 21:52:18 +00:00
2016-01-15 22:37:51 +00:00
sourceConfig = os.path.join('script', 'eslintrc-base.json')
2016-01-15 22:43:23 +00:00
sourceFiles = ['atom']
2016-01-15 22:02:05 +00:00
execute([eslint] + settings + [sourceConfig] + sourceFiles)
specConfig = os.path.join('script', 'eslintrc-spec.json')
specFiles = glob.glob('spec/*.js')
execute([eslint] + settings + [specConfig] + specFiles)
2016-01-15 21:52:18 +00:00
if __name__ == '__main__':
sys.exit(main())