Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Update lint and corresponding files. #2403

Merged
merged 8 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .changeset/perfect-schools-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
"victory-area": patch
"victory-axis": patch
"victory-bar": patch
"victory-box-plot": patch
"victory-brush-container": patch
"victory-brush-line": patch
"victory-candlestick": patch
"victory-canvas": patch
"victory-core": patch
"victory-create-container": patch
"victory-cursor-container": patch
"victory-errorbar": patch
"victory-legend": patch
"victory-line": patch
"victory-pie": patch
"victory-polar-axis": patch
"victory-scatter": patch
"victory-selection-container": patch
"victory-shared-events": patch
"victory-stack": patch
"victory-tooltip": patch
"victory-vendor": patch
"victory-voronoi": patch
"victory-voronoi-container": patch
"victory-zoom-container": patch
---

Update source code with minor lint-based improvements (see #2236).
23 changes: 17 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const path = require("path");
const BABEL_PATH = path.resolve(__dirname, ".babelrc.js"); // eslint-disable-line no-undef

module.exports = {
settings: {
react: {
Expand All @@ -11,22 +14,30 @@ module.exports = {
},
extends: [
"formidable/configurations/es6-react",
"prettier",
"plugin:react-hooks/recommended",
"plugin:eslint-comments/recommended",
"prettier",
],
rules: {
"eslint-comments/disable-enable-pair": "off",
"func-style": "off",
"arrow-body-style": "off",
"consistent-return": "off", // we're migrating to TS and this is more properly handled there.
"react/sort-comp": "off",
"import/no-unresolved": [2, { ignore: ["victory*"] }],
"max-statements": 0,
"import/no-unresolved": ["error", { ignore: ["victory*"] }],
"max-statements": "off",
complexity: ["error", { max: 16 }],
"no-magic-numbers": [
"error",
{ ignore: [-1, 0, 0.5, 1, 2, 90, 180, 270, 360] },
],
},
parser: "@babel/eslint-parser",
parserOptions: {
babelOptions: {
configFile: BABEL_PATH,
},
},
plugins: ["jest"],
env: {
"jest/globals": true,
Expand All @@ -36,9 +47,9 @@ module.exports = {
files: ["**/*.test.*", "./test/**/*"],
rules: {
"react/sort-comp": "off",
"no-magic-numbers": 0,
"max-statements": 0,
"import/no-unresolved": 0,
"no-magic-numbers": "off",
"max-statements": "off",
"import/no-unresolved": "off",
"no-undef": "off",
"max-nested-callbacks": "off",
"@typescript-eslint/no-empty-function": "off",
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/victory-turbo-component-re-write.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

## Implementation Notes
- New components should live inside a nested director (currently v37). These components should not make changes to existing functionality.
- New components should live inside a nested directory (currently v37). These components should not make changes to existing functionality.
- The victory event system will be excluded for now until we have more clarity on how Victory wants to handle events.
- [Add other notes here]

Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ This task also watches and rebuilds all Victory source files so you can more eas
$ pnpm run chromatic
```

Note that Chromatic internally runs `npm run build-storybook` around which we have a custom `package.json:scripts.build-storybook` task that is meant to work within Chromatic.

## Release

We use [changesets](https://github.com/changesets/changesets) to create package versions and publish them.
Expand Down
2 changes: 1 addition & 1 deletion config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (!libPath) {
// PascalCase (with first character capitalized).
const libName = libPath
.replace(/^\s+|\s+$/g, "")
.replace(/(^|[-_ ])+(.)/g, function (match, first, second) {
.replace(/(^|[-_ ])+(.)/g, (match, first, second) => {
// Second match group is the character we want to change. Throw away first.
return second.toUpperCase();
});
Expand Down
4 changes: 2 additions & 2 deletions demo/js/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*global document:false window:false */
/*eslint-disable react/no-multi-comp */

/* eslint-disable react/no-multi-comp */
import React from "react";
import ReactDOM from "react-dom";
import { keys } from "lodash";
Expand Down
4 changes: 2 additions & 2 deletions demo/js/components/accessibility-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryGroup } from "victory-group";
import { VictoryStack } from "victory-stack";
Expand Down Expand Up @@ -327,7 +327,7 @@ export default class App extends React.Component {
</VictoryChart>
</div>

{/**ACCESSIBLE GROUP */}
{/** ACCESSIBLE GROUP */}
<div style={chartContainerStyle}>
<h2 style={chartHeadingStyle}>Accessible Group</h2>
<VictoryChart domainPadding={{ x: 40 }}>
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/animation-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { random, range } from "lodash";
import { VictoryBar } from "victory-bar";
Expand Down
1 change: 0 additions & 1 deletion demo/js/components/canvas-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable no-magic-numbers */
/*global window:false */
import React from "react";
import {
CanvasGroup,
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/create-container-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
import { round } from "lodash";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/debug-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */

import React from "react";
import { VictoryChart } from "victory-chart";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/draggable-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */

import React from "react";
import { VictoryChart } from "victory-chart";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/events-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/external-events-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*eslint-disable no-magic-numbers */
/*global window:false*/
/* eslint-disable no-magic-numbers */

import React from "react";
import { VictoryChart } from "victory-chart";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/group-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/horizontal-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */

import React from "react";
import { VictoryChart } from "victory-chart";
Expand Down
1 change: 0 additions & 1 deletion demo/js/components/immutable-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global window:false */
/* eslint-disable no-magic-numbers, react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/performance.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { range } from "lodash";
import { VictorySelectionContainer } from "victory-selection-container";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/selection-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-area-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { merge, random, range } from "lodash";
import { VictoryChart } from "victory-chart";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-axis-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryAxis } from "victory-axis";
import {
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-bar-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false*/
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
import { VictoryChart } from "victory-chart";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-box-plot-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryBoxPlot } from "victory-box-plot";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/victory-brush-container-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/victory-brush-line-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */

import React from "react";
import { VictoryChart } from "victory-chart";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-candlestick-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import PropTypes from "prop-types";
import { random, range, merge } from "lodash";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-chart-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
import { assign, merge, random, range, omit } from "lodash";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-cursor-container-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false*/
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { random, range, round } from "lodash";
import { VictoryChart } from "victory-chart";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/victory-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers*/
/* eslint-disable no-magic-numbers*/
import React from "react";
import {
VictoryAxis,
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-errorbar-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import PropTypes from "prop-types";
import { assign, merge, random, range } from "lodash";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-histogram-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */
import React from "react";
import { merge, random, range } from "lodash";
import { VictoryChart } from "victory-chart";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/victory-label-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers*/
/* eslint-disable no-magic-numbers*/
import React from "react";
import { VictoryScatter } from "victory-scatter";
import { VictoryLabel } from "victory-core";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-line-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
import { merge, random, range } from "lodash";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-pie-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false*/
/*eslint-disable no-magic-numbers,react/no-multi-comp*/
/* eslint-disable no-magic-numbers,react/no-multi-comp*/
import { random, range } from "lodash";
import React from "react";
import { VictoryPie } from "victory-pie";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-polar-chart-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false*/
/*eslint no-magic-numbers:0*/
/* eslint no-magic-numbers:0*/
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-scatter-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
import { assign, merge, random, range } from "lodash";
Expand Down
2 changes: 1 addition & 1 deletion demo/js/components/victory-tooltip-demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-voronoi-container-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false*/
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-voronoi-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global window:false */
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryVoronoi } from "victory-voronoi";
import { VictoryTooltip } from "victory-tooltip";
Expand Down
3 changes: 1 addition & 2 deletions demo/js/components/victory-zoom-container-demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* globals window */
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
import { range, merge, random, minBy, maxBy, last } from "lodash";
Expand Down
6 changes: 3 additions & 3 deletions demo/ts/components/accessibility-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { isNumber } from "lodash";
import { VictoryGroup } from "victory-group";
Expand Down Expand Up @@ -80,7 +80,7 @@ export default class VictoryAccessibilityDemo extends React.Component<any> {
<h3>Tabbable charts with aria-labels</h3>
</div>
<div className="demo" style={containerStyle}>
{/**BAR */}
{/** BAR */}
<div
style={chartContainerStyle}
data-testid="bar-accessibility-chart"
Expand Down Expand Up @@ -351,7 +351,7 @@ export default class VictoryAccessibilityDemo extends React.Component<any> {
</VictoryChart>
</div>

{/**ACCESSIBLE GROUP */}
{/** ACCESSIBLE GROUP */}
<div style={chartContainerStyle}>
<h3 style={chartHeadingStyle}>Accessible Group</h3>
<VictoryChart domainPadding={{ x: 40 }}>
Expand Down
2 changes: 1 addition & 1 deletion demo/ts/components/draggable-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers,react/no-multi-comp */
/* eslint-disable no-magic-numbers,react/no-multi-comp */

import React from "react";
import { merge } from "lodash";
Expand Down
2 changes: 1 addition & 1 deletion demo/ts/components/events-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
2 changes: 1 addition & 1 deletion demo/ts/components/group-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down
2 changes: 1 addition & 1 deletion demo/ts/components/horizontal-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */

import React from "react";
import { VictoryChart } from "victory-chart";
Expand Down
Loading