Skip to content

Commit

Permalink
feat: lint + prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Sep 11, 2021
1 parent 7ed7fec commit 6c562cb
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 72 deletions.
10 changes: 7 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ env:
browser: true
es2021: true
extends:
- "plugin:react/recommended"
- "plugin:json/recommended"
- 'plugin:react/recommended'
- 'plugin:json/recommended'
- standard
parserOptions:
ecmaFeatures:
Expand All @@ -12,4 +12,8 @@ parserOptions:
sourceType: module
plugins:
- react
rules: {}
rules:
{
'space-before-function-paren': ['error', 'never'],
'comma-dangle': ['error', 'always-multiline'],
}
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
node-version: '16'
- name: install dependencies
run: npm ci
- name: run linter
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
node-version: '16'
- name: install dependencies
run: npm ci
- name: run build
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
push: true
secrets: |
'GH_TOKEN=${{ secrets.GITHUB_TOKEN }}'
build-args: "github_token=${{ secrets.GITHUB_TOKEN }}"
build-args: 'github_token=${{ secrets.GITHUB_TOKEN }}'
tags: |
ghcr.io/eddiehubcommunity/linktree:v${{ steps.package-version.outputs.current-version}}
ghcr.io/eddiehubcommunity/linktree:latest
Expand All @@ -67,7 +67,7 @@ jobs:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- uses: Azure/[email protected]
with:
namespace: "default"
namespace: 'default'
manifests: kubernetes/deployment.yml
images: "ghcr.io/eddiehubcommunity/linktree:v${{ steps.package-version.outputs.current-version}}"
kubectl-version: "latest"
images: 'ghcr.io/eddiehubcommunity/linktree:v${{ steps.package-version.outputs.current-version}}'
kubectl-version: 'latest'
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
tasks:
- name: npm
init: npm install
init: npm install
command: npm run start

# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
Expand Down
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "all",
"semi": false,
"singleQuote": true
}
2 changes: 1 addition & 1 deletion kubernetes/ingress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: "linkfree.eddiehub.org"
- host: 'linkfree.eddiehub.org'
http:
paths:
- path: /
Expand Down
25 changes: 22 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-react": "^7.25.1"
"eslint-plugin-react": "^7.25.1",
"prettier": "2.4.0"
}
}
19 changes: 10 additions & 9 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import "primereact/resources/themes/saga-blue/theme.css";
import "primereact/resources/primereact.min.css";
import "primeicons/primeicons.css";
import "primeflex/primeflex.css";
import 'primereact/resources/themes/saga-blue/theme.css'
import 'primereact/resources/primereact.min.css'
import 'primeicons/primeicons.css'
import 'primeflex/primeflex.css'

import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import React from 'react'
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'

import Footer from "./Components/Footer";
import Socials from "./Components/Socials";
import Footer from './Components/Footer'
import Socials from './Components/Socials'

function App() {
return (
Expand All @@ -20,7 +21,7 @@ function App() {
</Switch>
<Footer />
</Router>
);
)
}

export default App;
export default App
8 changes: 4 additions & 4 deletions src/Components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from "react";
import React from 'react'

function Footer() {
return (
<div className="p-d-flex p-jc-center p-ai-center">
<p>
Contribute on{" "}
Contribute on{' '}
<a href="https://github.com/EddieHubCommunity/LinkFree">
<i className="pi pi-github" aria-hidden="true"></i>
</a>
</p>
</div>
);
)
}

export default Footer;
export default Footer
24 changes: 15 additions & 9 deletions src/Components/Links.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import React from "react";
import { Button } from "primereact/button";
import React from 'react'
import PropTypes from 'prop-types'

import { Button } from 'primereact/button'

function Links({ links }) {
const colors = {
youtube: "red",
twitter: "blue",
github: "green",
};
youtube: 'red',
twitter: 'blue',
github: 'green',
}

return (
<div className="p-d-flex p-jc-center">
<div className="p-d-flex p-flex-column" style={{ width: 70 + "%" }}>
<div className="p-d-flex p-flex-column" style={{ width: 70 + '%' }}>
{links.map((link, index) => (
<Button
className="p-p-3 p-m-2 p-button-outlined"
Expand All @@ -23,7 +25,11 @@ function Links({ links }) {
))}
</div>
</div>
);
)
}

Links.propTypes = {
links: PropTypes.object.isRequired,
}

export default Links;
export default Links
18 changes: 13 additions & 5 deletions src/Components/Profile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from "react";
import React from 'react'
import PropTypes from 'prop-types'

import { Avatar } from "primereact/avatar";
import { Badge } from "primereact/badge";
import { Avatar } from 'primereact/avatar'
import { Badge } from 'primereact/badge'

function Profile({ name, bio, avatar, total }) {
return (
Expand All @@ -21,7 +22,14 @@ function Profile({ name, bio, avatar, total }) {
<p>{bio}</p>
</div>
</div>
);
)
}

export default Profile;
Profile.propTypes = {
name: PropTypes.string.isRequired,
bio: PropTypes.string.isRequired,
avatar: PropTypes.string.isRequired,
total: PropTypes.string.number,
}

export default Profile
26 changes: 13 additions & 13 deletions src/Components/Socials.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect } from 'react'

import { useParams } from "react-router-dom";
import { useParams } from 'react-router-dom'

import Profile from "./Profile";
import Links from "./Links";
import Profile from './Profile'
import Links from './Links'

function Socials() {
const { username } = useParams();
const { username } = useParams()
const [profile, setProfile] = useState({
name: "404",
bio: "-",
name: '404',
bio: '-',
avatar:
"https://user-images.githubusercontent.com/624760/114314271-ea156a80-9af1-11eb-97ca-977be7565aa6.png",
'https://user-images.githubusercontent.com/624760/114314271-ea156a80-9af1-11eb-97ca-977be7565aa6.png',
links: [],
});
})

useEffect(() => {
fetch(`/data/${username}.json`)
.then((response) => response.json())
.then((data) => setProfile(data));
}, [username]);
.then((data) => setProfile(data))
}, [username])

return (
<div>
Expand All @@ -31,7 +31,7 @@ function Socials() {
/>
<Links links={profile.links} />
</div>
);
)
}

export default Socials;
export default Socials
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import reportWebVitals from './reportWebVitals'

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
document.getElementById('root'),
)

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
reportWebVitals()
18 changes: 9 additions & 9 deletions src/reportWebVitals.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const reportWebVitals = onPerfEntry => {
const reportWebVitals = (onPerfEntry) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
getCLS(onPerfEntry)
getFID(onPerfEntry)
getFCP(onPerfEntry)
getLCP(onPerfEntry)
getTTFB(onPerfEntry)
})
}
};
}

export default reportWebVitals;
export default reportWebVitals

0 comments on commit 6c562cb

Please sign in to comment.