Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Fix lint staged (#364)
Browse files Browse the repository at this point in the history
* Lint-staged to run pre-commit scripts on staged files only
  • Loading branch information
vinay-thallam committed Mar 30, 2020
1 parent 49df719 commit e0fd6a8
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/coverage
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@
},
"husky": {
"hooks": {
"pre-commit": "npm run eslint && npm run format && npm run scsslint"
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.+(js|jsx)": [
"eslint --fix",
"git add"
"eslint --fix --max-warnings=0",
"prettier --write"
],
"*.+(json|css|md)": [
"prettier --write",
"git add"
"*.+(json|yml|yaml|md|vue)": [
"prettier --write"
],
"*.+(css|scss)": [
"sass-lint-auto-fix"
]
},
"devDependencies": {
Expand Down
68 changes: 37 additions & 31 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,53 @@ const history = require('history').createBrowserHistory;

function App() {
// Add a new page simply by adding a new entry in this array.
const pages = [{
pageLink: '/',
view: Home,
displayName: 'Home',
animationDelayForNavbar: 0.2,
}, {
pageLink: '/clusters',
view: Cluster,
displayName: 'Clusters',
animationDelayForNavbar: 0.3,
}, {
pageLink: '/links',
view: Links,
displayName: 'Helpful Links',
animationDelayForNavbar: 0.4,
}, {
pageLink: '/faq',
view: FAQ,
displayName: 'FAQ',
animationDelayForNavbar: 0.4,
}];
const pages = [
{
pageLink: '/',
view: Home,
displayName: 'Home',
animationDelayForNavbar: 0.2,
},
{
pageLink: '/clusters',
view: Cluster,
displayName: 'Clusters',
animationDelayForNavbar: 0.3,
},
{
pageLink: '/links',
view: Links,
displayName: 'Helpful Links',
animationDelayForNavbar: 0.4,
},
{
pageLink: '/faq',
view: FAQ,
displayName: 'FAQ',
animationDelayForNavbar: 0.4,
},
];

return (
<div className="App">
<Router history={history}>
<Route
render={({location}) => (
<div className="Almighty-Router">
<Navbar pages={pages}/>
<Navbar pages={pages} />
<Banner />
<Route exact path="/" render={() => <Redirect to="/" />} />
<Switch location={location}>
{
pages.map((page, i) => {
return (
<Route exact path={page.pageLink}
component={page.view}
key={i} />
);
})
}
{pages.map((page, i) => {
return (
<Route
exact
path={page.pageLink}
component={page.view}
key={i}
/>
);
})}
</Switch>
</div>
)}
Expand Down
27 changes: 12 additions & 15 deletions src/components/navbar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useState} from 'react';
import React from 'react';
import {Link} from 'react-router-dom';

function Navbar(props) {
Expand Down Expand Up @@ -32,21 +32,18 @@ function Navbar(props) {
}}
/>

<div className='navbar-left'>
{
props.pages.map((page, i) => {
return (
<Link
to={page.pageLink}
key={i}
<div className="navbar-left">
{props.pages.map((page, i) => {
return (
<Link to={page.pageLink} key={i}>
<span
{...navLinkProps(page.pageLink, page.animationDelayForNavbar)}
>
<span {...navLinkProps(page.pageLink, page.animationDelayForNavbar)}>
{page.displayName}
</span>
</Link>
);
})
}
{page.displayName}
</span>
</Link>
);
})}
</div>

<div className="navbar-right"></div>
Expand Down

1 comment on commit e0fd6a8

@vercel
Copy link

@vercel vercel bot commented on e0fd6a8 Mar 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.