From 3d8695864760041dbee1483aa9c43134a1d07528 Mon Sep 17 00:00:00 2001 From: Aitor Urrutia Date: Fri, 14 Jan 2022 20:28:45 +0100 Subject: [PATCH] chore: prettier erabiltzen du --- .prettierignore | 3 ++ .prettierrc | 11 ++++++ .vscode/settings.json | 4 +++ front/gatsby-config.js | 72 +++++++++++++++++++-------------------- front/src/pages/404.tsx | 18 +++++----- front/src/pages/index.tsx | 47 +++++++++++++------------ package.json | 8 +++-- yarn.lock | 5 +++ 8 files changed, 98 insertions(+), 70 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 .vscode/settings.json diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..787a01b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +front/node_modules +front/public +front/.cache \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..e36d076 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": true, + "bracketSameLine": false, + "arrowParens": "avoid" +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e29a1a5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "editor.formatOnSave": true, +} diff --git a/front/gatsby-config.js b/front/gatsby-config.js index ad50c19..f5d4a35 100644 --- a/front/gatsby-config.js +++ b/front/gatsby-config.js @@ -1,39 +1,39 @@ -require("dotenv").config({ - path: `.env`, - }) - - module.exports = { - plugins: [ - "gatsby-plugin-react-helmet", - { - resolve: `gatsby-source-filesystem`, - options: { - name: `images`, - path: `${__dirname}/src/images`, - }, +require('dotenv').config({ + path: `.env`, +}); + +module.exports = { + plugins: [ + 'gatsby-plugin-react-helmet', + { + resolve: `gatsby-source-filesystem`, + options: { + name: `images`, + path: `${__dirname}/src/images`, }, - { - resolve: "gatsby-source-strapi", - options: { - apiURL: process.env.API_URL || "http://localhost:1337/api", - singleTypes: ["hasiera"], - queryLimit: 1000, - }, + }, + { + resolve: 'gatsby-source-strapi', + options: { + apiURL: process.env.API_URL || 'http://localhost:1337/api', + singleTypes: ['hasiera'], + queryLimit: 1000, }, - "gatsby-transformer-sharp", - "gatsby-plugin-sharp", - { - resolve: `gatsby-plugin-manifest`, - options: { - name: "gatsby-starter-default", - short_name: "starter", - start_url: "/", - background_color: `#663399`, - theme_color: `#663399`, - display: `minimal-ui`, - icon: `src/images/favicon.png`, - }, + }, + 'gatsby-transformer-sharp', + 'gatsby-plugin-sharp', + { + resolve: `gatsby-plugin-manifest`, + options: { + name: 'gatsby-starter-default', + short_name: 'starter', + start_url: '/', + background_color: `#663399`, + theme_color: `#663399`, + display: `minimal-ui`, + icon: `src/images/favicon.png`, }, - "gatsby-plugin-sitemap" - ], - } \ No newline at end of file + }, + 'gatsby-plugin-sitemap', + ], +}; diff --git a/front/src/pages/404.tsx b/front/src/pages/404.tsx index 1985be8..b7eb4a1 100644 --- a/front/src/pages/404.tsx +++ b/front/src/pages/404.tsx @@ -1,16 +1,14 @@ -import React from "react" -import { Link } from "gatsby" +import React from 'react'; +import { Link } from 'gatsby'; const NotFoundPage: React.VFC = () => { return (
- -

Ez dugu orria topatu

- -
- Go home. +

Ez dugu orria topatu

+
+ Go home.
- ) -} + ); +}; -export default NotFoundPage +export default NotFoundPage; diff --git a/front/src/pages/index.tsx b/front/src/pages/index.tsx index 7d7cb70..328db0a 100644 --- a/front/src/pages/index.tsx +++ b/front/src/pages/index.tsx @@ -1,34 +1,37 @@ -import { graphql, PageProps, useStaticQuery } from "gatsby" -import React from "react" +import { graphql, PageProps, useStaticQuery } from 'gatsby'; +import React from 'react'; interface DataProps { strapiHasiera: { data: { attributes: { - deskribapena: string - izenburua: string - } - } - } - + deskribapena: string; + izenburua: string; + }; + }; + }; } const IndexPage: React.VFC> = () => { - const {strapiHasiera} = useStaticQuery(graphql` - { - strapiHasiera { - data { - attributes { - deskribapena - izenburua + const { strapiHasiera } = useStaticQuery(graphql` + { + strapiHasiera { + data { + attributes { + deskribapena + izenburua + } } } } - } - `) - return ( -

{strapiHasiera.data.attributes.izenburua}

{strapiHasiera.data.attributes.deskribapena}

- ) -} + `); -export default IndexPage + return ( +
+

{strapiHasiera.data.attributes.izenburua}

+

{strapiHasiera.data.attributes.deskribapena}

+
+ ); +}; + +export default IndexPage; diff --git a/package.json b/package.json index b9295cd..6875824 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "scripts": { "start:back": "yarn workspace back start", "develop:back": "yarn workspace back develop", - "develop:front": "yarn workspace front develop" + "develop:front": "yarn workspace front develop", + "prettier:front": "yarn prettier front --write" }, "repository": { "type": "git", @@ -27,5 +28,8 @@ "bugs": { "url": "https://github.com/labasarea/laba-webgunea/issues" }, - "homepage": "https://github.com/labasarea/laba-webgunea#readme" + "homepage": "https://github.com/labasarea/laba-webgunea#readme", + "devDependencies": { + "prettier": "^2.5.1" + } } diff --git a/yarn.lock b/yarn.lock index c01cfbf..bb50265 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11921,6 +11921,11 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= +prettier@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a" + integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg== + pretty-bytes@^5.4.1: version "5.6.0" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"