FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore(react-charts): fixed linting errors by evwilkin · Pull Request #3713 · patternfly/patternfly-react · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (2) .ts  (8) .tsx  (56) All 3 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions .eslintrc.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-use-before-define": "off",
"jsdoc/require-returns": "off",
"arrow-body-style": "error",
"camelcase": ["error", {
Expand Down
2 changes: 1 addition & 1 deletion package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"generate": "yarn plop",
"lint:md": "yarn eslint packages/patternfly-4 --ext md --no-eslintrc --config .eslintrc-md.json --cache",
"lint:style": "stylelint \"**/sass/**/*.scss\" \"!**/dist/**/*.scss\"",
"lint:ts": "node --max-old-space-size=4096 node_modules/.bin/eslint packages/patternfly-4/react-core packages/patternfly-4/react-table packages/patternfly-4/react-topology packages/patternfly-4/react-catalog-view-extension packages/patternfly-4/react-docs packages/patternfly-4/react-inline-edit-extension --ext js,jsx,ts,tsx --cache",
"lint:ts": "node --max-old-space-size=4096 node_modules/.bin/eslint packages/patternfly-4/react-core packages/patternfly-4/react-table packages/patternfly-4/react-topology packages/patternfly-4/react-catalog-view-extension packages/patternfly-4/react-docs packages/patternfly-4/react-inline-edit-extension packages/patternfly-4/react-charts --ext js,jsx,ts,tsx --cache",
"lint:versions": "node ./packages/patternfly-4/verifyCoreVersions.js",
"prettier": "node node_modules/.bin/prettier --write \"storybook/**/*.{js,ts,tsx}\" \"packages/**/*.{js,ts,tsx}\" \"scripts/**/*.{js,ts,tsx}\"",
"serve:docs": "lerna run serve",
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Chart } from './Chart';
import { ChartGroup } from '../ChartGroup';
import { ChartLine } from '../ChartLine';

Object.values([true, false]).forEach(isRead => {
Object.values([true, false]).forEach(() => {
test('Chart', () => {
const view = shallow(<Chart />);
expect(view).toMatchSnapshot();
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface ChartProps extends VictoryChartProps {
* The animate prop specifies props for VictoryAnimation to use.
* The animate prop should also be used to specify enter and exit
* transition configurations with the `onExit` and `onEnter` namespaces respectively.
*
* @example
* {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}
*/
Expand Down Expand Up @@ -70,6 +71,7 @@ export interface ChartProps extends VictoryChartProps {
* Any of these props may be overridden by passing in props to the supplied component,
* or modified or ignored within the custom component itself. If a dataComponent is
* not provided, ChartArea will use the default ChartContainer component.
*
* @example <ChartContainer title="Chart of Dog Breeds" desc="This chart shows ..." />
*/
containerComponent?: React.ReactElement<any>;
Expand All @@ -79,7 +81,8 @@ export interface ChartProps extends VictoryChartProps {
* or as an object that specifies separate arrays for x and y.
* If this prop is not provided, a domain will be calculated from data, or other
* available information.
* @example: [-1, 1], {x: [0, 100], y: [0, 1]}
*
* @example [-1, 1], {x: [0, 100], y: [0, 1]}
*/
domain?: DomainPropType;
/**
Expand Down Expand Up @@ -115,6 +118,7 @@ export interface ChartProps extends VictoryChartProps {
* The mutation function will be called with the calculated props for the individual selected
* element (i.e. a single bar), and the object returned from the mutation function
* will override the props of the selected element via object assignment.
*
* @example
* events={[
* {
Expand Down Expand Up @@ -276,6 +280,7 @@ export interface ChartProps extends VictoryChartProps {
* The scale prop determines which scales your chart should use. This prop can be
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
* as a d3 scale function, or as an object with scales specified for x and y
*
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
scale?:
Expand Down Expand Up @@ -369,7 +374,6 @@ export const Chart: React.FunctionComponent<ChartProps> = ({
legendData,
legendPosition = ChartCommonStyles.legend.position as ChartLegendPosition,
padding,
standalone = true,
themeColor,
themeVariant,

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartArea } from '../ChartArea';

Object.values([true, false]).forEach(isRead => {
Object.values([true, false]).forEach(() => {
test('ChartArea', () => {
const view = shallow(<ChartArea />);
expect(view).toMatchSnapshot();
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* This prop should be given as an array of string values, or an object with
* these arrays of values specified for x and y. If this prop is not set,
* categorical data will be plotted in the order it was given in the data array
*
* @example ["dogs", "cats", "mice"]
*/
categories?: CategoryPropType;
Expand All @@ -60,6 +61,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* Any of these props may be overridden by passing in props to the supplied component,
* or modified or ignored within the custom component itself. If a dataComponent is
* not provided, ChartArea will use the default ChartContainer component.
*
* @example <ChartContainer title="Chart of Dog Breeds" desc="This chart shows..." />
*/
containerComponent?: React.ReactElement<any>;
Expand All @@ -68,6 +70,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* of data points, or an array of arrays of data points for multiple datasets.
* Each data point may be any format you wish (depending on the `x` and `y` accessor props),
* but by default, an object with x and y properties is expected.
*
* @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]],
* [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]]
*/
Expand All @@ -88,6 +91,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* or as an object that specifies separate arrays for x and y.
* If this prop is not provided, a domain will be calculated from data, or other
* available information.
*
* @example [-1, 1], {x: [0, 100], y: [0, 1]}
*/
domain?: DomainPropType;
Expand Down Expand Up @@ -117,6 +121,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* The mutation function will be called with the calculated props for the individual selected
* element (i.e. an area), and the object returned from the mutation function
* will override the props of the selected element via object assignment.
*
* @example
* events={[
* {
Expand Down Expand Up @@ -184,6 +189,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* If given as an array, the number of elements in the array should be equal to
* the length of the data array. Labels may also be added directly to the data object
* like data={[{x: 1, y: 1, label: "first"}]}.
*
* @example ["spring", "summer", "fall", "winter"], (datum) => datum.title
*/
labels?: string[] | number[] | Function;
Expand Down Expand Up @@ -261,6 +267,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* The scale prop determines which scales your chart should use. This prop can be
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
* as a d3 scale function, or as an object with scales specified for x and y
*
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
scale?:
Expand Down Expand Up @@ -313,6 +320,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* will be applied. Height, width, and padding should be specified via the height,
* width, and padding props, as they are used to calculate the alignment of
* components within chart.
*
* @example {data: {fill: "red"}, labels: {fontSize: 12}}
*/
style?: VictoryStyleInterface;
Expand Down Expand Up @@ -353,6 +361,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* If given as an array of strings, or a string containing dots or brackets,
* it will be used as a nested object property path (for details see Lodash docs for _.get).
* If `null` or `undefined`, the data value will be used as is (identity function/pass-through).
*
* @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d)
*/
x?: DataGetterPropType;
Expand All @@ -364,13 +373,15 @@ export interface ChartAreaProps extends VictoryAreaProps {
* If given as an array of strings, or a string containing dots or brackets,
* it will be used as a nested object property path (for details see Lodash docs for _.get).
* If `null` or `undefined`, the data value will be used as is (identity function/pass-through).
*
* @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d)
*/
y?: DataGetterPropType;
/**
* Use y0 data accessor prop to determine how the component defines the baseline y0 data.
* This prop is useful for defining custom baselines for components like ChartArea.
* This prop may be given in a variety of formats.
*
* @example 'last_quarter_profit', () => 10, 1, 'employees.salary', ["employees", "salary"]
*/
y0?: DataGetterPropType;
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ChartAxis } from './ChartAxis';
import { ChartGroup } from '../ChartGroup';
import { ChartLine } from '../ChartLine';

Object.values([true, false]).forEach(isRead => {
Object.values([true, false]).forEach(() => {
test('ChartAxis', () => {
const view = shallow(<ChartAxis />);
expect(view).toMatchSnapshot();
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* The animate prop specifies props for VictoryAnimation to use.
* The animate prop should also be used to specify enter and exit
* transition configurations with the `onExit` and `onEnter` namespaces respectively.
*
* @example
* {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}
*/
Expand Down Expand Up @@ -63,6 +64,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* Any of these props may be overridden by passing in props to the supplied component,
* or modified or ignored within the custom component itself. If a dataComponent is
* not provided, ChartAxis will use the default ChartContainer component.
*
* @example <ChartContainer title="Chart of Dog Breeds" desc="This chart shows ..." />
*/
containerComponent?: React.ReactElement<any>;
Expand All @@ -80,6 +82,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* The domain prop describes the range of values your axis will include. This prop should be
* given as a array of the minimum and maximum expected values for your axis.
* If this value is not given it will be calculated based on the scale or tickValues.
*
* @example [-1, 1]
*/
domain?: DomainPropType;
Expand All @@ -105,6 +108,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* function will be called with the calculated props for the individual selected
* element (i.e. a single tick), and the object returned from the mutation function
* will override the props of the selected element via object assignment.
*
* @example
* events={[
* {
Expand Down Expand Up @@ -254,6 +258,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* The scale prop determines which scales your chart should use. This prop can be
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
* as a d3 scale function, or as an object with scales specified for x and y
*
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
scale?:
Expand Down Expand Up @@ -367,6 +372,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* The tickFormat prop specifies how tick values should be expressed visually.
* tickFormat can be given as a function to be applied to every tickValue, or as
* an array of display values for each tickValue.
*
* @example d3.time.format("%Y"), (x) => x.toPrecision(2), ["first", "second", "third"]
*/
tickFormat?: any[] | ((tick: any, index: number, ticks: any[]) => string | number);
Expand All @@ -382,6 +388,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
tickLabelComponent?: React.ReactElement<any>;
/**
* The tickValues prop explicitly specifies which tick values to draw on the axis.
*
* @example ["apples", "bananas", "oranges"], [2, 4, 6, 8]
*/
tickValues?: any[];
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Chart } from '../Chart';
import { ChartBar } from './ChartBar';
import { ChartGroup } from '../ChartGroup';

Object.values([true, false]).forEach(isRead => {
Object.values([true, false]).forEach(() => {
test('ChartBar', () => {
const view = shallow(<ChartBar />);
expect(view).toMatchSnapshot();
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
DomainPropType,
DomainPaddingPropType,
EventPropTypeInterface,
InterpolationPropType,
NumberOrCallback,
PaddingProps,
ScalePropType,
Expand All @@ -35,6 +34,7 @@ export interface ChartBarProps extends VictoryBarProps {
* The animate prop specifies props for VictoryAnimation to use.
* The animate prop should also be used to specify enter and exit
* transition configurations with the `onExit` and `onEnter` namespaces respectively.
*
* @example
* {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}
*/
Expand All @@ -59,6 +59,7 @@ export interface ChartBarProps extends VictoryBarProps {
* This prop should be given as an array of string values, or an object with
* these arrays of values specified for x and y. If this prop is not set,
* categorical data will be plotted in the order it was given in the data array
*
* @example ["dogs", "cats", "mice"]
*/
categories?: CategoryPropType;
Expand All @@ -74,6 +75,7 @@ export interface ChartBarProps extends VictoryBarProps {
* Any of these props may be overridden by passing in props to the supplied component,
* or modified or ignored within the custom component itself. If a dataComponent is
* not provided, ChartBar will use the default ChartContainer component.
*
* @example <ChartContainer title="Chart of Dog Breeds" desc="This chart shows..." />
*/
containerComponent?: React.ReactElement<any>;
Expand All @@ -97,6 +99,7 @@ export interface ChartBarProps extends VictoryBarProps {
* of data points, or an array of arrays of data points for multiple datasets.
* Each data point may be any format you wish (depending on the `x` and `y` accessor props),
* but by default, an object with x and y properties is expected.
*
* @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]],
* [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]]
*/
Expand All @@ -117,6 +120,7 @@ export interface ChartBarProps extends VictoryBarProps {
* or as an object that specifies separate arrays for x and y.
* If this prop is not provided, a domain will be calculated from data, or other
* available information.
*
* @example [-1, 1], {x: [0, 100], y: [0, 1]}
*/
domain?: DomainPropType;
Expand Down Expand Up @@ -146,6 +150,7 @@ export interface ChartBarProps extends VictoryBarProps {
* The mutation function will be called with the calculated props for the individual selected
* element (i.e. a single bar), and the object returned from the mutation function
* will override the props of the selected element via object assignment.
*
* @example
* events={[
* {
Expand Down Expand Up @@ -212,6 +217,7 @@ export interface ChartBarProps extends VictoryBarProps {
* If given as an array, the number of elements in the array should be equal to
* the length of the data array. Labels may also be added directly to the data object
* like data={[{x: 1, y: 1, label: "first"}]}.
*
* @example ["spring", "summer", "fall", "winter"], (datum) => datum.title
*/
labels?: string[] | ((data: any) => string);
Expand Down Expand Up @@ -289,6 +295,7 @@ export interface ChartBarProps extends VictoryBarProps {
* The scale prop determines which scales your chart should use. This prop can be
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
* as a d3 scale function, or as an object with scales specified for x and y
*
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
scale?:
Expand Down Expand Up @@ -341,6 +348,7 @@ export interface ChartBarProps extends VictoryBarProps {
* will be applied. Height, width, and padding should be specified via the height,
* width, and padding props, as they are used to calculate the alignment of
* components within chart.
*
* @example {data: {fill: "red"}, labels: {fontSize: 12}}
*/
style?: VictoryStyleInterface;
Expand Down Expand Up @@ -381,6 +389,7 @@ export interface ChartBarProps extends VictoryBarProps {
* If given as an array of strings, or a string containing dots or brackets,
* it will be used as a nested object property path (for details see Lodash docs for _.get).
* If `null` or `undefined`, the data value will be used as is (identity function/pass-through).
*
* @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d)
*/
x?: DataGetterPropType;
Expand All @@ -392,13 +401,15 @@ export interface ChartBarProps extends VictoryBarProps {
* If given as an array of strings, or a string containing dots or brackets,
* it will be used as a nested object property path (for details see Lodash docs for _.get).
* If `null` or `undefined`, the data value will be used as is (identity function/pass-through).
*
* @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d)
*/
y?: DataGetterPropType;
/**
* Use y0 data accessor prop to determine how the component defines the baseline y0 data.
* This prop is useful for defining custom baselines for components like ChartBar.
* This prop may be given in a variety of formats.
*
* @example 'last_quarter_profit', () => 10, 1, 'employees.salary', ["employees", "salary"]
*/
y0?: DataGetterPropType;
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBullet } from './ChartBullet';

Object.values([true, false]).forEach(isRead => {
Object.values([true, false]).forEach(() => {
test('ChartBulletQualitativeRange', () => {
const view = shallow(<ChartBullet />);
expect(view).toMatchSnapshot();
Expand Down
Loading

Back | FazBrowse Home | New Git URL