[ML] Fixing some of the eslint rule breakages in ML (#49716) (#49758)

This commit is contained in:
James Gowdy 2019-10-31 13:54:24 +00:00 committed by GitHub
parent 5daaa05c6c
commit 69344a0e53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 6 additions and 31 deletions

View file

@ -206,8 +206,6 @@ module.exports = {
files: ['x-pack/legacy/plugins/ml/**/*.{js,ts,tsx}'],
rules: {
'react-hooks/exhaustive-deps': 'off',
'react-hooks/rules-of-hooks': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
},
},
{

View file

@ -28,9 +28,6 @@ function getPercentLabel(valueCount: number, totalCount: number): string {
export const BooleanContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats } = config;
if (stats === undefined) {
return null;
}
const { count, sampleCount, trueCount, falseCount } = stats;
const docsPercent = roundToDecimalPlace((count / sampleCount) * 100);

View file

@ -19,9 +19,6 @@ const TIME_FORMAT = 'MMM D YYYY, HH:mm:ss.SSS';
export const DateContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats } = config;
if (stats === undefined) {
return null;
}
const { count, sampleCount, earliest, latest } = stats;
const docsPercent = roundToDecimalPlace((count / sampleCount) * 100);

View file

@ -17,9 +17,6 @@ const CHART_HEIGHT = 350;
export const DocumentCountContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats } = config;
if (stats === undefined) {
return null;
}
const { documentCounts, timeRangeEarliest, timeRangeLatest } = stats;

View file

@ -36,9 +36,6 @@ export const GeoPointContent: FC<FieldDataCardProps> = ({ config }) => {
// }
const { stats } = config;
if (stats === undefined) {
return null;
}
const { count, sampleCount, cardinality, examples } = stats;
const docsPercent = roundToDecimalPlace((count / sampleCount) * 100);

View file

@ -18,9 +18,6 @@ import { TopValues } from '../top_values';
export const IpContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats, fieldFormat } = config;
if (stats === undefined) {
return null;
}
const { count, sampleCount, cardinality } = stats;
const docsPercent = roundToDecimalPlace((count / sampleCount) * 100);

View file

@ -18,9 +18,6 @@ import { TopValues } from '../top_values';
export const KeywordContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats, fieldFormat } = config;
if (stats === undefined) {
return null;
}
const { count, sampleCount, cardinality } = stats;
const docsPercent = roundToDecimalPlace((count / sampleCount) * 100);

View file

@ -34,9 +34,6 @@ const DEFAULT_TOP_VALUES_THRESHOLD = 100;
export const NumberContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats, fieldFormat } = config;
if (stats === undefined) {
return null;
}
useEffect(() => {
const chartData = buildChartDataFromStats(stats, METRIC_DISTRIBUTION_CHART_WIDTH);

View file

@ -16,9 +16,6 @@ import { ExamplesList } from '../examples_list';
export const OtherContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats, type, aggregatable } = config;
if (stats === undefined) {
return null;
}
const { count, sampleCount, cardinality, examples } = stats;
const docsPercent = roundToDecimalPlace((count / sampleCount) * 100);

View file

@ -15,9 +15,6 @@ import { ExamplesList } from '../examples_list';
export const TextContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats } = config;
if (stats === undefined) {
return null;
}
const { examples } = stats;
const numExamples = examples.length;

View file

@ -30,7 +30,11 @@ export interface FieldDataCardProps {
}
export const FieldDataCard: FC<FieldDataCardProps> = ({ config }) => {
const { fieldName, loading, type, existsInDocs } = config;
const { fieldName, loading, type, existsInDocs, stats } = config;
if (stats === undefined) {
return null;
}
function getCardContent() {
if (existsInDocs === false) {

View file

@ -198,7 +198,7 @@ function TabStack({ title, items, switchState, switchFunc }) {
return (
<li key={i} className={className} >
<a onClick={() => switchFunc(item.index)}>{item.label}</a>
<a onClick={() => switchFunc(item.index)} onKeyUp={() => {}} >{item.label}</a>
{(item.body !== undefined) &&
<div className="body">
{item.body}