Skip to content

Commit

Permalink
Update eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Nov 19, 2019
1 parent 53b9a8b commit 33c7f29
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 14 deletions.
19 changes: 18 additions & 1 deletion packages/eslint-config-kibana/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,24 @@ module.exports = {
'@typescript-eslint/ban-types': [
'error',
{
types: { SFC: null, 'React.SFC': null },
types: {
SFC: {
message: 'Use FC or FunctionComponent instead.',
fixWith: 'FC',
},
'React.SFC': {
message: 'Use FC or FunctionComponent instead.',
fixWith: 'React.FC',
},
StatelessComponent: {
message: 'Use FunctionComponent instead.',
fixWith: 'FunctionComponent',
},
'React.StatelessComponent': {
message: 'Use FunctionComponent instead.',
fixWith: 'React.FunctionComponent',
},
},
},
],
camelcase: 'off',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ const withUnfocused = (state: AutocompleteFieldState) => ({
isFocused: false,
});

export const FixedEuiFieldSearch: React.SFC<React.InputHTMLAttributes<HTMLInputElement> &
export const FixedEuiFieldSearch: React.FC<React.InputHTMLAttributes<HTMLInputElement> &
EuiFieldSearchProps & {
inputRef?: (element: HTMLInputElement | null) => void;
onSearch: (value: string) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface CheckupControlsProps extends ReactIntl.InjectedIntlProps {
onGroupByChange: (groupBy: GroupByOption) => void;
}

export const CheckupControlsUI: StatelessComponent<CheckupControlsProps> = ({
export const CheckupControlsUI: FunctionComponent<CheckupControlsProps> = ({
allDeprecations,
loadingState,
loadData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface DeprecationCellProps {
/**
* Used to display a deprecation with links to docs, a health indicator, and other descriptive information.
*/
export const DeprecationCell: StatelessComponent<DeprecationCellProps> = ({
export const DeprecationCell: FunctionComponent<DeprecationCellProps> = ({
headline,
healthColor,
reindexIndexName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const filterDeps = (level: LevelFilterOption, search: string = '') => {
/**
* A single accordion item for a grouped deprecation item.
*/
export const DeprecationAccordion: StatelessComponent<{
export const DeprecationAccordion: FunctionComponent<{
id: string;
deprecations: EnrichedDeprecationInfo[];
title: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface DeprecationHealthProps {
single?: boolean;
}

const SingleHealth: StatelessComponent<{ level: DeprecationInfo['level']; label: string }> = ({
const SingleHealth: FunctionComponent<{ level: DeprecationInfo['level']; label: string }> = ({
level,
label,
}) => (
Expand All @@ -52,7 +52,7 @@ const SingleHealth: StatelessComponent<{ level: DeprecationInfo['level']; label:
* Displays a summary health for a list of deprecations that shows the number and level of severity
* deprecations in the list.
*/
export const DeprecationHealth: StatelessComponent<DeprecationHealthProps> = ({
export const DeprecationHealth: FunctionComponent<DeprecationHealthProps> = ({
deprecations,
single = false,
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const sortByLevelDesc = (a: DeprecationInfo, b: DeprecationInfo) => {
/**
* Used to show a single deprecation message with any detailed information.
*/
const MessageDeprecation: StatelessComponent<{ deprecation: EnrichedDeprecationInfo }> = ({
const MessageDeprecation: FunctionComponent<{ deprecation: EnrichedDeprecationInfo }> = ({
deprecation,
}) => {
const items = [];
Expand All @@ -44,7 +44,7 @@ const MessageDeprecation: StatelessComponent<{ deprecation: EnrichedDeprecationI
/**
* Used to show a single (simple) deprecation message with any detailed information.
*/
const SimpleMessageDeprecation: StatelessComponent<{ deprecation: EnrichedDeprecationInfo }> = ({
const SimpleMessageDeprecation: FunctionComponent<{ deprecation: EnrichedDeprecationInfo }> = ({
deprecation,
}) => {
const items = [];
Expand All @@ -64,7 +64,7 @@ interface IndexDeprecationProps {
/**
* Shows a single deprecation and table of affected indices with details for each index.
*/
const IndexDeprecation: StatelessComponent<IndexDeprecationProps> = ({ deprecation, indices }) => {
const IndexDeprecation: FunctionComponent<IndexDeprecationProps> = ({ deprecation, indices }) => {
return (
<DeprecationCell docUrl={deprecation.url}>
<IndexDeprecationTable indices={indices} />
Expand All @@ -76,7 +76,7 @@ const IndexDeprecation: StatelessComponent<IndexDeprecationProps> = ({ deprecati
* A list of deprecations that is either shown as individual deprecation cells or as a
* deprecation summary for a list of indices.
*/
export const DeprecationList: StatelessComponent<{
export const DeprecationList: FunctionComponent<{
deprecations: EnrichedDeprecationInfo[];
currentGroupBy: GroupByOption;
}> = ({ deprecations, currentGroupBy }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { LoadingErrorBanner } from '../../error_banner';
import { LoadingState, UpgradeAssistantTabProps } from '../../types';
import { Steps } from './steps';

export const OverviewTab: StatelessComponent<UpgradeAssistantTabProps> = props => (
export const OverviewTab: FunctionComponent<UpgradeAssistantTabProps> = props => (
<Fragment>
<EuiSpacer />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ const START_UPGRADE_STEP = {
),
};

export const StepsUI: StatelessComponent<UpgradeAssistantTabProps &
ReactIntl.InjectedIntlProps> = ({ checkupData, setSelectedTabIndex, intl }) => {
export const StepsUI: FunctionComponent<UpgradeAssistantTabProps & ReactIntl.InjectedIntlProps> = ({
checkupData,
setSelectedTabIndex,
intl,
}) => {
const checkupDataTyped = (checkupData! as unknown) as { [checkupType: string]: any[] };
const countByType = Object.keys(checkupDataTyped).reduce((counts, checkupType) => {
counts[checkupType] = checkupDataTyped[checkupType].length;
Expand Down

0 comments on commit 33c7f29

Please sign in to comment.