From 84ca93237ec11c486ecb30d9a956f859e0942034 Mon Sep 17 00:00:00 2001 From: AndreaPontrandolfo Date: Fri, 1 Nov 2024 20:25:12 +0100 Subject: [PATCH 1/3] feature(rules): changed some rules for nextjs Fixes #251 --- packages/eslint-config-sheriff/src/nextjsConfig.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/eslint-config-sheriff/src/nextjsConfig.ts b/packages/eslint-config-sheriff/src/nextjsConfig.ts index 7cc8a2ec..3d61e4a1 100644 --- a/packages/eslint-config-sheriff/src/nextjsConfig.ts +++ b/packages/eslint-config-sheriff/src/nextjsConfig.ts @@ -10,5 +10,13 @@ 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', + }, + ], }, }; From fcc56c9b457707ea8669eb80f552ca3778909763 Mon Sep 17 00:00:00 2001 From: AndreaPontrandolfo Date: Fri, 1 Nov 2024 20:27:42 +0100 Subject: [PATCH 2/3] added changeset --- .changeset/nice-walls-cheat.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/nice-walls-cheat.md 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 From 187e43cfc3f6a4c96fe3cef043cd2406b4e1d816 Mon Sep 17 00:00:00 2001 From: AndreaPontrandolfo Date: Fri, 1 Nov 2024 20:42:54 +0100 Subject: [PATCH 3/3] feature(rules): disabled a nextjs rule --- apps/config-validation-playground/src/mocks/InfoButton.tsx | 2 ++ apps/config-validation-playground/src/samples/react.tsx | 2 ++ packages/eslint-config-sheriff/src/nextjsConfig.ts | 1 + 3 files changed, 5 insertions(+) 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 3d61e4a1..0e90dc45 100644 --- a/packages/eslint-config-sheriff/src/nextjsConfig.ts +++ b/packages/eslint-config-sheriff/src/nextjsConfig.ts @@ -18,5 +18,6 @@ export const nextjsConfig = { 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. }, };