Skip to content

Commit

Permalink
feat: add comment of eslint disabled rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Orcus2021 committed Jun 5, 2024
1 parent 5fb060d commit 80d3dd5
Show file tree
Hide file tree
Showing 235 changed files with 119 additions and 370 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Here is a quick example to get you started:
**./App.js**

```jsx
import React from 'react';
import { createRoot } from 'react-dom/client';

import CustomComponent from './CustomComponent';
Expand All @@ -48,7 +47,6 @@ root.render(<App />);
**./CustomComponent.js**

```jsx
import React from 'react';
import { Button } from '@ichef/gypcrete';

const CustomComponent = () => <Button basic="Hello World!" />;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/configs/svgr/componentTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function componentTemplate({ template }, opts, { componentName, props, jsx }) {
* See usage: https://babeljs.io/docs/en/next/babel-template.html#string-usage
*/
const code = `
import React from 'react';
NEWLINE
export default function COMPONENT_NAME(PROPS) {
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Avatar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/BasicRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';

import FlexCell from './FlexCell';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';

Check warning on line 1 in packages/core/src/Button.js

View workflow job for this annotation

GitHub Actions / Lint and test

Filename 'Button' must match the exported name 'RowCompButton'
import classNames from 'classnames';

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Checkbox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import prefixClass from './utils/prefixClass';
Expand Down Expand Up @@ -90,7 +90,7 @@ class Checkbox extends PureComponent {
render() {
const {
input,
indeterminate,
indeterminate, // eslint-disable-line no-unused-vars
overrideButton,
// <input> props
checked,
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/ColumnView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/ColumnView.scss';
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/EditableBasicRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useRef, useEffect } from 'react';
import { useState, useRef, useEffect } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/EditableBasicRow.scss';
Expand Down Expand Up @@ -56,7 +56,7 @@ export const ROW_INPUT_TAGS = {
* onChange={(event) => console.log(event.target.value)} />
* ```
*/

// eslint-disable-next-line no-undef
const EditableBasicRow = React.memo(
({
inputTag: InputTag,
Expand All @@ -69,13 +69,15 @@ const EditableBasicRow = React.memo(
onFocus,
onBlur,
// status props
// eslint-disable-next-line no-unused-vars
status, // digested by this component and should not go into <input>
statusIcon,
// React props
className,
// <BasicRow> props from <Text>, should ignore
// eslint-disable-next-line no-unused-vars
basic, // eslint-disable-line react/prop-types
tag, // eslint-disable-line react/prop-types
tag, // eslint-disable-line react/prop-types, no-unused-vars
...inputProps
}) => {
const [currentValue, setCurrentValue] = useState(
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/EditableText.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';

import withStatus, { withStatusPropTypes, STATUS_CODE } from './mixins/withStatus';
Expand Down Expand Up @@ -87,7 +87,7 @@ class EditableText extends PureComponent {
statusIcon,
errorMsg,
// React props,
className,
className, // eslint-disable-line no-unused-vars
...editableRowProps
} = this.props;

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/EditableTextLabel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { useState, useEffect, useCallback, useRef } from 'react';
import PropTypes from 'prop-types';
import keycode from 'keycode';

Expand Down Expand Up @@ -32,6 +32,7 @@ const TOUCH_TIMEOUT_MS = 250;
* It does not offer direct control to the `<input>` inside.
*/

// eslint-disable-next-line no-undef
const EditableTextLabel = React.memo(
({
inEdit: inEditProp, // not used here
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/FlexCell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';

import icBEM from './utils/icBEM';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/HeaderRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/HeaderRow.scss';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Icon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/IconButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand All @@ -19,8 +18,8 @@ import IconLayout from './IconLayout';
function IconButton({
icon,
tinted,
color,
solid,
color, // eslint-disable-line no-unused-vars
solid, // eslint-disable-line no-unused-vars
// React props
className,
...buttonProps
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/IconCheckbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import IconLayout from './IconLayout';
import Checkbox, { CHECKBOX_BUTTON } from './Checkbox';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/IconLayout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';

import withStatus, { withStatusPropTypes } from './mixins/withStatus';
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/InfiniteScroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent, isValidElement } from 'react';
import { PureComponent, isValidElement } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import documentOffset from 'document-offset';
Expand Down Expand Up @@ -272,6 +272,7 @@ class InfiniteScroll extends PureComponent {
// Renderer
// -------------------------------------

/* eslint-disable no-unused-vars */
render() {
const {
onLoadMore,
Expand All @@ -290,6 +291,7 @@ class InfiniteScroll extends PureComponent {
style,
...rootProps
} = this.props;
/* eslint-enable no-unused-vars */

// Get classnames and styles`
const rootClassName = classNames(`${BEM.root}`, className);
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/List.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/List.scss';
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/ListRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down Expand Up @@ -58,6 +58,7 @@ class ListRow extends PureComponent {
);
}

/* eslint-disable no-unused-vars */
render() {
const {
highlight,
Expand All @@ -72,6 +73,7 @@ class ListRow extends PureComponent {
children,
...wrapperProps
} = this.props;
/* eslint-enable no-unused-vars */

const bemClass = BEM.root.modifier('highlight', highlight);

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Modal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import memoize from 'memoize-one';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Overlay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import classNames from 'classnames';

import icBEM from './utils/icBEM';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Popover.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Popup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { isValidElement } from 'react';
import { isValidElement } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/PopupButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';

import prefixClass from './utils/prefixClass';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Radio.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/SearchInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down Expand Up @@ -63,6 +63,7 @@ class SearchInput extends Component {
innerValue: this.props.defaultValue,
};

// eslint-disable-next-line no-undef
inputRef = React.createRef();

cachedValue = null;
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Section.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/SplitView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';

import icBEM from './utils/icBEM';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/SplitViewColumn.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/StatusIcon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useRef, useCallback, useEffect } from 'react';
import { useState, useRef, useCallback, useEffect } from 'react';
import PropTypes from 'prop-types';

import icBEM from './utils/icBEM';
Expand All @@ -21,6 +21,7 @@ const ROOT_BEM = icBEM(COMPONENT_NAME);

const ICON_HIDE_TIMEOUT = 2 * 1000;

// eslint-disable-next-line no-undef
const StatusIcon = React.memo(({ status, position, autohide, ...wrapperProps }) => {
const [hideIcon, setHideIcon] = useState(false);
const hideIconTimeout = useRef(null);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Switch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/SwitchIcon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Tag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';
import './styles/Tag.scss';

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* └╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘
*/

import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down Expand Up @@ -90,8 +90,10 @@ class Text extends PureComponent {
className: classNames(BEM.row.toString(), BEM.basic.toString()),
};

// eslint-disable-next-line no-undef
if (basicRow && React.isValidElement(basicRow)) {
// Inject { basic, tag, statusIcon } to default or custom row.
// eslint-disable-next-line no-undef
return React.cloneElement(basicRow, basicRowProps);
}

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/TextEllipsis.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import icBEM from './utils/icBEM';
import prefixClass from './utils/prefixClass';
import './styles/TextEllipsis.scss';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/TextInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down Expand Up @@ -99,7 +98,7 @@ function TextInput(
maxRows,
// React props
className,
children,
children, // eslint-disable-line no-unused-vars
...inputProps
},
context,
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/TextLabel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';
import prefixClass from './utils/prefixClass';
import rowComp from './mixins/rowComp';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Tooltip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';

import icBEM from './utils/icBEM';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Avatar.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/__tests__/BasicRow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
/* eslint-disable testing-library/no-node-access */
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Button.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Checkbox.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow, mount } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/ColumnView.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/EditableBasicRow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import EditableBasicRow, { ROW_INPUT_TAGS } from '../EditableBasicRow';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/EditableText.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/EditableTextLabel.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { screen, render, waitFor, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import EditableTextLabel from '../EditableTextLabel';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/FlexCell.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import FlexCell from '../FlexCell';

Expand Down
Loading

0 comments on commit 80d3dd5

Please sign in to comment.