Skip to content

Commit

Permalink
Major version dependency upgrades, pt. IV (#4112)
Browse files Browse the repository at this point in the history
* eslint; prettier

* react-datepicker eslint

* prettier autofix

* more eslint

* CL

* Revert "CL"

This reverts commit 745d9a0.

* lint
  • Loading branch information
thompsongl authored Oct 8, 2020
1 parent b088c36 commit 5e4c3e2
Show file tree
Hide file tree
Showing 465 changed files with 1,815 additions and 1,864 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.3",
"enzyme-to-json": "^3.5.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-webpack": "^0.12.2",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint-import-resolver-webpack": "^0.13.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-mocha": "^6.3.0",
"eslint-plugin-mocha": "^8.0.0",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^3.0.0",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react-hooks": "^4.1.2",
"faker": "^4.1.0",
"file-loader": "^6.1.0",
"findup": "^0.1.5",
Expand All @@ -172,7 +172,7 @@
"postcss-inline-svg": "^4.1.0",
"postcss-loader": "^4.0.1",
"pre-commit": "^1.2.2",
"prettier": "^1.19.1",
"prettier": "^2.1.2",
"prettier-stylelint": "^0.4.2",
"prompt": "^1.0.0",
"prop-types": "^15.6.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/react-datepicker/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"root": true,

"env": {
"browser": true,
"es6": true
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/actions/locale_actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ActionTypes from './action_types';

export const toggleLocale = locale => ({
export const toggleLocale = (locale) => ({
type: ActionTypes.TOGGLE_LOCALE,
data: {
locale,
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/components/guide_page/guide_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ const GuidePageComponent = ({
label="Beta"
tooltipContent="This component is still under development and may contain breaking changes in the nearby future."
/>
) : (
undefined
);
) : undefined;

const tabs = [
{
Expand Down
14 changes: 7 additions & 7 deletions src-docs/src/components/guide_page/guide_page_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { GuideThemeSelector } from '../guide_theme_selector';
import { EuiHighlight } from '../../../../src/components/highlight';
import { EuiBadge } from '../../../../src/components/badge';

const scrollTo = position => {
const scrollTo = (position) => {
window.scrollTo({ top: position, behavior: 'smooth' });
};

Expand Down Expand Up @@ -64,7 +64,7 @@ export class GuidePageChrome extends Component {
});
};

onSearchChange = event => {
onSearchChange = (event) => {
this.setState({
search: event.target.value,
isSideNavOpenOnMobile: event.target.value !== '',
Expand Down Expand Up @@ -177,7 +177,7 @@ export class GuidePageChrome extends Component {
}

renderSubSections = (href, subSections = [], searchTerm = '') => {
const subSectionsWithTitles = subSections.filter(item => {
const subSectionsWithTitles = subSections.filter((item) => {
if (!item.title) {
return false;
}
Expand Down Expand Up @@ -214,16 +214,16 @@ export class GuidePageChrome extends Component {
});
};

renderSideNav = sideNav => {
renderSideNav = (sideNav) => {
// TODO: Add contents pages
const sideNavSections = [];

const searchTerm = this.state.search.toLowerCase();

sideNav.forEach(section => {
sideNav.forEach((section) => {
let hasMatchingSubItem = false;

const matchingItems = section.items.filter(item => {
const matchingItems = section.items.filter((item) => {
if (item.hidden) {
return false;
}
Expand All @@ -242,7 +242,7 @@ export class GuidePageChrome extends Component {
}
});

const items = matchingItems.map(item => {
const items = matchingItems.map((item) => {
const { name, path, sections, isNew } = item;
const href = `#/${path}`;

Expand Down
22 changes: 11 additions & 11 deletions src-docs/src/components/guide_section/guide_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import { cleanEuiImports } from '../../services';

import { extendedTypesInfo } from './guide_section_extends';

export const markup = text => {
export const markup = (text) => {
const regex = /(#[a-zA-Z]+)|(`[^`]+`)/g;
return text.split('\n').map(token => {
return text.split('\n').map((token) => {
const values = token.split(regex).map((token, index) => {
if (!token) {
return '';
Expand All @@ -54,15 +54,15 @@ export const markup = text => {
if (token.includes('\n')) {
return token
.split('\n')
.map(item => [item, <br key={`markup-${index}`} />]);
.map((item) => [item, <br key={`markup-${index}`} />]);
}
return token;
});
return [...values, <br key="lineBreak" />];
});
};

export const humanizeType = type => {
export const humanizeType = (type) => {
if (!type) {
return '';
}
Expand Down Expand Up @@ -162,7 +162,7 @@ export class GuideSection extends Component {
this.memoScroll = 0;
}

onSort = componentName => {
onSort = (componentName) => {
const { sortedComponents } = this.state;
if (
!sortedComponents[componentName] ||
Expand All @@ -182,13 +182,13 @@ export class GuideSection extends Component {
}
};

onSelectedTabChanged = selectedTab => {
onSelectedTabChanged = (selectedTab) => {
const { name } = selectedTab;
let renderedCode = null;

if (name === 'html' || name === 'javascript') {
const { code } = this.props.source.find(
sourceObject => sourceObject.type === name
(sourceObject) => sourceObject.type === name
);
renderedCode = code;

Expand Down Expand Up @@ -255,7 +255,7 @@ export class GuideSection extends Component {
};

renderTabs() {
return this.tabs.map(tab => (
return this.tabs.map((tab) => (
<EuiTab
onClick={() => this.onSelectedTabChanged(tab)}
isSelected={tab === this.state.selectedTab}
Expand Down Expand Up @@ -336,7 +336,7 @@ export class GuideSection extends Component {
});
}

const rows = propNames.map(propName => {
const rows = propNames.map((propName) => {
const {
description: propDescription = '',
required,
Expand Down Expand Up @@ -448,7 +448,7 @@ export class GuideSection extends Component {
});

const extendedTypes = extendedInterfaces
? extendedInterfaces.filter(type => !!extendedTypesInfo[type])
? extendedInterfaces.filter((type) => !!extendedTypesInfo[type])
: [];
// if there is an HTMLAttributes type present among others, remove HTMLAttributes
if (extendedTypes.includes('HTMLAttributes') && extendedTypes.length > 1) {
Expand Down Expand Up @@ -545,7 +545,7 @@ export class GuideSection extends Component {
renderProps() {
const { props } = this.props;
return this.componentNames
.map(componentName =>
.map((componentName) =>
this.renderPropsForComponent(componentName, props[componentName])
)
.reduce((a, b) => a.concat(b), []); // Flatten the resulting array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EUI_THEMES } from '../../../../src/themes';
export const GuideThemeSelector = () => {
return (
<ThemeContext.Consumer>
{context => <GuideThemeSelectorComponent context={context} />}
{(context) => <GuideThemeSelectorComponent context={context} />}
</ThemeContext.Consumer>
);
};
Expand All @@ -18,7 +18,7 @@ const GuideThemeSelectorComponent = ({ context }) => {
<EuiSelect
options={EUI_THEMES}
value={context.theme}
onChange={e => {
onChange={(e) => {
context.changeTheme(e.target.value);
}}
aria-label="Switch the theme"
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ReactDOM.render(
<Route
key={i}
path={`/${path}`}
render={props => {
render={(props) => {
const { location } = props;
// prevents encoded urls with a section id to fail
if (location.pathname.includes('%23')) {
Expand Down
30 changes: 15 additions & 15 deletions src-docs/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ import { ElasticChartsPieExample } from './views/elastic_charts/pie_example';
* Lowercases input and replaces spaces with hyphens:
* e.g. 'GridView Example' -> 'gridview-example'
*/
const slugify = str => {
const slugify = (str) => {
const parts = str
.toLowerCase()
.replace(/[-]+/g, ' ')
Expand Down Expand Up @@ -264,11 +264,11 @@ const createExample = (example, customTitle) => {
playground,
guidelines,
} = example;
sections.forEach(section => {
sections.forEach((section) => {
section.id = slugify(section.title || title);
});

const renderedSections = sections.map(section =>
const renderedSections = sections.map((section) =>
createElement(GuideSection, {
key: section.title || title,
...section,
Expand Down Expand Up @@ -343,7 +343,7 @@ const navigation = [
PopoverExample,
ResizableContainerExample,
SpacerExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Navigation',
Expand All @@ -361,7 +361,7 @@ const navigation = [
SideNavExample,
StepsExample,
TabsExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Tabular content',
Expand All @@ -375,7 +375,7 @@ const navigation = [
DataGridFooterRowExample,
TableExample,
TableInMemoryExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Display',
Expand All @@ -402,7 +402,7 @@ const navigation = [
ToastExample,
ToolTipExample,
TourExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Forms',
Expand All @@ -422,7 +422,7 @@ const navigation = [
SelectableExample,
SuggestExample,
SuperDatePickerExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Editors & syntax',
Expand All @@ -432,7 +432,7 @@ const navigation = [
MarkdownPluginExample,
CodeEditorExample,
CodeExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Elastic Charts',
Expand All @@ -442,7 +442,7 @@ const navigation = [
ElasticChartsTimeExample,
ElasticChartsCategoryExample,
ElasticChartsPieExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Utilities',
Expand Down Expand Up @@ -470,7 +470,7 @@ const navigation = [
TextDiffExample,
ToggleExample,
WindowEventExample,
].map(example => createExample(example)),
].map((example) => createExample(example)),
},
{
name: 'Package',
Expand Down Expand Up @@ -504,26 +504,26 @@ const allRoutes = navigation.reduce((accummulatedRoutes, section) => {
export default {
navigation,

getRouteForPath: path => {
getRouteForPath: (path) => {
// React-router kinda sucks. Sometimes the path contains a leading slash, sometimes it doesn't.
const normalizedPath = path[0] === '/' ? path.slice(1, path.length) : path;
return allRoutes.find(route => normalizedPath === route.path);
return allRoutes.find((route) => normalizedPath === route.path);
},

getAppRoutes: function getAppRoutes() {
return allRoutes;
},

getPreviousRoute: function getPreviousRoute(routeName) {
const index = allRoutes.findIndex(item => {
const index = allRoutes.findIndex((item) => {
return item.name === routeName;
});

return index >= 0 ? allRoutes[index - 1] : undefined;
},

getNextRoute: function getNextRoute(routeName) {
const index = allRoutes.findIndex(item => {
const index = allRoutes.findIndex((item) => {
return item.name === routeName;
});

Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/services/playground/dummyFunction.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as t from '@babel/types';

export const dummyFunction = {
generate: val => {
generate: (val) => {
if (!val) return null;
const obj = t.arrowFunctionExpression([], t.blockStatement([]), false);
return obj;
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/services/playground/iconValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const iconValidator = (prop = { custom: {} }) => {
type: PropTypes.String,
custom: {
...prop.custom,
validator: val => iconOptions[val],
validator: (val) => iconOptions[val],
},
};
return newProp;
Expand Down
Loading

0 comments on commit 5e4c3e2

Please sign in to comment.