Skip to content

Commit

Permalink
chore(package): update all dependencies (#1895)
Browse files Browse the repository at this point in the history
* chore(package): update all dependencies

* style(mixed): fix lint issues

* chore(package): update deps, add es6 support to configs

* style(docs): revert Table and Menu changes, splitted to #1938

* style(docs): revert tests changes, splitted to #1939

* style(mixed): restore formatting

* style(mixed): revert tests changes, splitted to #1949

* style(configs): ESify configs

* chore(package): update deps

* style(mixed): fix lint issues

* style(eslint): cleanup configs

* fix(configs): fix import of webpack config

* chore(package): update package-lock.json
  • Loading branch information
layershifter authored and levithomason committed Aug 20, 2017
1 parent 7b94bf2 commit ff5888f
Show file tree
Hide file tree
Showing 103 changed files with 2,338 additions and 1,934 deletions.
71 changes: 28 additions & 43 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,53 +1,38 @@
{
"plugins": [
"jsx-a11y"
],
"extends": [
"plugin:jsx-a11y/recommended",
"ta",
"ta/frontend"
],
"parser": "babel-eslint",
"extends": "airbnb",
"env": {
"browser": true
},
"rules": {
"complexity": [1, 10],
"class-methods-use-this": 0,
"consistent-return": 0,
"no-confusing-arrow": 0,
"jsx-a11y/accessible-emoji": 1,
"jsx-a11y/anchor-has-content": 1,
"jsx-a11y/aria-activedescendant-has-tabindex": 1,
"jsx-a11y/aria-props": 1,
"jsx-a11y/aria-proptypes": 1,
"jsx-a11y/aria-role": 1,
"jsx-a11y/aria-unsupported-elements": 1,
"jsx-a11y/click-events-have-key-events": 1,
"jsx-a11y/heading-has-content": 1,
"jsx-a11y/href-no-hash": 1,
"jsx-a11y/html-has-lang": 1,
"jsx-a11y/iframe-has-title": 1,
"jsx-a11y/img-has-alt": 1,
"jsx-a11y/img-redundant-alt": 1,
"jsx-a11y/label-has-for": 1,
"jsx-a11y/lang": 1,
"jsx-a11y/mouse-events-have-key-events": 1,
"jsx-a11y/no-access-key": 1,
"jsx-a11y/no-autofocus": 1,
"jsx-a11y/no-distracting-elements": 1,
"jsx-a11y/no-onchange": 1,
"jsx-a11y/no-redundant-roles": 1,
"jsx-a11y/no-static-element-interactions": 1,
"jsx-a11y/onclick-has-focus": 1,
"jsx-a11y/onclick-has-role": 1,
"jsx-a11y/role-has-required-aria-props": 1,
"jsx-a11y/role-supports-aria-props": 1,
"jsx-a11y/scope": 1,
"jsx-a11y/tabindex-no-positive": 1,
"react/jsx-curly-spacing": 0,
"react/sort-comp": 0,
"semi": [2, "never"],
"complexity": [1, 10],
"global-require": 0,
"jsx-quotes": [2, "prefer-single"],
"max-len": [2, 120, 4],
"no-console": 2,
"no-multi-spaces": [2, { "ignoreEOLComments": true }],
"no-return-assign": [2, "except-parens"],
"no-underscore-dangle": 0,
"padded-blocks": [2, {
"blocks": "never",
"switches": "never",
"classes": "never"
}],
"valid-jsdoc": 0
"semi": [2, "never"],
"jsx-a11y/alt-text": 1,
"jsx-a11y/label-has-for": 1,
"jsx-a11y/role-has-required-aria-props": 1,
"import/no-dynamic-require": 0,
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0,
"import/no-webpack-loader-syntax": 0,
"import/extensions": 0,
"react/forbid-prop-types": 0,
"react/jsx-filename-extension": [2, { "extensions": [".js"] }],
"react/no-unused-prop-types": 0,
"react/sort-comp": 0,
"react/require-default-props": 0
}
}
31 changes: 15 additions & 16 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
const path = require('path')
import path from 'path'

// ------------------------------------
// Environment vars
// ------------------------------------
const env = process.env.NODE_ENV || 'development'
const __DEV__ = env === 'development'
const __STAGING__ = env === 'staging'
const __TEST__ = env === 'test'
const __PROD__ = env === 'production'

let config = {
const envConfig = {
env,

// ----------------------------------
Expand All @@ -27,19 +26,20 @@ let config = {
// ------------------------------------
// Paths
// ------------------------------------
const base = (...args) => path.resolve(...[config.path_base, ...args])
const base = (...args) => path.resolve(...[envConfig.path_base, ...args])

const paths = {
base,
src: base.bind(null, config.dir_src),
dist: base.bind(null, config.dir_dist),
dll: base.bind(null, config.dir_dll),
docsDist: base.bind(null, config.dir_docs_dist),
docsSrc: base.bind(null, config.dir_docs_src),
umdDist: base.bind(null, config.dir_umd_dist),
src: base.bind(null, envConfig.dir_src),
dist: base.bind(null, envConfig.dir_dist),
dll: base.bind(null, envConfig.dir_dll),
docsDist: base.bind(null, envConfig.dir_docs_dist),
docsSrc: base.bind(null, envConfig.dir_docs_src),
umdDist: base.bind(null, envConfig.dir_umd_dist),
}

config = Object.assign({}, config, {
const config = {
...envConfig,
paths,

// ----------------------------------
Expand All @@ -51,22 +51,21 @@ config = Object.assign({}, config, {
// ----------------------------------
// Compiler Configuration
// ----------------------------------
compiler_devtool: (__DEV__ || __TEST__) && 'cheap-source-map' || __STAGING__ && 'source-map',
compiler_devtool: (__DEV__ || __TEST__) && 'cheap-source-map',
compiler_globals: {
process: {
env: {
NODE_ENV: JSON.stringify(env),
},
},
__DEV__,
__STAGING__,
__PATH_SEP__: JSON.stringify(path.sep),
__TEST__,
__PROD__,
},
compiler_hash_type: __PROD__ ? 'chunkhash' : 'hash',
compiler_fail_on_warning: __TEST__ || __PROD__,
compiler_output_path: paths.base(config.dir_docs_dist),
compiler_output_path: paths.base(envConfig.dir_docs_dist),
compiler_public_path: __PROD__ ? '//raw.github.com/Semantic-Org/Semantic-UI-React/gh-pages/' : '/',
compiler_stats: {
hash: false, // the hash of the compilation
Expand Down Expand Up @@ -100,6 +99,6 @@ config = Object.assign({}, config, {
'react-ace',
'react-dom',
],
})
}

module.exports = config
export default config
31 changes: 4 additions & 27 deletions docs/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
{
"globals": {
"__DEV__": false,
"__STAGING__": false,
"__TEST__": false,
"__PATH_SEP__": false,
"__PROD__": false
},
"rules": {
"jsx-a11y/accessible-emoji": 0,
"jsx-a11y/anchor-has-content": 0,
"jsx-a11y/aria-activedescendant-has-tabindex": 0,
"jsx-a11y/aria-props": 0,
"jsx-a11y/aria-proptypes": 0,
"jsx-a11y/aria-role": 0,
"jsx-a11y/aria-unsupported-elements": 0,
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/heading-has-content": 0,
"jsx-a11y/alt-text": 0,
"jsx-a11y/href-no-hash": 0,
"jsx-a11y/html-has-lang": 0,
"jsx-a11y/iframe-has-title": 0,
"jsx-a11y/img-has-alt": 0,
"jsx-a11y/img-redundant-alt": 0,
"jsx-a11y/label-has-for": 0,
"jsx-a11y/lang": 0,
"jsx-a11y/mouse-events-have-key-events": 0,
"jsx-a11y/no-access-key": 0,
"jsx-a11y/no-autofocus": 0,
"jsx-a11y/no-distracting-elements": 0,
"jsx-a11y/no-onchange": 0,
"jsx-a11y/no-redundant-roles": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/onclick-has-focus": 0,
"jsx-a11y/onclick-has-role": 0,
"jsx-a11y/role-has-required-aria-props": 0,
"jsx-a11y/role-supports-aria-props": 0,
"jsx-a11y/scope": 0,
"jsx-a11y/tabindex-no-positive": 0
"react/no-array-index-key": 0,
"react/no-render-return-value": 0,
"react/no-unescaped-entities": 0
}
}
26 changes: 13 additions & 13 deletions docs/app/Components/ComponentDoc/ComponentDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import React, { Component } from 'react'
import DocumentTitle from 'react-document-title'
import { Link } from 'react-router-dom'

import ComponentExamples from './ComponentExamples'
import ComponentProps from './ComponentProps'
import docgenInfo from '../../docgenInfo.json'

import { repoURL } from 'docs/app/utils'
import { META } from 'src/lib'
import * as semanticUIReact from 'src'
import { Divider, Grid, Header, Icon, List } from 'src'
import docgenInfo from '../../docgenInfo.json'
import ComponentExamples from './ComponentExamples'
import ComponentProps from './ComponentProps'

const { Divider, Grid, Header, Icon, List } = semanticUIReact

const docgenPaths = _.keys(docgenInfo)

const pathSepRegEx = new RegExp(_.escapeRegExp(__PATH_SEP__), 'g')

const getDocgenPath = (componentName) => _.find(docgenPaths, path => {
return new RegExp(`${__PATH_SEP__}${componentName}.js$`).test(path)
})
const getDocgenPath = componentName => _.find(docgenPaths, path => (
new RegExp(`${__PATH_SEP__}${componentName}.js$`).test(path)
))

// no matter the OS path separator, use '/'
const getPosixPath = (componentName) => getDocgenPath(componentName).replace(pathSepRegEx, '/')
const getPosixPath = componentName => getDocgenPath(componentName).replace(pathSepRegEx, '/')

const getGithubSourceUrl = (componentName) => {
const posixPath = getPosixPath(componentName)
Expand All @@ -35,9 +35,9 @@ const getGithubEditUrl = (componentName) => {
return `${repoURL}/edit/master/${posixPath}`
}

const getSemanticUIDocsUrl = (_meta) => {
return `https://semantic-ui.com/${_meta.type}s/${_meta.parent || _meta.name}`.toLowerCase()
}
const getSemanticUIDocsUrl = _meta => (
`https://semantic-ui.com/${_meta.type}s/${_meta.parent || _meta.name}`.toLowerCase()
)

const showPropsStyle = {
display: 'inline-flex',
Expand Down Expand Up @@ -217,7 +217,7 @@ export default class ComponentDoc extends Component {
{docgen.docBlock.description || (
<span>
<a href={getGithubEditUrl(_meta.name)}>Add a description</a>. Instructions are{' '}
<a href={`${repoURL}/blob/master/.github/CONTRIBUTING.md#components` }>
<a href={`${repoURL}/blob/master/.github/CONTRIBUTING.md#components`}>
here.
</a>
{' '}Description is in the SUI Docs, right there <Icon name='pointing right' />
Expand Down
9 changes: 4 additions & 5 deletions docs/app/Components/ComponentDoc/ComponentExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { renderToStaticMarkup } from 'react-dom/server'
import { html } from 'js-beautify'
import copyToClipboard from 'copy-to-clipboard'

import { exampleContext, repoURL } from 'docs/app/utils'
import { exampleContext, repoURL, scrollToAnchor } from 'docs/app/utils'
import { Divider, Grid, Icon, Header, Menu, Popup } from 'src'
import Editor from 'docs/app/Components/Editor/Editor'
import { scrollToAnchor } from 'docs/app/utils'

const babelConfig = {
presets: ['es2015', 'react', 'stage-1'],
Expand Down Expand Up @@ -94,7 +93,7 @@ class ComponentExample extends Component {

setHashAndScroll = () => {
const { history } = this.props
history.replace(location.pathname + '#' + this.anchorName)
history.replace(`${location.pathname}#${this.anchorName}`)
scrollToAnchor()
}

Expand Down Expand Up @@ -197,7 +196,7 @@ class ComponentExample extends Component {
.replace(/ import/g, '\nimport') // one import per line
.split('\n') // split lines
.filter(Boolean) // remove empty lines
.map(l => { // rewrite imports to const statements
.map((l) => { // rewrite imports to const statements
const [
defaultImport,
destructuredImports,
Expand Down Expand Up @@ -237,7 +236,7 @@ class ComponentExample extends Component {
const exampleElement = _.isFunction(Example) ? <Example /> : Example

if (!isValidElement(exampleElement)) {
this.renderError('Default export is not a valid element. Type:' + {}.toString.call(exampleElement))
this.renderError(`Default export is not a valid element. Type:${{}.toString.call(exampleElement)}`)
} else {
// immediately render a null error
// but also ensure the last debounced error call is a null error
Expand Down
38 changes: 18 additions & 20 deletions docs/app/Components/ComponentDoc/ComponentProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash'
import PropTypes from 'prop-types'
import React, { Component } from 'react'

import { Header, Icon, Popup, Table } from 'src'
import { Icon, Popup, Table } from 'src'

const extraDescriptionStyle = {
color: '#666',
Expand All @@ -25,7 +25,7 @@ Extra.propTypes = {
title: PropTypes.node,
}

const getTagType = tag => tag.type.type === 'AllLiteral' ? 'any' : tag.type.name
const getTagType = tag => (tag.type.type === 'AllLiteral' ? 'any' : tag.type.name)

/**
* Displays a table of a Component's PropTypes.
Expand All @@ -48,7 +48,7 @@ export default class ComponentProps extends Component {
showEnumsFor: {},
}

toggleEnumsFor = (prop) => () => {
toggleEnumsFor = prop => () => {
this.setState({
showEnumsFor: {
...this.state.showEnumsFor,
Expand All @@ -70,7 +70,7 @@ export default class ComponentProps extends Component {
/>
)

renderDefaultValue = item => {
renderDefaultValue = (item) => {
const defaultValue = _.get(item, 'defaultValue.value')
if (_.isNil(defaultValue)) return null

Expand All @@ -91,7 +91,7 @@ export default class ComponentProps extends Component {
.filter(p => !_.includes(p, '.'))
.join(', ')

const tagDescriptionRows = _.compact([...params, returns]).map(tag => {
const tagDescriptionRows = _.compact([...params, returns]).map((tag) => {
const name = tag.name || tag.title
return (
<div key={name} style={{ display: 'flex', flexDirection: 'row' }}>
Expand Down Expand Up @@ -143,20 +143,18 @@ export default class ComponentProps extends Component {
)
}

renderRow = item => {
return (
<Table.Row key={item.name}>
<Table.Cell collapsing>{this.renderName(item)}{this.renderRequired(item)}</Table.Cell>
<Table.Cell collapsing>{this.renderDefaultValue(item)}</Table.Cell>
<Table.Cell collapsing>{item.type}</Table.Cell>
<Table.Cell>
{item.description && <p>{item.description}</p>}
{this.renderFunctionSignature(item)}
{this.renderEnums(item)}
</Table.Cell>
</Table.Row>
)
}
renderRow = item => (
<Table.Row key={item.name}>
<Table.Cell collapsing>{this.renderName(item)}{this.renderRequired(item)}</Table.Cell>
<Table.Cell collapsing>{this.renderDefaultValue(item)}</Table.Cell>
<Table.Cell collapsing>{item.type}</Table.Cell>
<Table.Cell>
{item.description && <p>{item.description}</p>}
{this.renderFunctionSignature(item)}
{this.renderEnums(item)}
</Table.Cell>
</Table.Row>
)

render() {
const { props: propsDefinition } = this.props
Expand All @@ -165,7 +163,7 @@ export default class ComponentProps extends Component {
const value = _.get(config, 'type.value')
let type = _.get(config, 'type.name')
if (type === 'union') {
type = _.map(value, (val) => val.name).join('|')
type = _.map(value, val => val.name).join('|')
}
type = type && `{${type}}`

Expand Down
Loading

0 comments on commit ff5888f

Please sign in to comment.