Skip to content

Commit ff5888f

Browse files
layershifterlevithomason
authored andcommitted
chore(package): update all dependencies (Semantic-Org#1895)
* 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 Semantic-Org#1938 * style(docs): revert tests changes, splitted to Semantic-Org#1939 * style(mixed): restore formatting * style(mixed): revert tests changes, splitted to Semantic-Org#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
1 parent 7b94bf2 commit ff5888f

File tree

103 files changed

+2338
-1934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2338
-1934
lines changed

.eslintrc

+28-43
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,38 @@
11
{
2-
"plugins": [
3-
"jsx-a11y"
4-
],
5-
"extends": [
6-
"plugin:jsx-a11y/recommended",
7-
"ta",
8-
"ta/frontend"
9-
],
2+
"parser": "babel-eslint",
3+
"extends": "airbnb",
4+
"env": {
5+
"browser": true
6+
},
107
"rules": {
11-
"complexity": [1, 10],
8+
"class-methods-use-this": 0,
129
"consistent-return": 0,
13-
"no-confusing-arrow": 0,
14-
"jsx-a11y/accessible-emoji": 1,
15-
"jsx-a11y/anchor-has-content": 1,
16-
"jsx-a11y/aria-activedescendant-has-tabindex": 1,
17-
"jsx-a11y/aria-props": 1,
18-
"jsx-a11y/aria-proptypes": 1,
19-
"jsx-a11y/aria-role": 1,
20-
"jsx-a11y/aria-unsupported-elements": 1,
21-
"jsx-a11y/click-events-have-key-events": 1,
22-
"jsx-a11y/heading-has-content": 1,
23-
"jsx-a11y/href-no-hash": 1,
24-
"jsx-a11y/html-has-lang": 1,
25-
"jsx-a11y/iframe-has-title": 1,
26-
"jsx-a11y/img-has-alt": 1,
27-
"jsx-a11y/img-redundant-alt": 1,
28-
"jsx-a11y/label-has-for": 1,
29-
"jsx-a11y/lang": 1,
30-
"jsx-a11y/mouse-events-have-key-events": 1,
31-
"jsx-a11y/no-access-key": 1,
32-
"jsx-a11y/no-autofocus": 1,
33-
"jsx-a11y/no-distracting-elements": 1,
34-
"jsx-a11y/no-onchange": 1,
35-
"jsx-a11y/no-redundant-roles": 1,
36-
"jsx-a11y/no-static-element-interactions": 1,
37-
"jsx-a11y/onclick-has-focus": 1,
38-
"jsx-a11y/onclick-has-role": 1,
39-
"jsx-a11y/role-has-required-aria-props": 1,
40-
"jsx-a11y/role-supports-aria-props": 1,
41-
"jsx-a11y/scope": 1,
42-
"jsx-a11y/tabindex-no-positive": 1,
43-
"react/jsx-curly-spacing": 0,
44-
"react/sort-comp": 0,
45-
"semi": [2, "never"],
10+
"complexity": [1, 10],
11+
"global-require": 0,
12+
"jsx-quotes": [2, "prefer-single"],
13+
"max-len": [2, 120, 4],
14+
"no-console": 2,
15+
"no-multi-spaces": [2, { "ignoreEOLComments": true }],
16+
"no-return-assign": [2, "except-parens"],
17+
"no-underscore-dangle": 0,
4618
"padded-blocks": [2, {
4719
"blocks": "never",
4820
"switches": "never",
4921
"classes": "never"
5022
}],
51-
"valid-jsdoc": 0
23+
"semi": [2, "never"],
24+
"jsx-a11y/alt-text": 1,
25+
"jsx-a11y/label-has-for": 1,
26+
"jsx-a11y/role-has-required-aria-props": 1,
27+
"import/no-dynamic-require": 0,
28+
"import/no-extraneous-dependencies": 0,
29+
"import/no-unresolved": 0,
30+
"import/no-webpack-loader-syntax": 0,
31+
"import/extensions": 0,
32+
"react/forbid-prop-types": 0,
33+
"react/jsx-filename-extension": [2, { "extensions": [".js"] }],
34+
"react/no-unused-prop-types": 0,
35+
"react/sort-comp": 0,
36+
"react/require-default-props": 0
5237
}
5338
}

config.js

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
const path = require('path')
1+
import path from 'path'
22

33
// ------------------------------------
44
// Environment vars
55
// ------------------------------------
66
const env = process.env.NODE_ENV || 'development'
77
const __DEV__ = env === 'development'
8-
const __STAGING__ = env === 'staging'
98
const __TEST__ = env === 'test'
109
const __PROD__ = env === 'production'
1110

12-
let config = {
11+
const envConfig = {
1312
env,
1413

1514
// ----------------------------------
@@ -27,19 +26,20 @@ let config = {
2726
// ------------------------------------
2827
// Paths
2928
// ------------------------------------
30-
const base = (...args) => path.resolve(...[config.path_base, ...args])
29+
const base = (...args) => path.resolve(...[envConfig.path_base, ...args])
3130

3231
const paths = {
3332
base,
34-
src: base.bind(null, config.dir_src),
35-
dist: base.bind(null, config.dir_dist),
36-
dll: base.bind(null, config.dir_dll),
37-
docsDist: base.bind(null, config.dir_docs_dist),
38-
docsSrc: base.bind(null, config.dir_docs_src),
39-
umdDist: base.bind(null, config.dir_umd_dist),
33+
src: base.bind(null, envConfig.dir_src),
34+
dist: base.bind(null, envConfig.dir_dist),
35+
dll: base.bind(null, envConfig.dir_dll),
36+
docsDist: base.bind(null, envConfig.dir_docs_dist),
37+
docsSrc: base.bind(null, envConfig.dir_docs_src),
38+
umdDist: base.bind(null, envConfig.dir_umd_dist),
4039
}
4140

42-
config = Object.assign({}, config, {
41+
const config = {
42+
...envConfig,
4343
paths,
4444

4545
// ----------------------------------
@@ -51,22 +51,21 @@ config = Object.assign({}, config, {
5151
// ----------------------------------
5252
// Compiler Configuration
5353
// ----------------------------------
54-
compiler_devtool: (__DEV__ || __TEST__) && 'cheap-source-map' || __STAGING__ && 'source-map',
54+
compiler_devtool: (__DEV__ || __TEST__) && 'cheap-source-map',
5555
compiler_globals: {
5656
process: {
5757
env: {
5858
NODE_ENV: JSON.stringify(env),
5959
},
6060
},
6161
__DEV__,
62-
__STAGING__,
6362
__PATH_SEP__: JSON.stringify(path.sep),
6463
__TEST__,
6564
__PROD__,
6665
},
6766
compiler_hash_type: __PROD__ ? 'chunkhash' : 'hash',
6867
compiler_fail_on_warning: __TEST__ || __PROD__,
69-
compiler_output_path: paths.base(config.dir_docs_dist),
68+
compiler_output_path: paths.base(envConfig.dir_docs_dist),
7069
compiler_public_path: __PROD__ ? '//raw.github.com/Semantic-Org/Semantic-UI-React/gh-pages/' : '/',
7170
compiler_stats: {
7271
hash: false, // the hash of the compilation
@@ -100,6 +99,6 @@ config = Object.assign({}, config, {
10099
'react-ace',
101100
'react-dom',
102101
],
103-
})
102+
}
104103

105-
module.exports = config
104+
export default config

docs/.eslintrc

+4-27
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,17 @@
11
{
22
"globals": {
33
"__DEV__": false,
4-
"__STAGING__": false,
54
"__TEST__": false,
65
"__PATH_SEP__": false,
76
"__PROD__": false
87
},
98
"rules": {
10-
"jsx-a11y/accessible-emoji": 0,
11-
"jsx-a11y/anchor-has-content": 0,
12-
"jsx-a11y/aria-activedescendant-has-tabindex": 0,
13-
"jsx-a11y/aria-props": 0,
14-
"jsx-a11y/aria-proptypes": 0,
15-
"jsx-a11y/aria-role": 0,
16-
"jsx-a11y/aria-unsupported-elements": 0,
17-
"jsx-a11y/click-events-have-key-events": 0,
18-
"jsx-a11y/heading-has-content": 0,
9+
"jsx-a11y/alt-text": 0,
1910
"jsx-a11y/href-no-hash": 0,
20-
"jsx-a11y/html-has-lang": 0,
21-
"jsx-a11y/iframe-has-title": 0,
22-
"jsx-a11y/img-has-alt": 0,
23-
"jsx-a11y/img-redundant-alt": 0,
2411
"jsx-a11y/label-has-for": 0,
25-
"jsx-a11y/lang": 0,
26-
"jsx-a11y/mouse-events-have-key-events": 0,
27-
"jsx-a11y/no-access-key": 0,
28-
"jsx-a11y/no-autofocus": 0,
29-
"jsx-a11y/no-distracting-elements": 0,
30-
"jsx-a11y/no-onchange": 0,
31-
"jsx-a11y/no-redundant-roles": 0,
3212
"jsx-a11y/no-static-element-interactions": 0,
33-
"jsx-a11y/onclick-has-focus": 0,
34-
"jsx-a11y/onclick-has-role": 0,
35-
"jsx-a11y/role-has-required-aria-props": 0,
36-
"jsx-a11y/role-supports-aria-props": 0,
37-
"jsx-a11y/scope": 0,
38-
"jsx-a11y/tabindex-no-positive": 0
13+
"react/no-array-index-key": 0,
14+
"react/no-render-return-value": 0,
15+
"react/no-unescaped-entities": 0
3916
}
4017
}

docs/app/Components/ComponentDoc/ComponentDoc.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ import React, { Component } from 'react'
55
import DocumentTitle from 'react-document-title'
66
import { Link } from 'react-router-dom'
77

8-
import ComponentExamples from './ComponentExamples'
9-
import ComponentProps from './ComponentProps'
10-
import docgenInfo from '../../docgenInfo.json'
11-
128
import { repoURL } from 'docs/app/utils'
139
import { META } from 'src/lib'
1410
import * as semanticUIReact from 'src'
15-
import { Divider, Grid, Header, Icon, List } from 'src'
11+
import docgenInfo from '../../docgenInfo.json'
12+
import ComponentExamples from './ComponentExamples'
13+
import ComponentProps from './ComponentProps'
14+
15+
const { Divider, Grid, Header, Icon, List } = semanticUIReact
1616

1717
const docgenPaths = _.keys(docgenInfo)
1818

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

21-
const getDocgenPath = (componentName) => _.find(docgenPaths, path => {
22-
return new RegExp(`${__PATH_SEP__}${componentName}.js$`).test(path)
23-
})
21+
const getDocgenPath = componentName => _.find(docgenPaths, path => (
22+
new RegExp(`${__PATH_SEP__}${componentName}.js$`).test(path)
23+
))
2424

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

2828
const getGithubSourceUrl = (componentName) => {
2929
const posixPath = getPosixPath(componentName)
@@ -35,9 +35,9 @@ const getGithubEditUrl = (componentName) => {
3535
return `${repoURL}/edit/master/${posixPath}`
3636
}
3737

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

4242
const showPropsStyle = {
4343
display: 'inline-flex',
@@ -217,7 +217,7 @@ export default class ComponentDoc extends Component {
217217
{docgen.docBlock.description || (
218218
<span>
219219
<a href={getGithubEditUrl(_meta.name)}>Add a description</a>. Instructions are{' '}
220-
<a href={`${repoURL}/blob/master/.github/CONTRIBUTING.md#components` }>
220+
<a href={`${repoURL}/blob/master/.github/CONTRIBUTING.md#components`}>
221221
here.
222222
</a>
223223
{' '}Description is in the SUI Docs, right there <Icon name='pointing right' />

docs/app/Components/ComponentDoc/ComponentExample.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import { renderToStaticMarkup } from 'react-dom/server'
77
import { html } from 'js-beautify'
88
import copyToClipboard from 'copy-to-clipboard'
99

10-
import { exampleContext, repoURL } from 'docs/app/utils'
10+
import { exampleContext, repoURL, scrollToAnchor } from 'docs/app/utils'
1111
import { Divider, Grid, Icon, Header, Menu, Popup } from 'src'
1212
import Editor from 'docs/app/Components/Editor/Editor'
13-
import { scrollToAnchor } from 'docs/app/utils'
1413

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

9594
setHashAndScroll = () => {
9695
const { history } = this.props
97-
history.replace(location.pathname + '#' + this.anchorName)
96+
history.replace(`${location.pathname}#${this.anchorName}`)
9897
scrollToAnchor()
9998
}
10099

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

239238
if (!isValidElement(exampleElement)) {
240-
this.renderError('Default export is not a valid element. Type:' + {}.toString.call(exampleElement))
239+
this.renderError(`Default export is not a valid element. Type:${{}.toString.call(exampleElement)}`)
241240
} else {
242241
// immediately render a null error
243242
// but also ensure the last debounced error call is a null error

docs/app/Components/ComponentDoc/ComponentProps.js

+18-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import _ from 'lodash'
22
import PropTypes from 'prop-types'
33
import React, { Component } from 'react'
44

5-
import { Header, Icon, Popup, Table } from 'src'
5+
import { Icon, Popup, Table } from 'src'
66

77
const extraDescriptionStyle = {
88
color: '#666',
@@ -25,7 +25,7 @@ Extra.propTypes = {
2525
title: PropTypes.node,
2626
}
2727

28-
const getTagType = tag => tag.type.type === 'AllLiteral' ? 'any' : tag.type.name
28+
const getTagType = tag => (tag.type.type === 'AllLiteral' ? 'any' : tag.type.name)
2929

3030
/**
3131
* Displays a table of a Component's PropTypes.
@@ -48,7 +48,7 @@ export default class ComponentProps extends Component {
4848
showEnumsFor: {},
4949
}
5050

51-
toggleEnumsFor = (prop) => () => {
51+
toggleEnumsFor = prop => () => {
5252
this.setState({
5353
showEnumsFor: {
5454
...this.state.showEnumsFor,
@@ -70,7 +70,7 @@ export default class ComponentProps extends Component {
7070
/>
7171
)
7272

73-
renderDefaultValue = item => {
73+
renderDefaultValue = (item) => {
7474
const defaultValue = _.get(item, 'defaultValue.value')
7575
if (_.isNil(defaultValue)) return null
7676

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

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

146-
renderRow = item => {
147-
return (
148-
<Table.Row key={item.name}>
149-
<Table.Cell collapsing>{this.renderName(item)}{this.renderRequired(item)}</Table.Cell>
150-
<Table.Cell collapsing>{this.renderDefaultValue(item)}</Table.Cell>
151-
<Table.Cell collapsing>{item.type}</Table.Cell>
152-
<Table.Cell>
153-
{item.description && <p>{item.description}</p>}
154-
{this.renderFunctionSignature(item)}
155-
{this.renderEnums(item)}
156-
</Table.Cell>
157-
</Table.Row>
158-
)
159-
}
146+
renderRow = item => (
147+
<Table.Row key={item.name}>
148+
<Table.Cell collapsing>{this.renderName(item)}{this.renderRequired(item)}</Table.Cell>
149+
<Table.Cell collapsing>{this.renderDefaultValue(item)}</Table.Cell>
150+
<Table.Cell collapsing>{item.type}</Table.Cell>
151+
<Table.Cell>
152+
{item.description && <p>{item.description}</p>}
153+
{this.renderFunctionSignature(item)}
154+
{this.renderEnums(item)}
155+
</Table.Cell>
156+
</Table.Row>
157+
)
160158

161159
render() {
162160
const { props: propsDefinition } = this.props
@@ -165,7 +163,7 @@ export default class ComponentProps extends Component {
165163
const value = _.get(config, 'type.value')
166164
let type = _.get(config, 'type.name')
167165
if (type === 'union') {
168-
type = _.map(value, (val) => val.name).join('|')
166+
type = _.map(value, val => val.name).join('|')
169167
}
170168
type = type && `{${type}}`
171169

0 commit comments

Comments
 (0)