diff --git a/bun.lockb b/bun.lockb index 373e7df..fdb800f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/index.ts b/src/index.ts index 6dd4aa7..ac855eb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,7 @@ import { noCustomFontWeight } from './rules/no-custom-fontWeight'; +import { deprecateFormik } from './rules/deprecate-formik'; export const rules = { 'no-custom-fontWeight': noCustomFontWeight, + 'deprecate-formik': deprecateFormik, }; diff --git a/src/rules/deprecate-formik.ts b/src/rules/deprecate-formik.ts new file mode 100644 index 0000000..25b520a --- /dev/null +++ b/src/rules/deprecate-formik.ts @@ -0,0 +1,31 @@ +import type { Rule } from 'eslint'; + +/** + * Warn about Formik usage. + * Promote the use of React Hook Form. + */ +export const deprecateFormik: Rule.RuleModule = { + meta: { + type: 'suggestion', + docs: { + description: 'Warn about Formik being deprecated in favor of react-hook-form', + category: 'Best Practices', + recommended: false, + }, + messages: { + formikUsage: 'Formik is being deprecated. Please use react-hook-form.', + }, + }, + create(context) { + return { + Identifier(node) { + if (node.name === 'useFormik' || node.name === 'Formik') { + context.report({ + node, + messageId: 'formikUsage', + }); + } + }, + }; + }, +};