mirror of
https://github.com/wassname/talk.git
synced 2026-07-20 12:40:47 +08:00
[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user