Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  7.2.0
  Use `lodash` instead of `lodash.pickby`. (babel#435)
  [flow] Process polymorphic type bounds on functions (babel#444)
  Add option to disable code frame. (babel#446)
  • Loading branch information
Couto committed Mar 20, 2017
2 parents dfb32aa + 4db4db5 commit 5d92ba6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
15 changes: 14 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var babylonToEspree = require("./babylon-to-espree");
var pick = require("lodash.pickby");
var pick = require("lodash").pickBy;
var Module = require("module");
var path = require("path");
var parse = require("babylon").parse;
Expand Down Expand Up @@ -176,6 +176,18 @@ function monkeypatch() {
}
}

function visitTypeParameters(typeParameters) {
var params = typeParameters.params;

// visit bounds on polymorphpic types, eg; `Foo` in `fn<T: Foo>(a: T): T`
for (var i = 0; i < params.length; i++) {
var param = params[i];
if (param.typeAnnotation) {
visitTypeAnnotation.call(this, param.typeAnnotation);
}
}
}

function checkIdentifierOrVisit(node) {
if (node.typeAnnotation) {
visitTypeAnnotation.call(this, node.typeAnnotation);
Expand Down Expand Up @@ -249,6 +261,7 @@ function monkeypatch() {
var typeParamScope;
if (node.typeParameters) {
typeParamScope = nestTypeParamScope(this.scopeManager, node);
visitTypeParameters.call(this, node.typeParameters);
}
if (node.returnType) {
checkIdentifierOrVisit.call(this, node.returnType);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-eslint",
"version": "7.1.1",
"version": "7.2.0",
"description": "Custom parser for ESLint",
"main": "index.js",
"files": [
Expand All @@ -16,7 +16,7 @@
"babel-traverse": "^6.23.1",
"babel-types": "^6.23.0",
"babylon": "^6.16.1",
"lodash.pickby": "^4.6.0"
"lodash": "^4.17.4"
},
"scripts": {
"test": "npm run lint && npm run test-only",
Expand Down
6 changes: 3 additions & 3 deletions test/non-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ describe("verify", () => {
);
});

it("type parameters", () => {
it("type parameter bounds", () => {
verifyAndAssertMessages(
unpad(`
import type Foo from 'foo';
import type Foo2 from 'foo';
function log<T1, T2>(a: T1, b: T2) { return a + b; }
log<Foo, Foo2>(1, 2);
function log<T1: Foo, T2: Foo2>(a: T1, b: T2) { return a + b; }
log(1, 2);
`),
{ "no-unused-vars": 1, "no-undef": 1 },
[]
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ doctrine@^2.0.0:
isarray "^1.0.0"

es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14:
version "0.10.14"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.14.tgz#625bc9ab9cac0f6fb9dc271525823d1800b3d360"
version "0.10.15"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6"
dependencies:
es6-iterator "2"
es6-symbol "~3.1"
Expand Down Expand Up @@ -694,7 +694,7 @@ lodash.pickby@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff"

lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0:
lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"

Expand Down

0 comments on commit 5d92ba6

Please sign in to comment.