mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-25 01:20:24 +08:00
Update grunt tasks to lint and transpile es6 code using babel
Summary: - Linter uses predefined rules for ES6 and React from airbnb Test Plan: - Manuel Reviewers: evan, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2242
This commit is contained in:
parent
f152cca4d6
commit
5fa630b8c6
6 changed files with 72 additions and 2 deletions
3
.eslintrc
Normal file
3
.eslintrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "./build/config/eslint.json"
|
||||
}
|
|
@ -52,10 +52,12 @@ _.extend(global, require('harmony-collections')) unless global.WeakMap?
|
|||
module.exports = (grunt) ->
|
||||
grunt.loadNpmTasks('grunt-coffeelint-cjsx')
|
||||
grunt.loadNpmTasks('grunt-lesslint')
|
||||
grunt.loadNpmTasks('grunt-babel')
|
||||
grunt.loadNpmTasks('grunt-cson')
|
||||
grunt.loadNpmTasks('grunt-contrib-csslint')
|
||||
grunt.loadNpmTasks('grunt-coffee-react')
|
||||
grunt.loadNpmTasks('grunt-contrib-coffee')
|
||||
grunt.loadNpmTasks('grunt-eslint')
|
||||
grunt.loadNpmTasks('grunt-contrib-less')
|
||||
grunt.loadNpmTasks('grunt-shell')
|
||||
grunt.loadNpmTasks('grunt-markdown')
|
||||
|
@ -124,6 +126,25 @@ module.exports = (grunt) ->
|
|||
dest: appDir
|
||||
ext: '.js'
|
||||
|
||||
babelConfig =
|
||||
options: require './config/babel.json'
|
||||
dist:
|
||||
files: [{
|
||||
expand: true
|
||||
src: [
|
||||
'src/**/*.es6'
|
||||
'src/**/*.es'
|
||||
'src/**/*.jsx'
|
||||
'internal_packages/**/*.es6'
|
||||
'internal_packages/**/*.es'
|
||||
'internal_packages/**/*.jsx'
|
||||
'static/**/*.es6'
|
||||
'static/**/*.es'
|
||||
]
|
||||
dest: appDir
|
||||
ext: '.js'
|
||||
}]
|
||||
|
||||
lessConfig =
|
||||
options:
|
||||
paths: [
|
||||
|
@ -189,6 +210,8 @@ module.exports = (grunt) ->
|
|||
|
||||
coffee: coffeeConfig
|
||||
|
||||
babel: babelConfig
|
||||
|
||||
cjsx: cjsxConfig
|
||||
|
||||
less: lessConfig
|
||||
|
@ -235,6 +258,20 @@ module.exports = (grunt) ->
|
|||
target:
|
||||
grunt.option("target")?.split(" ") or []
|
||||
|
||||
eslint:
|
||||
options:
|
||||
configFile: 'build/config/eslint.json'
|
||||
target: [
|
||||
'internal_packages/**/*.jsx'
|
||||
'internal_packages/**/*.es6'
|
||||
'internal_packages/**/*.es'
|
||||
'dot-nylas/**/*.es6'
|
||||
'dot-nylas/**/*.es'
|
||||
'src/**/*.es6'
|
||||
'src/**/*.es'
|
||||
'src/**/*.jsx'
|
||||
]
|
||||
|
||||
csslint:
|
||||
options:
|
||||
'adjoining-classes': false
|
||||
|
@ -319,8 +356,8 @@ module.exports = (grunt) ->
|
|||
stderr: false
|
||||
failOnError: false
|
||||
|
||||
grunt.registerTask('compile', ['coffee', 'cjsx', 'prebuild-less', 'cson', 'peg'])
|
||||
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint', 'nylaslint'])
|
||||
grunt.registerTask('compile', ['coffee', 'cjsx', 'babel', 'prebuild-less', 'cson', 'peg'])
|
||||
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint', 'nylaslint', 'eslint'])
|
||||
grunt.registerTask('test', ['shell:kill-atom', 'run-edgehill-specs'])
|
||||
grunt.registerTask('docs', ['build-docs', 'render-docs'])
|
||||
|
||||
|
|
3
build/config/babel.json
Normal file
3
build/config/babel.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": ["es2015", "react", "stage-0"]
|
||||
}
|
17
build/config/eslint.json
Normal file
17
build/config/eslint.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "airbnb",
|
||||
"globals": {
|
||||
"atom": false
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"jasmine": true
|
||||
},
|
||||
"rules": {
|
||||
"react/prop-types": [2, {"ignore": ["children"]}],
|
||||
"eqeqeq": [2, "smart"],
|
||||
"id-length": [0],
|
||||
"no-loop-func": [0]
|
||||
}
|
||||
}
|
|
@ -7,13 +7,18 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"async": "~0.2.9",
|
||||
"babel-eslint": "^4.1.3",
|
||||
"bluebird": "^2.3",
|
||||
"coffee-react-transform": "^3.1.0",
|
||||
"coffeelint-cjsx": "^2.0",
|
||||
"donna": "1.0.10",
|
||||
"eslint": "^1.5.1",
|
||||
"eslint-config-airbnb": "^0.1.0",
|
||||
"eslint-plugin-react": "^3.4.2",
|
||||
"fs-plus": "2.x",
|
||||
"github-releases": "~0.3.0",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-babel": "^6.0.0",
|
||||
"grunt-cli": "~0.1.9",
|
||||
"grunt-coffee-react": "^2.1.0",
|
||||
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
|
||||
|
@ -24,6 +29,7 @@
|
|||
"grunt-cson": "0.14.0",
|
||||
"grunt-download-electron": "^2.1",
|
||||
"grunt-electron-installer": "^1.0",
|
||||
"grunt-eslint": "^17.3.1",
|
||||
"grunt-lesslint": "0.13.0",
|
||||
"grunt-markdown": "^0.7.0",
|
||||
"grunt-peg": "~1.1.0",
|
||||
|
|
|
@ -77,6 +77,10 @@
|
|||
"vm-compatibility-layer": "0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^4.1.3",
|
||||
"eslint": "^1.5.1",
|
||||
"eslint-config-airbnb": "^0.1.0",
|
||||
"eslint-plugin-react": "^3.4.2",
|
||||
"nock": "^2",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-serve": "^0.1.6",
|
||||
|
|
Loading…
Reference in a new issue