Skip to content

Commit

Permalink
Merge pull request #6 from abailly-akamai/M3-8552
Browse files Browse the repository at this point in the history
[M3-8552] - Add new deprecated formik rule
  • Loading branch information
abailly-akamai authored Sep 16, 2024
2 parents 7f7e4ea + d0126c7 commit 3739810
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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,
};
31 changes: 31 additions & 0 deletions src/rules/deprecate-formik.ts
Original file line number Diff line number Diff line change
@@ -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',
});
}
},
};
},
};

0 comments on commit 3739810

Please sign in to comment.