diff --git a/.eslintrc.json b/.eslintrc.json index bffb357a7..d5ebe6090 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,8 @@ { - "extends": "next/core-web-vitals" + "extends": ["next/core-web-vitals"], + "plugins": ["prettier"], + "rules": { + "prettier/prettier": ["error"], + "react/no-children-prop": "off" + } } diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..483218bd4 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "semi": false, + "tabWidth": 2, + "useTabs": false, + "printWidth": 80, + "singleQuote": false, + "trailingComma": "es5" +} diff --git a/package.json b/package.json index 871db8ee0..fecce1378 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,8 @@ "typescript": "5.1.6" }, "devDependencies": { + "eslint-plugin-prettier": "5.0.0", + "prettier": "3.0.1", "sass": "1.64.2" } } diff --git a/src/app/StartDsfr.tsx b/src/app/StartDsfr.tsx index 8de8baa51..b077f2634 100644 --- a/src/app/StartDsfr.tsx +++ b/src/app/StartDsfr.tsx @@ -1,18 +1,18 @@ -"use client"; +"use client" -import { startReactDsfr } from "@codegouvfr/react-dsfr/next-appdir"; -import { defaultColorScheme } from "./defaultColorScheme"; -import Link from "next/link"; +import { startReactDsfr } from "@codegouvfr/react-dsfr/next-appdir" +import { defaultColorScheme } from "./defaultColorScheme" +import Link from "next/link" declare module "@codegouvfr/react-dsfr/next-appdir" { - interface RegisterLink { - Link: typeof Link; + interface RegisterLink { + Link: typeof Link } } -startReactDsfr({ defaultColorScheme, Link }); +startReactDsfr({ defaultColorScheme, Link }) -export function StartDsfr(){ +export function StartDsfr() { //Yes, leave null here. - return null; + return null } diff --git a/src/app/components/Footer.tsx b/src/app/components/Footer.tsx index 653288f05..e58503e15 100644 --- a/src/app/components/Footer.tsx +++ b/src/app/components/Footer.tsx @@ -1,11 +1,16 @@ -import { Footer as DSFRFooter, type FooterProps } from "@codegouvfr/react-dsfr/Footer"; +import { + Footer as DSFRFooter, + type FooterProps, +} from "@codegouvfr/react-dsfr/Footer" -import { items as navigationItems } from "./Navigation"; +import { items as navigationItems } from "./Navigation" const otherLinks: FooterProps.LinkList.Column = { categoryName: "Autres", - links: navigationItems.filter((item) => !item.menuLinks) as FooterProps.LinkList.Links, -}; + links: navigationItems.filter( + (item) => !item.menuLinks + ) as FooterProps.LinkList.Links, +} const navigationToFooterLinkList: FooterProps.LinkList.List = [ ...navigationItems @@ -14,14 +19,14 @@ const navigationToFooterLinkList: FooterProps.LinkList.List = [ const listColumn: FooterProps.LinkList.Column = { categoryName: item.text as string, links: item.menuLinks?.map((menuLink) => { - const link = menuLink as FooterProps.LinkList.Link; - return link; + const link = menuLink as FooterProps.LinkList.Link + return link }) as FooterProps.LinkList.Links, - }; - return listColumn; + } + return listColumn }), otherLinks, -] as unknown as FooterProps.LinkList.List; +] as unknown as FooterProps.LinkList.List export default function Footer() { return ( @@ -59,5 +64,5 @@ export default function Footer() { }} linkList={navigationToFooterLinkList} /> - ); + ) } diff --git a/src/app/components/Header.tsx b/src/app/components/Header.tsx index 2c09389c2..6e4e2e4b2 100644 --- a/src/app/components/Header.tsx +++ b/src/app/components/Header.tsx @@ -1,5 +1,5 @@ -import Navigation from "./Navigation"; -import { Header as DSFRHeader } from "@codegouvfr/react-dsfr/Header"; +import Navigation from "./Navigation" +import { Header as DSFRHeader } from "@codegouvfr/react-dsfr/Header" export default function Header() { return ( @@ -13,7 +13,8 @@ export default function Header() { } homeLinkProps={{ href: "/", - title: "Accueil - Nom de l'entité (ministère, secrétariat d'état, gouvernement)", + title: + "Accueil - Nom de l'entité (ministère, secrétariat d'état, gouvernement)", }} id="fr-header-header-with-quick-access-items-nav-items-and-search-engine" navigation={} @@ -29,5 +30,5 @@ export default function Header() { serviceTagline="Un incubateur betagouv 🥸" serviceTitle="La Fabrique des Ministères Sociaux" /> - ); + ) } diff --git a/src/app/components/Navigation.tsx b/src/app/components/Navigation.tsx index 45fce2c80..bf5f566a9 100644 --- a/src/app/components/Navigation.tsx +++ b/src/app/components/Navigation.tsx @@ -1,4 +1,7 @@ -import { MainNavigation, type MainNavigationProps } from "@codegouvfr/react-dsfr/MainNavigation"; +import { + MainNavigation, + type MainNavigationProps, +} from "@codegouvfr/react-dsfr/MainNavigation" export const items: MainNavigationProps.Item[] = [ { @@ -74,7 +77,7 @@ export const items: MainNavigationProps.Item[] = [ }, text: "Recrutement", }, -]; +] export default function Navigation() { return diff --git a/src/app/defaultColorScheme.ts b/src/app/defaultColorScheme.ts index efbdc5ad4..e9a9ae25b 100644 --- a/src/app/defaultColorScheme.ts +++ b/src/app/defaultColorScheme.ts @@ -1,3 +1,3 @@ -import type { DefaultColorScheme } from "@codegouvfr/react-dsfr/next-appdir"; +import type { DefaultColorScheme } from "@codegouvfr/react-dsfr/next-appdir" -export const defaultColorScheme: DefaultColorScheme = "system"; +export const defaultColorScheme: DefaultColorScheme = "system" diff --git a/src/app/layout.tsx b/src/app/layout.tsx index bd199f1ac..d250d87c3 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,23 +1,27 @@ -import "./globals.css"; -import type { Metadata } from "next"; +import "./globals.css" +import type { Metadata } from "next" -import { defaultColorScheme } from "./defaultColorScheme"; -import { DsfrHead } from "@codegouvfr/react-dsfr/next-appdir/DsfrHead"; -import { DsfrProvider } from "@codegouvfr/react-dsfr/next-appdir/DsfrProvider"; -import { getHtmlAttributes } from "@codegouvfr/react-dsfr/next-appdir/getHtmlAttributes"; -import { StartDsfr } from "./StartDsfr"; +import { defaultColorScheme } from "./defaultColorScheme" +import { DsfrHead } from "@codegouvfr/react-dsfr/next-appdir/DsfrHead" +import { DsfrProvider } from "@codegouvfr/react-dsfr/next-appdir/DsfrProvider" +import { getHtmlAttributes } from "@codegouvfr/react-dsfr/next-appdir/getHtmlAttributes" +import { StartDsfr } from "./StartDsfr" -import Link from "next/link"; -import Header from "./components/Header"; -import Footer from "./components/Footer"; +import Link from "next/link" +import Header from "./components/Header" +import Footer from "./components/Footer" export const metadata: Metadata = { title: "Create Next App", description: "Generated by create next app", -}; +} -export default function RootLayout({ children }: { children: React.ReactNode }) { - const lang = "fr"; +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + const lang = "fr" return ( @@ -46,5 +50,5 @@ export default function RootLayout({ children }: { children: React.ReactNode }) - ); + ) } diff --git a/src/app/page.tsx b/src/app/page.tsx index 5b97c9758..b234cb1ff 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,11 +1,14 @@ -import { fr } from "@codegouvfr/react-dsfr"; +import { fr } from "@codegouvfr/react-dsfr" export default function Home() { return ( -
+

Santé, Solidarité, Travail: nos startups à votre service

- ); + ) } diff --git a/yarn.lock b/yarn.lock index f3322c16e..9893a21cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -903,6 +903,14 @@ eslint-plugin-jsx-a11y@^6.5.1: object.fromentries "^2.0.6" semver "^6.3.0" +eslint-plugin-prettier@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz#6887780ed95f7708340ec79acfdf60c35b9be57a" + integrity sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.8.5" + eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705: version "5.0.0-canary-7118f5dd7-20230705" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.0.0-canary-7118f5dd7-20230705.tgz#4d55c50e186f1a2b0636433d2b0b2f592ddbccfd" @@ -1053,6 +1061,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0: version "3.3.1" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" @@ -2042,6 +2055,18 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.1.tgz#65271fc9320ce4913c57747a70ce635b30beaa40" + integrity sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ== + prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"