chore: prettier erabiltzen du

This commit is contained in:
Aitor Urrutia
2022-01-14 20:28:45 +01:00
parent ae6e523215
commit 3d86958647
8 changed files with 98 additions and 70 deletions

3
.prettierignore Normal file
View File

@@ -0,0 +1,3 @@
front/node_modules
front/public
front/.cache

11
.prettierrc Normal file
View File

@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "avoid"
}

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
// Place your settings in this file to overwrite default and user settings.
{
"editor.formatOnSave": true,
}

View File

@@ -1,39 +1,39 @@
require("dotenv").config({ require('dotenv').config({
path: `.env`, path: `.env`,
}) });
module.exports = { module.exports = {
plugins: [ plugins: [
"gatsby-plugin-react-helmet", 'gatsby-plugin-react-helmet',
{ {
resolve: `gatsby-source-filesystem`, resolve: `gatsby-source-filesystem`,
options: { options: {
name: `images`, name: `images`,
path: `${__dirname}/src/images`, path: `${__dirname}/src/images`,
},
}, },
{ },
resolve: "gatsby-source-strapi", {
options: { resolve: 'gatsby-source-strapi',
apiURL: process.env.API_URL || "http://localhost:1337/api", options: {
singleTypes: ["hasiera"], apiURL: process.env.API_URL || 'http://localhost:1337/api',
queryLimit: 1000, singleTypes: ['hasiera'],
}, queryLimit: 1000,
}, },
"gatsby-transformer-sharp", },
"gatsby-plugin-sharp", 'gatsby-transformer-sharp',
{ 'gatsby-plugin-sharp',
resolve: `gatsby-plugin-manifest`, {
options: { resolve: `gatsby-plugin-manifest`,
name: "gatsby-starter-default", options: {
short_name: "starter", name: 'gatsby-starter-default',
start_url: "/", short_name: 'starter',
background_color: `#663399`, start_url: '/',
theme_color: `#663399`, background_color: `#663399`,
display: `minimal-ui`, theme_color: `#663399`,
icon: `src/images/favicon.png`, display: `minimal-ui`,
}, icon: `src/images/favicon.png`,
}, },
"gatsby-plugin-sitemap" },
], 'gatsby-plugin-sitemap',
} ],
};

View File

@@ -1,16 +1,14 @@
import React from "react" import React from 'react';
import { Link } from "gatsby" import { Link } from 'gatsby';
const NotFoundPage: React.VFC = () => { const NotFoundPage: React.VFC = () => {
return ( return (
<main> <main>
<h1>Ez dugu orria topatu</h1>
<h1 >Ez dugu orria topatu</h1> <br />
<Link to="/">Go home</Link>.
<br />
<Link to="/">Go home</Link>.
</main> </main>
) );
} };
export default NotFoundPage export default NotFoundPage;

View File

@@ -1,34 +1,37 @@
import { graphql, PageProps, useStaticQuery } from "gatsby" import { graphql, PageProps, useStaticQuery } from 'gatsby';
import React from "react" import React from 'react';
interface DataProps { interface DataProps {
strapiHasiera: { strapiHasiera: {
data: { data: {
attributes: { attributes: {
deskribapena: string deskribapena: string;
izenburua: string izenburua: string;
} };
} };
} };
} }
const IndexPage: React.VFC<PageProps<DataProps>> = () => { const IndexPage: React.VFC<PageProps<DataProps>> = () => {
const {strapiHasiera} = useStaticQuery<DataProps>(graphql` const { strapiHasiera } = useStaticQuery<DataProps>(graphql`
{ {
strapiHasiera { strapiHasiera {
data { data {
attributes { attributes {
deskribapena deskribapena
izenburua izenburua
}
} }
} }
} }
} `);
`)
return (
<main><h1>{strapiHasiera.data.attributes.izenburua}</h1><p>{strapiHasiera.data.attributes.deskribapena}</p></main>
)
}
export default IndexPage return (
<main>
<h1>{strapiHasiera.data.attributes.izenburua}</h1>
<p>{strapiHasiera.data.attributes.deskribapena}</p>
</main>
);
};
export default IndexPage;

View File

@@ -10,7 +10,8 @@
"scripts": { "scripts": {
"start:back": "yarn workspace back start", "start:back": "yarn workspace back start",
"develop:back": "yarn workspace back develop", "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": { "repository": {
"type": "git", "type": "git",
@@ -27,5 +28,8 @@
"bugs": { "bugs": {
"url": "https://github.com/labasarea/laba-webgunea/issues" "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"
}
} }

View File

@@ -11921,6 +11921,11 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= 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: pretty-bytes@^5.4.1:
version "5.6.0" version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"