Merge pull request #4126 from atom/add-eslint

Run eslint on CI
This commit is contained in:
Cheng Zhao 2016-01-16 13:26:07 +08:00
commit 5a83f94524
5 changed files with 74 additions and 0 deletions

View file

@ -3,6 +3,7 @@
"version": "0.36.4",
"devDependencies": {
"asar": "^0.9.0",
"eslint": "^1.10.3",
"request": "*"
},
"optionalDependencies": {

View file

@ -63,6 +63,7 @@ def main():
run_script('bootstrap.py', args)
run_script('cpplint.py')
run_script('eslint.py')
if PLATFORM != 'win32':
run_script('pylint.py')
if is_release:

31
script/eslint.py Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env python
import glob
import os
import sys
from lib.util import execute
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
os.chdir(SOURCE_ROOT)
eslint = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'eslint')
if sys.platform in ['win32', 'cygwin']:
eslint += '.cmd'
settings = ['--quiet', '--config']
sourceConfig = os.path.join('script', 'eslintrc-base.json')
sourceFiles = ['atom']
execute([eslint] + settings + [sourceConfig] + sourceFiles)
specConfig = os.path.join('script', 'eslintrc-spec.json')
specFiles = glob.glob('spec/*.js')
execute([eslint] + settings + [specConfig] + specFiles)
if __name__ == '__main__':
sys.exit(main())

31
script/eslintrc-base.json Normal file
View file

@ -0,0 +1,31 @@
{
"rules": {
"indent": [
0,
2,
{
"SwitchCase": 1
}
],
"quotes": [
0,
"single"
],
"semi": [
0,
"always"
],
"comma-dangle": 0,
"linebreak-style": 0,
"no-console": 0,
"no-undef": 0,
"no-unreachable": 0,
"no-unused-vars": 0
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"extends": "eslint:recommended"
}

10
script/eslintrc-spec.json Normal file
View file

@ -0,0 +1,10 @@
{
"rules": {
"no-empty": 0
},
"env": {
"jquery": true,
"mocha": true
},
"extends": "./eslintrc-base.json"
}