diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 69c292c02b..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -.nyc_output -build -coverage -lib -test diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000..094a074340 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": "babel", + "env": { + "node": true + } +} diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000000..10b5f18a48 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,12 @@ +[ignore] +.*/lib/.* +.*/test/.* + +[include] + +[libs] + +[options] +strip_root=true +suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe +suppress_comment= \\(.\\|\n\\)*\\$FlowIssue diff --git a/.gitignore b/.gitignore index 90283a241b..f45cf020bb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build coverage lib node_modules +yarn.lock diff --git a/.travis.yml b/.travis.yml index a5834a3845..78fb6a1ad1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,31 @@ sudo: false language: node_js -before_install: -- | - [ "$TRAVIS_COMMIT_RANGE" = "" ] || git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(doc))/' || { - echo "Only docs were updated, stopping build process." - exit - } node_js: - - "6" - - "5" - - "4" + - "0.10" - "0.12" + - "4" + - "5" + - "6" -before_script: make bootstrap-babel +before_script: 'if [ -n "${BABEL-}" ]; then make bootstrap-babel ; fi' script: - - npm run test_cov - - make test-babel + - 'if [ -n "${LINT-}" ]; then npm run lint ; fi' + - 'if [ -n "${FLOW-}" ]; then npm run flow ; fi' + - 'if [ -n "${BABEL-}" ]; then make test-babel ; fi' + - 'if [ -z "${LINT-}" ] && [ -z "${FLOW-}" ] && [ -z "${BABEL-}" ]; then npm run test-ci ; fi' + +matrix: + fast_finish: true + include: + - node_js: "node" + env: LINT=true + - node_js: "node" + env: FLOW=true + - node_js: "node" + env: BABEL=true -after_success: npm run coverage +after_success: 'if [ -z "${LINT-}" ] && [ -z "${FLOW-}" ] && [ -z "${BABEL-}" ]; then npm run coverage ; fi' notifications: slack: babeljs:5Wy4QX13KVkGy9CnU0rmvgeK diff --git a/package.json b/package.json index 11663cede3..883d9a169a 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "devDependencies": { "ava": "^0.16.0", "babel-cli": "^6.14.0", + "babel-eslint": "^7.0.0", "babel-helper-fixtures": "^6.9.0", "babel-plugin-istanbul": "^2.0.1", "babel-plugin-transform-flow-strip-types": "^6.14.0", @@ -21,7 +22,11 @@ "babel-preset-stage-0": "^6.5.0", "codecov": "^1.0.1", "cross-env": "^2.0.1", - "kcheck": "^2.0.3", + "eslint": "^3.7.1", + "eslint-config-babel": "^2.0.1", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-flowtype": "^2.20.0", + "flow-bin": "^0.33.0", "lodash": "^4.15.0", "nyc": "^8.1.0", "unicode-9.0.0": "~0.7.0" @@ -32,12 +37,13 @@ "scripts": { "build": "babel src --out-dir lib", "coverage": "nyc report --reporter=json && codecov -f coverage/coverage-final.json", - "lint": "kcheck", + "lint": "eslint src bin", + "flow": "flow", "prepublish": "cross-env BABEL_ENV=production npm run build", "preversion": "npm run test && npm run changelog", - "test": "npm run build && npm run lint && npm run test-only", + "test": "npm run lint && npm run flow && npm run build && npm run test-only", "test-only": "ava test", - "test_cov": "cross-env BABEL_ENV=test npm run build && npm run lint && nyc ava test", + "test-ci": "cross-env BABEL_ENV=test npm run build && nyc npm run test-only", "watch": "babel src --out-dir lib --watch", "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" }, diff --git a/src/parser/statement.js b/src/parser/statement.js index 676920fff4..16b4dfab0c 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -419,7 +419,7 @@ pp.parseEmptyStatement = function (node) { }; pp.parseLabeledStatement = function (node, maybeName, expr) { - for (let label of (this.state.labels: Array)){ + for (let label of (this.state.labels: Array)) { if (label.name === maybeName) { this.raise(expr.start, `Label '${maybeName}' is already declared`); }