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: migrates from tslint to eslint #265

Closed
wants to merge 8 commits into from
Closed
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
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "react"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off"
},
"overrides": [
{
"files": "./stories/*.tsx",
"rules": {
"react/display-name": "off",
"@typescript-eslint/no-unused-vars": "off"
}
}
],
"settings": {
"react": {
"version": "detect"
}
}
}
3 changes: 0 additions & 3 deletions .jshintrc

This file was deleted.

4 changes: 2 additions & 2 deletions antd/components/input/input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Disabled.args = {
placeholder: 'Type something here',
};

export const Error = (args: any) => {
export const Error = () => {
return (
<div style={{width: '50%', marginBottom: '1em'}}>
<Form>
Expand All @@ -61,7 +61,7 @@ Error.args = {
placeholder: 'Type something here',
};

export const Warning = (args: any) => {
export const Warning = () => {
return (
<div style={{width: '50%', marginBottom: '1em'}}>

Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"scripts": {
"build": "build-storybook -o ./dist/storybook",
"lint": "tslint -p .",
"lint": "eslint --ext .tsx .",
"test": "jest",
"utils:icons": "rm -f src/assets/fonts/* && node ./scripts/icons/generator.js",
"start": "start-storybook -p 6006",
Expand Down Expand Up @@ -80,6 +80,8 @@
"@types/storybook__addon-actions": "^5.2.1",
"@types/storybook__addon-links": "^3.3.0",
"@types/storybook__react": "^3.0.7",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"@types/uuid": "^9.0.1",
"@types/yamljs": "^0.2.31",
"babel-loader": "^8.2.5",
Expand All @@ -91,6 +93,8 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.7",
"enzyme-to-json": "^3.6.2",
"eslint": "^8.23.0",
"eslint-plugin-react": "^7.31.1",
"foreman": "^3.0.1",
"glob": "^8.0.3",
"gulp": "^4.0.2",
Expand Down Expand Up @@ -119,8 +123,6 @@
"ts-jest": "^26.5.6",
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
"tslint": "^5.20.1",
"tslint-react": "^3.4.0",
"webfonts-generator": "^0.4.0",
"webpack": "^5.76.2",
"webpack-bundle-analyzer": "^4.9.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/autocomplete/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const Autocomplete = (props: AutocompleteProps) => {
if (menuItems.length === 0) {
return <div style={{display: 'none'}} />;
}
return <div style={{...style, ...this.menuStyle, background: 'white', zIndex: 20, maxHeight: '20em'}} children={menuItems} />;
return <div style={{...style, ...this.menuStyle, background: 'white', zIndex: 20, maxHeight: '20em'}}>{menuItems}</div>;
}}
getItemValue={(item: any) => item.label}
items={items}
Expand Down
2 changes: 1 addition & 1 deletion src/components/data-loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface LoaderState<TInput, TResult> {
inputChanged: boolean;
}

export class DataLoader<D = {}, I = undefined> extends React.Component<LoaderProps<I, D> | LoaderPropsNoInput<D>, LoaderState<I, D>> {
export class DataLoader<D = any, I = undefined> extends React.Component<LoaderProps<I, D> | LoaderPropsNoInput<D>, LoaderState<I, D>> {
public static contextTypes = {
router: PropTypes.object,
apis: PropTypes.object,
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class DropDown extends React.Component<DropDownProps, DropDownState> {
);
}

public componentWillMount() {
public UNSAFE_componentWillMount() {
this.subscriptions = [merge(
dropDownOpened.pipe(filter((dropdown) => dropdown !== this)),
fromEvent(document, 'click').pipe(filter((event: Event) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/logs-viewer/logs-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class LogsViewer extends React.Component<LogsViewerProps> {
super(props);
}

public componentWillReceiveProps(nextProps: LogsViewerProps) {
public UNSAFE_componentWillReceiveProps(nextProps: LogsViewerProps) {
if (this.props.source.key !== nextProps.source.key) {
this.refresh(nextProps.source);
}
Expand Down Expand Up @@ -61,7 +61,7 @@ export class LogsViewer extends React.Component<LogsViewerProps> {
);
}

public shouldComponentUpdate(prevProps: LogsViewerProps) {
public shouldComponentUpdate() {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/popup/popup-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface PopupApi {
},
customIcon?: {name: string, color: string},
titleColor?: string,
defaultValues?: {},
defaultValues?: FormValues,
): Promise<FormValues | null>;
}

Expand Down Expand Up @@ -58,7 +58,7 @@ export class PopupManager implements PopupApi {
},
customIcon?: { name: string, color: string },
titleColor?: string,
defaultValues?: {},
defaultValues?: FormValues,
): Promise<FormValues | null> {
return new Promise((resolve) => {
const closeAndResolve = (result: FormValues | null) => {
Expand Down
2 changes: 1 addition & 1 deletion stories/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { storiesOf } from '@storybook/react';
import {default as classNames} from 'classnames';
import * as React from 'react';

class TableExample extends React.Component<{}, {selectedIndex: number}> {
class TableExample extends React.Component<any, {selectedIndex: number}> {

constructor(props: any) {
super(props);
Expand Down
19 changes: 0 additions & 19 deletions tslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion v2/components/action-button/action-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Theme} from '../theme-div/theme-div';
import './action-button.scss';

export interface ActionButtonProps {
// tslint:disable-next-line:ban-types
// eslint-disable-next-line @typescript-eslint/ban-types
action?: Function;
label?: string;
icon?: string;
Expand Down
22 changes: 15 additions & 7 deletions v2/components/autocomplete/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export const Autocomplete = (
onItemClick?: (item: string) => void;
icon?: string;
inputref?: React.MutableRefObject<HTMLInputElement>;
},
value: string;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
className?: string;
style?: React.CSSProperties;
}
) => {
return (
<KeybindingProvider>
Expand All @@ -45,7 +49,11 @@ export const RenderAutocomplete = (
onItemClick?: (item: string) => void;
icon?: string;
inputref?: React.MutableRefObject<HTMLInputElement>;
},
value: string;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
className?: string;
style?: React.CSSProperties;
}
) => {
const [curItems, setCurItems] = React.useState(props.items || []);
const nullInputRef = React.useRef<HTMLInputElement>(null);
Expand Down Expand Up @@ -73,8 +81,8 @@ export const RenderAutocomplete = (
const filtered = (props.items || []).filter((i) => {
if (i) {
return props.abbreviations !== undefined
? i.toLowerCase().includes(debouncedVal?.toLowerCase()) || props.abbreviations.get(i)?.includes(debouncedVal?.toLowerCase())
: i.toLowerCase().includes(debouncedVal?.toLowerCase());
? i.toLowerCase().includes(debouncedVal?.toLowerCase()) || props.abbreviations.get(i)?.includes(debouncedVal?.toLowerCase())
: i.toLowerCase().includes(debouncedVal?.toLowerCase());
}
return false;
});
Expand Down Expand Up @@ -111,7 +119,7 @@ export const RenderAutocomplete = (

useKeybinding({
keys: Key.ESCAPE,
action: (e) => {
action: () => {
if (showSuggestions) {
reset();
setShowSuggestions(false);
Expand Down Expand Up @@ -140,7 +148,7 @@ export const RenderAutocomplete = (

useKeybinding({
keys: Key.UP,
action: (e) => {
action: () => {
if (showSuggestions) {
nav(-1);
return false;
Expand Down Expand Up @@ -244,7 +252,7 @@ export const RenderAutocomplete = (
</div>
))}
</ThemeDiv>,
document.body,
document.body
)}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion v2/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const useDebounce = (value: string, debouncems: number): string => {
* A formatted field, accompanied by the `useInput` hook. `useInput` returns a `[data, setData, props]` thruple, where `data` and `setData` are analagous to `React.useState`,
* and `props` are designed to be included in the Input component with a spread operator: `<Input YOUR_PROPS_HERE {...props} />`
*/
export const Input = (props: React.InputHTMLAttributes<HTMLInputElement> & {innerref?: React.MutableRefObject<any>}) => (
export const Input = (props: React.InputHTMLAttributes<HTMLInputElement> & {innerref?: React.MutableRefObject<any>, className?: string}) => (
<ThemeDiv className='input-container'>
<input {...(props as any)} className={props.className ? `${props.className} input` : 'input'} ref={props.innerref} />
</ThemeDiv>
Expand Down
1 change: 1 addition & 0 deletions v2/components/theme-div/theme-div.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const ThemeDiv = (
disabled?: boolean;
innerref?: React.LegacyRef<any>;
theme?: Theme;
className?: string;
} & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
) => {
const theme = props.theme || useTheme();
Expand Down
2 changes: 1 addition & 1 deletion v2/components/ticker/ticker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
},
};

export const Primary = (args: any) => {
export const Primary = () => {
const [randVal, setRandVal] = React.useState(0);

React.useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion v2/shared/keypress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export const KeybindingContext = React.createContext<{
useKeybinding: KeyFxn;
}>({
keybindingState: NewGroupMap(),
useKeybinding: (props: KeyFxnProps) => null,
useKeybinding: () => null,
});

export const KeybindingProvider = (props: {children: React.ReactNode}) => {
Expand Down
Loading
Loading