[CORL-678] Transition to eslint (#2634)

* chore: setup eslint

* chore: tslint checks with types & check for import order

* chore: complete eslint transition

* fix: tests

* fix: linting after rebase, faster lint for lint-staged

* chore: remove line

* fix: lint rules

* feat: add a11y linter and fix errors

* fix: tests
This commit is contained in:
Vinh
2019-10-15 22:56:38 +00:00
committed by Wyatt Johnson
parent b0e0ba6633
commit 3bfcc509d2
569 changed files with 2592 additions and 1925 deletions
@@ -4,11 +4,10 @@ import React, { FunctionComponent } from "react";
import { Omit, PropTypesOf } from "coral-framework/types";
import { PasswordField as PasswordFieldUI } from "coral-ui/components";
export interface Props
extends Omit<
PropTypesOf<typeof PasswordFieldUI>,
"showPasswordTitle" | "hidePasswordTitle"
> {}
type Props = Omit<
PropTypesOf<typeof PasswordFieldUI>,
"showPasswordTitle" | "hidePasswordTitle"
>;
const PasswordField: FunctionComponent<Props> = props => (
<Localized
@@ -152,7 +152,7 @@ class MarkdownEditor extends Component<Props> {
this.editor.codemirror.on("change", this.onChange);
}
public componentWillReceiveProps(nextProps: Props) {
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (
this.props.value !== nextProps.value &&
nextProps.value !== this.editor!.value()
@@ -198,18 +198,20 @@ let enhanced = withGetMessage(MarkdownEditor);
if (process.env.NODE_ENV === "test") {
// Replace with simple texteditor because it won't work in a jsdom environment.
enhanced = ({ onChange, ...rest }) => (
<div className={styles.wrapper}>
<textarea
{...rest}
onChange={(e: ChangeEvent<HTMLTextAreaElement> | string) => {
if (onChange) {
onChange(typeof e === "string" ? e : e.target.value);
}
}}
/>
</div>
);
enhanced = function MarkdownEditorTest({ onChange, ...rest }) {
return (
<div className={styles.wrapper}>
<textarea
{...rest}
onChange={(e: ChangeEvent<HTMLTextAreaElement> | string) => {
if (onChange) {
onChange(typeof e === "string" ? e : e.target.value);
}
}}
/>
</div>
);
};
}
export default enhanced;