Skip to content

Commit 477e1ee

Browse files
chore: clean up outdated eslint-disable (#3488)
* chore: clean up outdated eslint-disable * refactor: added some tests * refactor: after review * refactor: some refactoring * refactor: after rebase * test: added some tests * refactor: return of the presentation role for the modal backdrop * refactor: changed Typography Links example
1 parent c93adcd commit 477e1ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+217
-208
lines changed

example/src/MyComponent.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import React, { useState } from 'react';
2-
import { Button, Form, Icon, Bubble, Stack, Container } from '@openedx/paragon'; // eslint-disable-line
3-
import { FavoriteBorder } from '@openedx/paragon/icons'; // eslint-disable-line
2+
// eslint-disable-next-line import/no-extraneous-dependencies
3+
import {
4+
Button, Form, Icon, Bubble, Stack, Container,
5+
} from '@openedx/paragon';
6+
// eslint-disable-next-line import/no-extraneous-dependencies
7+
import { FavoriteBorder } from '@openedx/paragon/icons';
48

59
function MyComponent() {
610
const [value, setValue] = useState('');

lib/version.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
/* eslint-disable no-console */
21
const chalk = require('chalk');
32
const { version } = require('../package.json');
43

54
function versionCommand() {
6-
console.log(`Paragon CLI version: ${chalk.bold(version)}`);
5+
console.log(`Paragon CLI version: ${chalk.bold(version)}`); /* eslint-disable-line no-console */
76
}
87

98
module.exports = versionCommand;

src/Button/deprecated/index.jsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,39 @@ class DeprecatedButton extends React.Component {
8585
}
8686

8787
export const buttonPropTypes = {
88-
/** Used to determine the type of button to be rendered. See [Bootstrap's buttons documentation](https://getbootstrap.com/docs/4.0/components/buttons/) for a list of applicable button types. For example, `buttonType="light"`. The default is `undefined`. */
88+
/** Used to determine the type of button to be rendered.
89+
* See [Bootstrap's buttons documentation](https://getbootstrap.com/docs/4.0/components/buttons/)
90+
* for a list of applicable button types. For example, `buttonType="light"`. The default is `undefined`. */
8991
buttonType: PropTypes.string,
90-
/** Specifies Bootstrap class names to apply to the button. See [Bootstrap's buttons documentation](https://getbootstrap.com/docs/4.0/components/buttons/) for a list of applicable class names. The default is an empty array. */
92+
/** Specifies Bootstrap class names to apply to the button.
93+
* See [Bootstrap's buttons documentation](https://getbootstrap.com/docs/4.0/components/buttons/)
94+
* for a list of applicable class names. The default is an empty array. */
9195
className: PropTypes.string,
9296
/** Specifies the text that is displayed within the button. */
9397
children: PropTypes.node.isRequired,
94-
// eslint-disable-next-line max-len
95-
/** A function that defines a reference for the button. An example `inputRef` from the calling component could look something like: `inputRef={(input) => { this.button = input; }}`. The default is an empty function. */
98+
/** A function that defines a reference for the button.
99+
* An example `inputRef` from the calling component could look something
100+
* like: `inputRef={(input) => { this.button = input; }}`. The default is an empty function. */
96101
inputRef: PropTypes.oneOfType([
97102
PropTypes.func,
98103
PropTypes.shape({ current: PropTypes.instanceOf(PropTypes.element) }),
99104
]),
100-
/** Used to determine if the button is a "Close" style button to leverage bootstrap styling. Example use case is with the Status Alert [dismiss button](https://getbootstrap.com/docs/4.0/components/alerts/#dismissing). The default is false. */
105+
/** Used to determine if the button is a "Close" style button to leverage
106+
* bootstrap styling. Example use case is with
107+
* the Status Alert [dismiss button](https://getbootstrap.com/docs/4.0/components/alerts/#dismissing).
108+
* The default is false. */
101109
isClose: PropTypes.bool,
102-
// eslint-disable-next-line max-len
103-
/** A function that would specify what the button should do when the `onBlur` event is triggered. For example, the button could change in color or `buttonType` when focus is changed. The default is an empty function. */
110+
/** A function that would specify what the button should do when
111+
* the `onBlur` event is triggered. For example, the button could change
112+
* in color or `buttonType` when focus is changed. The default is an empty function. */
104113
onBlur: PropTypes.func,
105-
// eslint-disable-next-line max-len
106-
/** A function that would specify what the button should do when the `onClick` event is triggered. For example, the button could launch a `Modal`. The default is an empty function. */
114+
/** A function that would specify what the button should do when
115+
* the `onClick` event is triggered. For example, the button could launch
116+
* a `Modal`. The default is an empty function. */
107117
onClick: PropTypes.func,
108-
// eslint-disable-next-line max-len
109-
/** A function that would specify what the button should do when the `onKeyDown` event is triggered. For example, this could handle using the `Escape` key to trigger the button's action. The default is an empty function. */
118+
/** A function that would specify what the button should do when
119+
* the `onKeyDown` event is triggered. For example, this could handle
120+
* using the `Escape` key to trigger the button's action. The default is an empty function. */
110121
onKeyDown: PropTypes.func,
111122
/** Used to set the `type` attribute on the `button` tag. The default type is `button`. */
112123
type: PropTypes.string,

src/Card/CardCarousel/tests/CardCarousel.test.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jest.mock('../../../OverflowScroll', () => ({
1212
OverflowScroll: jest.fn(),
1313
}));
1414

15-
// eslint-disable-next-line react/prop-types
1615
OverflowScroll.mockImplementation(({ children }) => {
1716
const overflowRef = { current: document.createElement('div') };
1817
const contextValue = {

src/CheckBox/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class Check extends React.Component {
1515
};
1616
}
1717

18-
/* eslint-disable react/no-did-update-set-state */
1918
componentDidUpdate(prevProps) {
2019
if (prevProps.checked !== this.props.checked) {
2120
this.setState({
@@ -50,8 +49,9 @@ class Check extends React.Component {
5049
}
5150

5251
Check.propTypes = {
53-
// eslint-disable-next-line max-len
54-
/** (`Boolean`): `true` if the state should be checked, `false` otherwise. This prop can be used to manage the Checkbox more directly, overriding the default Checkbox checked state. */
52+
/** (`Boolean`): `true` if the state should be checked, `false` otherwise.
53+
* This prop can be used to manage the Checkbox more directly,
54+
* overriding the default Checkbox checked state. */
5555
checked: PropTypes.bool,
5656
/** (`Boolean`): `true` if the checkbox should be disabled, `false` otherwise */
5757
onChange: PropTypes.func,

src/CheckBoxGroup/index.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ function CheckBoxGroup(props) {
1010
}
1111

1212
CheckBoxGroup.propTypes = {
13-
// eslint-disable-next-line max-len
14-
/** represents the CheckBox components defined within the CheckBoxGroup component and is not a specific named prop that needs to be passed in. At least one CheckBox must be defined within the group. Example: `<CheckBoxGroup><CheckBox .../></CheckBoxGroup>`
13+
/** represents the CheckBox components defined within the CheckBoxGroup
14+
* component and is not a specific named prop that needs to be passed in.
15+
* At least one CheckBox must be defined within the group.
16+
* Example: `<CheckBoxGroup><CheckBox .../></CheckBoxGroup>`
1517
*/
1618
children: PropTypes.arrayOf(PropTypes.element).isRequired,
1719
};

src/Chip/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line import/prefer-default-export
21
export const STYLE_VARIANTS = {
32
DARK: 'dark',
43
LIGHT: 'light',

src/ChipCarousel/ChipCarousel.test.jsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/* eslint-disable jsx-a11y/click-events-have-key-events */
2-
/* eslint-disable jsx-a11y/no-static-element-interactions */
31
import React from 'react';
42
import { render, screen } from '@testing-library/react';
53
import userEvent from '@testing-library/user-event';
64
import { IntlProvider } from 'react-intl';
75
import ChipCarousel from '.';
6+
import Chip from '../Chip';
87

9-
const items = [
10-
<div onClick={jest.fn()} data-testid="chip">Item 1</div>,
11-
<div onClick={jest.fn()} data-testid="chip">Item 2</div>,
12-
<div onClick={jest.fn()} data-testid="chip">Item 3</div>,
13-
<div onClick={jest.fn()} data-testid="chip" />,
14-
];
8+
const items = Array.from({ length: 4 }, (_, i) => (
9+
<Chip onClick={jest.fn()}>
10+
{`Item ${i + 1}`}
11+
</Chip>
12+
));
1513

1614
const ariaLabel = 'Test aria label';
1715
function TestingChipCarousel(props) {
@@ -29,9 +27,9 @@ describe('<ChipCarousel />', () => {
2927
const carousel = screen.getByTestId('chip-carousel');
3028
expect(carousel).toBeTruthy();
3129

32-
const chipItems = screen.queryAllByTestId('chip');
33-
expect(chipItems).toHaveLength(items.length - 1);
34-
for (let i = 0; i < chipItems.length - 1; i++) {
30+
const chipItems = screen.queryAllByRole('button');
31+
expect(chipItems).toHaveLength(items.length);
32+
for (let i = 0; i < chipItems.length; i++) {
3533
expect(chipItems[i].textContent).toBe(items[i].props.children);
3634
}
3735
});

src/Container/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable react/require-default-props */
21
import React from 'react';
32
import classNames from 'classnames';
43
import PropTypes from 'prop-types';

src/DataTable/CollapsibleButtonGroup.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function CollapsibleButtonGroup({
5151
const cloneAction = (action, index) => React.cloneElement(
5252
action.component,
5353
{
54-
// eslint-disable-next-line react/no-array-index-key
5554
key: `${action}${index}`,
5655
as: Button, // for backwards compatibility this is needed
5756
...action.args,

0 commit comments

Comments
 (0)