Fix apps/console lint issues
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -2,7 +2,14 @@ import react from "eslint-plugin-react";
|
||||
import * as reactHooks from "eslint-plugin-react-hooks";
|
||||
|
||||
export const reactConfigs = [
|
||||
react.configs.flat.recommended,
|
||||
react.configs.flat["jsx-runtime"],
|
||||
reactHooks.configs.flat.recommended,
|
||||
{
|
||||
...react.configs.flat.recommended,
|
||||
...react.configs.flat["jsx-runtime"],
|
||||
...reactHooks.configs.flat.recommended,
|
||||
settings: {
|
||||
react: {
|
||||
version: "detect",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -18,7 +18,14 @@ export const stylisticConfigs = [
|
||||
rules: {
|
||||
"@stylistic/max-len": [
|
||||
"warn",
|
||||
{ code: 120, ignoreUrls: true, ignoreStrings: true },
|
||||
{
|
||||
code: 120,
|
||||
tabWidth: 2,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
ignoreTrailingComments: true,
|
||||
ignoreUrls: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
} satisfies Linter.Config,
|
||||
|
||||
@@ -14,7 +14,9 @@ type BaseProps<T extends string, P> = {
|
||||
children?: ReactNode;
|
||||
} & P;
|
||||
|
||||
type Props<T extends string | readonly string[] | number = string> =
|
||||
type FieldValue = string | readonly string[] | number
|
||||
|
||||
type Props<T extends FieldValue = string> =
|
||||
| BaseProps<never, ComponentProps<typeof Input>>
|
||||
| BaseProps<"text", ComponentProps<typeof Input>>
|
||||
| BaseProps<"email", ComponentProps<typeof Input>>
|
||||
@@ -34,7 +36,7 @@ const field = tv({
|
||||
|
||||
const { base: baseClass, label: labelClass, help: helpClass } = field();
|
||||
|
||||
export function Field<T extends string | readonly string[] | number = string>(props: Props<T>) {
|
||||
export function Field<T extends FieldValue = string>(props: Props<T>) {
|
||||
const showHelp = props.help && !props.error;
|
||||
const childrenAsInput = !props.type && props.children;
|
||||
return (
|
||||
@@ -55,7 +57,7 @@ export function Field<T extends string | readonly string[] | number = string>(pr
|
||||
);
|
||||
}
|
||||
|
||||
function getInput<T extends string | readonly string[] | number = string>(props: Props<T>) {
|
||||
function getInput<T extends FieldValue = string>(props: Props<T>) {
|
||||
const { error, onValueChange, type, ...restProps } = props;
|
||||
const baseProps = {
|
||||
["aria-invalid"]: !!error,
|
||||
|
||||
Reference in New Issue
Block a user