Skip to content

WIP upgrade to babel 7 scoped packages #1036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"presets": [
["env", {
["@babel/preset-env", {
"targets": {
"node": 6
},
"include": ["transform-regenerator"]
}],
"flow"
"@babel/preset-flow"
],
"plugins": ["syntax-async-functions"],
"plugins": ["@babel/plugin-syntax-async-generators"],
"ignore": [
"**/default_theme/assets/*"
]
Expand Down
6 changes: 5 additions & 1 deletion __tests__/fixture/react-jsx.input.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ function apples() {}

var HelloMessage = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
return (
<>
<div>Hello {this.props.name}</div>
</>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fragment here is added to test #1029

);
}
});

Expand Down
2 changes: 1 addition & 1 deletion __tests__/lib/flow_doctrine.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const flowDoctrine = require('../../src/flow_doctrine.js');
const parse = require('../../src/parsers/javascript');
const FLOW_TYPES = require('babel-types').FLOW_TYPES;
const FLOW_TYPES = require('@babel/types').FLOW_TYPES;

function toComment(fn, filename) {
return parse(
Expand Down
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
"documentation": "./bin/documentation.js"
},
"dependencies": {
"@babel/core": "^7.0.0-beta.40",
"@babel/generator": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"@babel/preset-react": "^7.0.0-beta.40",
"@babel/preset-stage-0": "^7.0.0-beta.40",
"@babel/traverse": "^7.0.0-beta.40",
"@babel/types": "^7.0.0-beta.40",
"ansi-html": "^0.0.7",
"babel-core": "^6.26.0",
"babel-generator": "^6.26.0",
"babel-plugin-system-import-transformer": "3.1.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-traverse": "^6.26.0",
"babel-types": "^6.26.0",
"babelify": "^8.0.0",
"babylon": "^6.18.0",
"babelify": "git+https://github.com/ylemkimon/babelify.git#master",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The official babelify project supports Babel v7 now: https://github.com/babel/babelify/blob/v9.0.0/package.json#L16

"babylon": "^7.0.0-beta.30",
"chalk": "^2.3.0",
"chokidar": "^2.0.0",
"concat-stream": "^1.6.0",
Expand Down Expand Up @@ -58,13 +58,14 @@
"yargs": "^9.0.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.40",
"@babel/plugin-syntax-async-generators": "^7.0.0-beta.40",
"@babel/plugin-transform-modules-commonjs": "^7.0.0-beta.40",
"@babel/preset-flow": "^7.0.0-beta.40",
"are-we-flow-yet": "^1.0.0",
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-core": "^7.0.0-0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest@test which uses Babel 7 seems to still require unscoped babel-core import. I couldn't start the tests without it. Read more here

"babel-eslint": "^8.2.2",
"babel-jest": "^22.1.0",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-preset-flow": "^6.23.0",
"chdir": "0.0.0",
"coveralls": "^3.0.0",
"cz-conventional-changelog": "2.1.0",
Expand All @@ -75,7 +76,7 @@
"flow-bin": "^0.66.0",
"fs-extra": "^5.0.0",
"husky": "^0.14.3",
"jest": "^22.1.4",
"jest": "^21.3.0-beta.15",
"json-schema": "0.2.3",
"lint-staged": "^7.0.0",
"mock-fs": "^4.4.2",
Expand Down
4 changes: 2 additions & 2 deletions src/extractors/comments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* @flow */
import traverse from 'babel-traverse';
import traverse from '@babel/traverse';
const isJSDocComment = require('../is_jsdoc_comment');

/**
Expand Down Expand Up @@ -54,7 +54,7 @@ function walkComments(
}
});

traverse.clearCache();
traverse.cache.clear();

return newResults;
}
Expand Down
4 changes: 2 additions & 2 deletions src/extractors/exported.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow */
import traverse from 'babel-traverse';
import traverse from '@babel/traverse';
const isJSDocComment = require('../is_jsdoc_comment');
const t = require('babel-types');
const t = require('@babel/types');
const nodePath = require('path');
const fs = require('fs');
import { parseToAst } from '../parsers/parse_to_ast';
Expand Down
2 changes: 1 addition & 1 deletion src/flow_doctrine.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */

const generate = require('babel-generator').default;
const generate = require('@babel/generator').default;

const namedTypes = {
NumberTypeAnnotation: 'number',
Expand Down
2 changes: 1 addition & 1 deletion src/infer/augments.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */

import generate from 'babel-generator';
import generate from '@babel/generator';
const findTarget = require('./finders').findTarget;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/infer/finders.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */

const t = require('babel-types');
const t = require('@babel/types');

/**
* Try to find the part of JavaScript a comment is referring to, by
Expand Down
2 changes: 1 addition & 1 deletion src/infer/kind.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */

const t = require('babel-types');
const t = require('@babel/types');

/**
* Infers a `kind` tag from the context.
Expand Down
2 changes: 1 addition & 1 deletion src/infer/membership.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */

const n = require('babel-types');
const n = require('@babel/types');
const pathParse = require('parse-filepath');
const isJSDocComment = require('../is_jsdoc_comment');
const parse = require('../parse');
Expand Down
2 changes: 1 addition & 1 deletion src/infer/name.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow */

const pathParse = require('parse-filepath');
const t = require('babel-types');
const t = require('@babel/types');

/**
* Infers a `name` tag from the context.
Expand Down
4 changes: 2 additions & 2 deletions src/infer/params.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow */

import * as t from 'babel-types';
import generate from 'babel-generator';
import * as t from '@babel/types';
import generate from '@babel/generator';
import _ from 'lodash';
import finders from './finders';
import flowDoctrine from '../flow_doctrine';
Expand Down
2 changes: 1 addition & 1 deletion src/infer/return.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow */

const findTarget = require('./finders').findTarget;
const t = require('babel-types');
const t = require('@babel/types');
const flowDoctrine = require('../flow_doctrine');

/**
Expand Down
2 changes: 1 addition & 1 deletion src/infer/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const findTarget = require('./finders').findTarget;
const flowDoctrine = require('../flow_doctrine');
const t = require('babel-types');
const t = require('@babel/types');

const constTypeMapping = {
BooleanLiteral: { type: 'BooleanTypeAnnotation' },
Expand Down
8 changes: 4 additions & 4 deletions src/input/dependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ function dependencyStream(
.concat(['.mjs', '.js', '.json', '.es6', '.jsx']),
transform: [
babelify.configure({
sourceMap: false,
sourceMaps: false,
compact: false,
presets: [
require('babel-preset-env'),
require('babel-preset-stage-0'),
require('babel-preset-react')
require('@babel/preset-env'),
require('@babel/preset-stage-0'),
require('@babel/preset-react')
],
plugins: [
require('babel-plugin-transform-decorators-legacy').default,
Expand Down
8 changes: 6 additions & 2 deletions src/parsers/javascript.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow */

const _ = require('lodash');
const t = require('babel-types');
const t = require('@babel/types');
const parse = require('../parse');
const walkComments = require('../extractors/comments');
const walkExported = require('../extractors/exported');
Expand Down Expand Up @@ -103,7 +103,11 @@ function _addComment(

if (t.isClassMethod(path) && path.node.kind === 'constructor') {
// #689
if (comment.tags.some(tag => tag.title !== 'param' && tag.title !== 'hideconstructor')) {
if (
comment.tags.some(
tag => tag.title !== 'param' && tag.title !== 'hideconstructor'
)
) {
debuglog(
'A constructor was documented explicitly: document along with the class instead'
);
Expand Down
Loading