diff --git a/.changeset/nice-walls-cheat.md b/.changeset/nice-walls-cheat.md new file mode 100644 index 00000000..4d9add74 --- /dev/null +++ b/.changeset/nice-walls-cheat.md @@ -0,0 +1,6 @@ +--- +'eslint-config-sheriff': minor +--- + +feature(rules): changed some rules for nextjs +Fixes #251 diff --git a/apps/config-validation-playground/src/mocks/InfoButton.tsx b/apps/config-validation-playground/src/mocks/InfoButton.tsx index 859cb666..bc8c3d09 100644 --- a/apps/config-validation-playground/src/mocks/InfoButton.tsx +++ b/apps/config-validation-playground/src/mocks/InfoButton.tsx @@ -1,3 +1,5 @@ +/* eslint-disable react/function-component-definition */ + import type { JSX } from 'react'; interface InfoButtonProps { diff --git a/apps/config-validation-playground/src/samples/react.tsx b/apps/config-validation-playground/src/samples/react.tsx index c9b598f2..9a7d75af 100644 --- a/apps/config-validation-playground/src/samples/react.tsx +++ b/apps/config-validation-playground/src/samples/react.tsx @@ -1,3 +1,5 @@ +/* eslint-disable react/function-component-definition */ + import type { JSX } from 'react'; export const MyComponent = (): JSX.Element => { diff --git a/packages/eslint-config-sheriff/src/nextjsConfig.ts b/packages/eslint-config-sheriff/src/nextjsConfig.ts index 7cc8a2ec..0e90dc45 100644 --- a/packages/eslint-config-sheriff/src/nextjsConfig.ts +++ b/packages/eslint-config-sheriff/src/nextjsConfig.ts @@ -10,5 +10,14 @@ export const nextjsConfig = { rules: { ...nextjs.configs.recommended.rules, ...nextjs.configs['core-web-vitals'].rules, + 'import/no-default-export': 0, + 'react/function-component-definition': [ + 2, + { + namedComponents: 'function-declaration', + unnamedComponents: 'function-expression', + }, + ], + '@next/next/no-html-link-for-pages': 0, // pages router is legacy at this point. We don't need to support this rule anymore. }, };