Skip to content

Commit

Permalink
Merge pull request toggle-corp#756 from toggle-corp/fix/lint-issues
Browse files Browse the repository at this point in the history
Fix lint issues
  • Loading branch information
samshara authored Apr 13, 2021
2 parents a53a79a + 6af86b8 commit 240b1c1
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 26 deletions.
1 change: 1 addition & 0 deletions components/General/Modalize.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';

// eslint-disable-next-line @typescript-eslint/ban-types
declare function modalize<T extends object>(
component: (props: T) => JSX.Element,
): React.ReactComponent<T & { modal: React.ReactElement; initialShowModal?: boolean }>;
Expand Down
2 changes: 1 addition & 1 deletion components/View/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class NormalList extends React.Component {
} = this.props;

if (!groupKeySelector) {
return data.map(this.renderListItem);
return data.map((datum, index) => this.renderListItem(datum, index));
}

// TODO: memoize this operation
Expand Down
2 changes: 1 addition & 1 deletion components/Visualization/GaugeChart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { select } from 'd3-selection';
// FIXME: idk if this has a side-effect
import { range } from 'd3-array';
// import { range } from 'd3-array';
import {
arc,
pie,
Expand Down
10 changes: 5 additions & 5 deletions components/Visualization/Map/MapDownload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ class MapDownload extends React.PureComponent {

render() {
const {
legendContainerClassName, // capturing the prop
setDestroyer,
zoomLevel,
mapContainerRef,
mapStyle, // capturing the prop
legendContainerClassName, // eslint-disable-line no-unused-vars, @typescript-eslint/no-unused-vars, max-len
setDestroyer, // eslint-disable-line no-unused-vars, @typescript-eslint/no-unused-vars
zoomLevel, // eslint-disable-line no-unused-vars, @typescript-eslint/no-unused-vars
mapContainerRef, // eslint-disable-line no-unused-vars, @typescript-eslint/no-unused-vars, max-len
mapStyle, // eslint-disable-line no-unused-vars, @typescript-eslint/no-unused-vars
...otherProps
} = this.props;
const {
Expand Down
2 changes: 1 addition & 1 deletion components/Visualization/PieChart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Responsive from '../../General/Responsive';

import styles from './styles.scss';

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
const dummy = transition;

const propTypes = {
Expand Down
2 changes: 2 additions & 0 deletions utils/common.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// eslint-disable-next-line import/prefer-default-export
export declare function getObjectChildren(
// eslint-disable-next-line @typescript-eslint/ban-types
obj: object,
// FIXME: handle undefined in reverseRoute
keys: (undefined| number | string)[],
Expand Down
1 change: 0 additions & 1 deletion v2/Input/DigitalInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {
padStart,
isFalsyString,
isTruthyString,
_cs,
} from '@togglecorp/fujs';
Expand Down
2 changes: 1 addition & 1 deletion v2/Input/NepaliDateInput/Calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const YearMode = (props: YearModeProps) => {
const maxYear = BS.getMaxYmd().getYear();

const cells = useMemo(
() => [...new Array(maxYear - minYear + 1)],
() => [...new Array((maxYear - minYear) + 1)],
[maxYear, minYear],
);

Expand Down
6 changes: 1 addition & 5 deletions v2/Input/SelectInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ interface DefaultItem {
label: string;
}

interface State<K> {
searchValue?: string;
}

/*
# Feature
- Auto-scroll to selected item on popup open
Expand All @@ -40,7 +36,7 @@ interface State<K> {
- Show values that are invalid (tally with current options)
*/

function filterAndSearch<T, K>(
function filterAndSearch<T>(
options: T[],
labelSelector: (datum: T) => string | number,
searchValue: string,
Expand Down
12 changes: 5 additions & 7 deletions v2/View/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface BaseProps<D, P, K extends OptionKey> {
rendererParams: (key: K, datum: D, index: number, data: D[]) => P;
}

interface GroupOptions<D, P, K extends OptionKey, GP, GK extends OptionKey> {
interface GroupOptions<D, GP, GK extends OptionKey> {
groupComparator?: (a: GK, b: GK) => number;
groupKeySelector(datum: D): GK;
groupRenderer: React.ComponentType<GP>;
Expand All @@ -35,17 +35,17 @@ interface NoGroupOptions {
}

export type ListProps<D, P, K extends OptionKey, GP, GK extends OptionKey> = (
BaseProps<D, P, K> & (GroupOptions<D, P, K, GP, GK> | NoGroupOptions)
BaseProps<D, P, K> & (GroupOptions<D, GP, GK> | NoGroupOptions)
);

export type GroupedListProps<D, P, K extends OptionKey, GP, GK extends OptionKey> = (
BaseProps<D, P, K> & GroupOptions<D, P, K, GP, GK>
BaseProps<D, P, K> & GroupOptions<D, GP, GK>
);

function hasGroup<D, P, K extends OptionKey, GP, GK extends OptionKey>(
props: ListProps<D, P, K, GP, GK>,
): props is (BaseProps<D, P, K> & GroupOptions<D, P, K, GP, GK>) {
return !!(props as BaseProps<D, P, K> & GroupOptions<D, P, K, GP, GK>).grouped;
): props is (BaseProps<D, P, K> & GroupOptions<D, GP, GK>) {
return !!(props as BaseProps<D, P, K> & GroupOptions<D, GP, GK>).grouped;
}

function GroupedList<D, P, K extends OptionKey, GP, GK extends OptionKey>(
Expand Down Expand Up @@ -160,5 +160,3 @@ function List<D, P, K extends OptionKey, GP, GK extends OptionKey>(
List.defaultProps = {
data: [],
};

export default List;
4 changes: 0 additions & 4 deletions v2/View/Message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ interface Props {
resizeFactor: number;
}

interface State {
show: boolean;
}

function Message(props: Props) {
const {
maxFontSize,
Expand Down

0 comments on commit 240b1c1

Please sign in to comment.