Migrate components to eslint
This commit is contained in:
parent
de66486e41
commit
b13dbcfa77
69 changed files with 875 additions and 800 deletions
|
@ -1,6 +1,4 @@
|
|||
// A separate file so this doesn't get picked up by StyleGuidist over real components
|
||||
|
||||
import { Ref } from 'react';
|
||||
import { MutableRefObject, Ref } from 'react';
|
||||
import { isFunction } from 'lodash';
|
||||
import memoizee from 'memoizee';
|
||||
|
||||
|
@ -8,6 +6,8 @@ export function cleanId(id: string): string {
|
|||
return id.replace(/[^\u0020-\u007e\u00a0-\u00ff]/g, '_');
|
||||
}
|
||||
|
||||
// Memoizee makes this difficult.
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export const createRefMerger = () =>
|
||||
memoizee(
|
||||
<T>(...refs: Array<Ref<T>>) => {
|
||||
|
@ -16,8 +16,9 @@ export const createRefMerger = () =>
|
|||
if (isFunction(r)) {
|
||||
r(t);
|
||||
} else if (r) {
|
||||
// @ts-ignore: React's typings for ref objects is annoying
|
||||
r.current = t;
|
||||
// Using a MutableRefObject as intended
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
(r as MutableRefObject<T>).current = t;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue