Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
fix(ts): remove esModuleInterop
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Aug 3, 2018
1 parent 30e5c71 commit 75c139d
Show file tree
Hide file tree
Showing 110 changed files with 254 additions and 244 deletions.
11 changes: 6 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Stateful components should be classes:
```js
import { AutoControlledComponent as Component } from '../../lib'

class Dropdown extends Component {
class Dropdown extends React.Component {
// ...
}
```
Expand Down Expand Up @@ -168,7 +168,8 @@ class MyComponent {
Every component must have fully described `propTypes`.

```js
import React, { PropTypes } from 'react'
import * as React from 'react'
import PropTypes from 'prop-types'

function MyComponent(props) {
return <div className={props.position}>{props.children}</div>
Expand Down Expand Up @@ -239,7 +240,7 @@ Each group has an API pattern and prop util for building up the `className` and
Use [`classNameBuilders`][4] to extract the prop values and build up the `className`. Grouped classes like `color` and `size` simply use the prop value as the `className`.

```js
import cx from 'classnames'
import * as cx from 'classnames'
import { useKeyOnly, useValueAndKey, useKeyOrValueAndKey } from '../../lib'

function Segment({ size, color, basic, floated, padded }) {
Expand Down Expand Up @@ -412,7 +413,7 @@ common.propKeyOrValueAndKeyToClassName()
Every common test receives your component as its first argument.

```js
import React from 'react'
import * as React from 'react'
import * as common from 'test/specs/commonTests'
import Menu from 'src/collections/Menu/Menu'
import MenuItem from 'src/collections/Menu/MenuItem'
Expand Down Expand Up @@ -483,7 +484,7 @@ function MyComponent(props) {
If you're component requires event handlers, it is a stateful class component. Want to know [why][15]?

```js
class MyComponent extends Component {
class MyComponent extends React.Component {
handleClick = (e) => {
console.log('Clicked my component!')
}
Expand Down
8 changes: 4 additions & 4 deletions build/gulp/plugins/gulp-component-menu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gutil from 'gulp-util'
import path from 'path'
import through2 from 'through2'
import Vinyl from 'vinyl'
import * as gutil from 'gulp-util'
import * as path from 'path'
import * as through2 from 'through2'
import * as Vinyl from 'vinyl'

import getComponentInfo from './util/getComponentInfo'

Expand Down
10 changes: 5 additions & 5 deletions build/gulp/plugins/gulp-example-menu.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import gutil from 'gulp-util'
import _ from 'lodash'
import path from 'path'
import through2 from 'through2'
import Vinyl from 'vinyl'
import * as gutil from 'gulp-util'
import * as _ from 'lodash'
import * as path from 'path'
import * as through2 from 'through2'
import * as Vinyl from 'vinyl'

import { parseDocSection } from './util'

Expand Down
8 changes: 4 additions & 4 deletions build/gulp/plugins/gulp-react-docgen.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gutil from 'gulp-util'
import path from 'path'
import through2 from 'through2'
import Vinyl from 'vinyl'
import * as gutil from 'gulp-util'
import * as path from 'path'
import * as through2 from 'through2'
import * as Vinyl from 'vinyl'

import { getComponentInfo } from './util'

Expand Down
8 changes: 4 additions & 4 deletions build/gulp/plugins/util/getComponentInfo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash'
import path from 'path'
import * as _ from 'lodash'
import * as path from 'path'
import { defaultHandlers, parse, resolver } from 'react-docgen'
import fs from 'fs'
import ts from 'typescript'
import * as fs from 'fs'
import * as ts from 'typescript'
import parseDefaultValue from './parseDefaultValue'
import parseDocblock from './parseDocblock'
import parserCustomHandler from './parserCustomHandler'
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/plugins/util/isUIComponentClass.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'react-docgen'
import recast from 'recast'
import * as recast from 'recast'

const { match, resolveToValue } = utils

Expand Down
2 changes: 1 addition & 1 deletion build/gulp/plugins/util/parseDefaultValue.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import _ from 'lodash'
import * as _ from 'lodash'

export default propDef => _.get(propDef, 'defaultValue.value', undefined)
2 changes: 1 addition & 1 deletion build/gulp/plugins/util/parseDocSection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash'
import * as _ from 'lodash'
import traverse from 'babel-traverse'

import parseBuffer from './parseBuffer'
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/plugins/util/parseDocblock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import doctrine from 'doctrine'
import * as doctrine from 'doctrine'

export default docblock => {
const { description = '', tags = [], ...rest } = doctrine.parse(docblock || '', { unwrap: true })
Expand Down
6 changes: 3 additions & 3 deletions build/gulp/plugins/util/parserCustomHandler.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash'
import { types } from 'recast'
import * as _ from 'lodash'
import * as recast from 'recast'
import { utils } from 'react-docgen'

const { namedTypes } = types
const { namedTypes } = recast.types
const { getMemberValuePath, getPropertyName, resolveToValue } = utils

const getObjectName = path => `${_.get(path, 'object.name')}.${_.get(path, 'property.name')}`
Expand Down
9 changes: 4 additions & 5 deletions build/gulp/tasks/dist.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { task, series, parallel, src, dest } from 'gulp'
import loadPlugins from 'gulp-load-plugins'
import merge2 from 'merge2'
import rimraf from 'rimraf'
import webpack from 'webpack'
import * as merge2 from 'merge2'
import * as rimraf from 'rimraf'
import * as webpack from 'webpack'

import config from '../../../config'

const { paths } = config
const g = loadPlugins()
const g = require('gulp-load-plugins')()
const { log, PluginError } = g.util

// ----------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions build/gulp/tasks/dll.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { task, series } from 'gulp'
import loadPlugins from 'gulp-load-plugins'
import rimraf from 'rimraf'
import webpack from 'webpack'
import * as rimraf from 'rimraf'
import * as webpack from 'webpack'

import config from '../../../config'

const g = loadPlugins()
const g = require('gulp-load-plugins')()
const { log, PluginError } = g.util

// ----------------------------------------
Expand Down
21 changes: 10 additions & 11 deletions build/gulp/tasks/docs.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import historyApiFallback from 'connect-history-api-fallback'
import express from 'express'
import * as historyApiFallback from 'connect-history-api-fallback'
import * as express from 'express'
import { task, src, dest, lastRun, parallel, series, watch } from 'gulp'
import loadPlugins from 'gulp-load-plugins'
import path from 'path'
import rimraf from 'rimraf'
import through from 'through2'
import webpack from 'webpack'
import WebpackDevMiddleware from 'webpack-dev-middleware'
import WebpackHotMiddleware from 'webpack-hot-middleware'
import * as path from 'path'
import * as rimraf from 'rimraf'
import * as through2 from 'through2'
import * as webpack from 'webpack'
import * as WebpackDevMiddleware from 'webpack-dev-middleware'
import * as WebpackHotMiddleware from 'webpack-hot-middleware'

import sh from '../sh'
import config from '../../../config'
Expand All @@ -16,7 +15,7 @@ import gulpExampleMenu from '../plugins/gulp-example-menu'
import gulpReactDocgen from '../plugins/gulp-react-docgen'

const { paths } = config
const g = loadPlugins()
const g = require('gulp-load-plugins')()
const { colors, log, PluginError } = g.util

const handleWatchChange = e => log(`File ${e.path} was ${e.type}, running tasks...`)
Expand Down Expand Up @@ -90,7 +89,7 @@ task('build:docs:images', () =>

task('build:docs:toc', () =>
src(markdownSrc, { since: lastRun('build:docs:toc') }).pipe(
through.obj((file, enc, done) => {
through2.obj((file, enc, done) => {
sh(`doctoc ${file.path} --github --maxlevel 4 && git add ${file.path}`, done)
}),
),
Expand Down
4 changes: 2 additions & 2 deletions build/gulp/tasks/generate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import config from '../../../../config'
import rename from 'gulp-rename'
import replace from 'gulp-replace'
import inquirer from 'inquirer'
import path from 'path'
import fs from 'fs'
import * as path from 'path'
import * as fs from 'fs'

const { paths } = config
const TEMPLATE_PLACEHOLDER = 'TEMPLATE_COMPONENT__'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'
import { TEMPLATE_COMPONENT__ } from '@stardust-ui/react'

const TEMPLATE_COMPONENT__Example = () => <TEMPLATE_COMPONENT__ />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'
import Types from './Types'

const TEMPLATE_COMPONENT__Examples = () => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'

const TEMPLATE_COMPONENT__: any = (props: any) => <div>Hello from TEMPLATE_COMPONENT__!</div>

Expand Down
1 change: 0 additions & 1 deletion build/tsconfig.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"moduleResolution": "node",
"sourceMap": true,
"allowJs": false,
"esModuleInterop": true,
"noImplicitReturns": false,
"noImplicitThis": false,
"noImplicitAny": false,
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.config.dll.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import webpack from 'webpack'
import * as webpack from 'webpack'
import config from '../config'

const { paths } = config
Expand Down
4 changes: 2 additions & 2 deletions build/webpack.config.umd.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import webpack from 'webpack'
import * as webpack from 'webpack'

import config from '../config'
import pkg from '../package.json'
import webpackConfig from '../webpack.config'

const pkg = require('../package.json')
const { paths } = config

const webpackUMDConfig = {
Expand Down
2 changes: 1 addition & 1 deletion config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path'
import * as path from 'path'

// ------------------------------------
// Environment vars
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'
import { Menu } from 'semantic-ui-react'

import { updateForKeys } from 'docs/src/hoc'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'

export default class ComponentControlsCopyLink extends Component<any, any> {
export default class ComponentControlsCopyLink extends React.Component<any, any> {
private mounted: boolean
private readonly btnLabel = 'Permalink'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash'
import * as _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'
import { NavLink } from 'react-router-dom'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'

import { updateForKeys } from 'docs/src/hoc'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'

import { updateForKeys } from 'docs/src/hoc'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'
import { Icon, Menu } from 'semantic-ui-react'

import { updateForKeys } from 'docs/src/hoc'
Expand Down
10 changes: 5 additions & 5 deletions docs/src/components/ComponentDoc/ComponentDoc.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash'
import * as _ from 'lodash'
import PropTypes from 'prop-types'
import React, { Component, CSSProperties } from 'react'
import * as React from 'react'
import DocumentTitle from 'react-document-title'
import { withRouter } from 'react-router'
import { Grid, Header, Icon } from 'semantic-ui-react'
Expand All @@ -16,13 +16,13 @@ import ComponentSidebar from './ComponentSidebar'
import ComponentDocTag from './ComponentDocTag'

const topRowStyle = { margin: '1em' }
const exampleEndStyle: CSSProperties = {
const exampleEndStyle: React.CSSProperties = {
textAlign: 'center',
opacity: 0.5,
paddingTop: '75vh',
}

class ComponentDoc extends Component<any, any> {
class ComponentDoc extends React.Component<any, any> {
static childContextTypes = {
onPassed: PropTypes.func,
}
Expand Down Expand Up @@ -103,7 +103,7 @@ class ComponentDoc extends Component<any, any> {
</Grid.Row>

<Grid.Row columns="equal">
<Grid.Column style={{ padding: '0 0 0 28px' } as CSSProperties}>
<Grid.Column style={{ padding: '0 0 0 28px' } as React.CSSProperties}>
<div ref={this.handleExamplesRef}>
<ComponentExamples displayName={info.displayName} />
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/ComponentDoc/ComponentDocLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React, { PureComponent } from 'react'
import * as React from 'react'
import { List } from 'semantic-ui-react'

import { repoURL } from '../../utils'
Expand All @@ -14,7 +14,7 @@ const linkListStyle = {
top: '0',
}

export default class ComponentDocLinks extends PureComponent<any, any> {
export default class ComponentDocLinks extends React.PureComponent<any, any> {
static propTypes = {
repoPath: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/ComponentDoc/ComponentDocSee.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash'
import * as _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'
import { Link } from 'react-router-dom'
import { Header, List } from 'semantic-ui-react'

Expand Down
6 changes: 3 additions & 3 deletions docs/src/components/ComponentDoc/ComponentDocTag.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { Component } from 'react'
import _ from 'lodash'
import * as React from 'react'
import * as _ from 'lodash'
import { Header, Message } from 'semantic-ui-react'

const headerStyle = {
whiteSpace: 'pre-line',
}

class ComponentDocTag extends Component<any, any> {
class ComponentDocTag extends React.Component<any, any> {
getTagDescription = (forTag, fromInfo) => {
const tags = (fromInfo.docblock && fromInfo.docblock.tags) || []
return _.result(_.find(tags, 'title', forTag), 'description')
Expand Down

0 comments on commit 75c139d

Please sign in to comment.