Skip to content

Commit d5795ce

Browse files
ollelauribostromsagirk
authored andcommitted
chore: Run prettier/tslint in ci (nodejs#97)
* chore: Run prettier/tslint in ci * style: Format all files * chore: Fix prettier
1 parent a693167 commit d5795ce

20 files changed

Lines changed: 97 additions & 73 deletions

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.cache/
2+
.github/
3+
public/

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@
4242
"build": "gatsby build",
4343
"build-ci": "gatsby build --prefix-paths",
4444
"start": "gatsby develop",
45-
"format": "prettier --write '**/*.tsx'",
46-
"test": "jest"
45+
"format": "prettier --write '**/*.{ts,tsx,js}'",
46+
"format-check": "prettier --check '**/*.{ts,tsx,js}'",
47+
"jest": "jest",
48+
"test": "yarn run jest && yarn run format-check && yarn run tslint",
49+
"tslint": "tslint --project ./tsconfig.json"
4750
},
4851
"devDependencies": {
4952
"@babel/core": "^7.3.3",
@@ -57,7 +60,7 @@
5760
"husky": "^1.3.1",
5861
"identity-obj-proxy": "^3.0.0",
5962
"jest": "^24.1.0",
60-
"prettier": "^1.14.2",
63+
"prettier": "^1.16.4",
6164
"react-test-renderer": "^16.8.2",
6265
"tslint-config-prettier": "^1.15.0",
6366
"tslint-react": "^3.6.0"

src/components/article.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ const Article = ({
3030
flexWrap: 'wrap',
3131
marginTop: '5rem',
3232
alignItems: 'center',
33-
}}>
33+
}}
34+
>
3435
Contributors:
35-
{authors && authors.map(author => (
36-
author && <AuthorLink username={author} key={author}/>
37-
))}
36+
{authors &&
37+
authors.map(
38+
author => author && <AuthorLink username={author} key={author} />
39+
)}
3840
</div>
3941
<EditLink relativePath={relativePath} />
4042
<Pagination previous={previous} next={next} />

src/components/hero.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import React from 'react';
22

33
type Props = {
44
title: string;
5-
}
5+
};
66

77
const Hero = ({ title }: Props) => (
88
<div className="hero">
99
<h1>{title}</h1>
1010
<div className="diagonal-hero-bg">
1111
<div className="stars">
12-
<div className="small"/>
13-
<div className="medium"/>
14-
<div className="big"/>
15-
</div>
12+
<div className="small" />
13+
<div className="medium" />
14+
<div className="big" />
15+
</div>
1616
</div>
1717
</div>
18-
)
18+
);
1919

20-
export default Hero
20+
export default Hero;

src/components/navigation-item.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const NavigationItem = ({ isDone, isActive, slug, title, onClick }: Props) => {
1717
if (ref && isActive) {
1818
element.current = ref;
1919
}
20-
}
20+
};
2121

2222
useEffect(() => {
2323
if (element.current) {
@@ -34,7 +34,12 @@ const NavigationItem = ({ isDone, isActive, slug, title, onClick }: Props) => {
3434
}
3535

3636
return (
37-
<Link ref={handleRef} to={`/${slug}`} onClick={onClick} className={className}>
37+
<Link
38+
ref={handleRef}
39+
to={`/${slug}`}
40+
onClick={onClick}
41+
className={className}
42+
>
3843
{title}
3944
</Link>
4045
);

src/components/pagination.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PaginationInfo } from '../types';
66
type Props = {
77
previous?: PaginationInfo;
88
next?: PaginationInfo;
9-
}
9+
};
1010

1111
const ulStyles: SerializedStyles = css`
1212
display: flex;
@@ -33,6 +33,6 @@ const Pagination = ({ previous, next }: Props) => (
3333
)}
3434
</li>
3535
</ul>
36-
)
36+
);
3737

38-
export default Pagination
38+
export default Pagination;

src/components/seo.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from 'react'
2-
import { Helmet } from 'react-helmet'
3-
import config from '../config'
1+
import React from 'react';
2+
import { Helmet } from 'react-helmet';
3+
import config from '../config';
44

55
type Props = {
6-
title?: string
7-
description?: string
8-
img?: string
9-
}
6+
title?: string;
7+
description?: string;
8+
img?: string;
9+
};
1010

1111
const SEO = ({ title, description, img }: Props) => (
1212
<Helmet
@@ -93,6 +93,6 @@ const SEO = ({ title, description, img }: Props) => (
9393
>
9494
<html lang={config.lang} />
9595
</Helmet>
96-
)
96+
);
9797

98-
export default SEO
98+
export default SEO;

src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ module.exports = {
2020
twitterCard: `summary`,
2121
twitterImgAlt: `The Node.js Hexagon Logo`,
2222
facebook: `https://www.facebook.com/nodejsfoundation/`,
23-
}
23+
};

src/pages/404.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ export default (props: Props) => {
1414
return (
1515
<Layout title={title} description={description}>
1616
<Hero title={title} />
17-
<article style={{width: '100%'}} className="article-reader">
18-
<p>
19-
The page you're trying to access does not exist. Go back to the
20-
Homepage or find what you're looking for in the menu.
21-
</p>
22-
<p>
23-
Take me back to the <a href="/">Homepage</a>
24-
</p>
17+
<article style={{ width: '100%' }} className="article-reader">
18+
<p>
19+
The page you're trying to access does not exist. Go back to the
20+
Homepage or find what you're looking for in the menu.
21+
</p>
22+
<p>
23+
Take me back to the <a href="/">Homepage</a>
24+
</p>
2525
</article>
2626
</Layout>
2727
);

src/util/createSlug.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ function createSlug(title) {
22
let slug = title.toLowerCase().trim();
33

44
const sets = [
5-
{to: 'nodejs', from: /node.js/ }, // Replace node.js
6-
{to: '-and-', from: /&/ }, // Replace &
7-
{to: '-', from: /[/_,:;\\ .]/g } // Replace /_,:;\. and whitespace
5+
{ to: 'nodejs', from: /node.js/ }, // Replace node.js
6+
{ to: '-and-', from: /&/ }, // Replace &
7+
{ to: '-', from: /[/_,:;\\ .]/g }, // Replace /_,:;\. and whitespace
88
];
99

1010
sets.forEach(set => {
@@ -13,9 +13,9 @@ function createSlug(title) {
1313

1414
return slug
1515
.replace(/[^\w\-]+/g, '') // Remove any non word characters
16-
.replace(/--+/g, '-') // Replace multiple hyphens with single
17-
.replace(/^-/, '') // Remove any leading hyphen
18-
.replace(/-$/, ''); // Remove any trailing hyphen
16+
.replace(/--+/g, '-') // Replace multiple hyphens with single
17+
.replace(/^-/, '') // Remove any leading hyphen
18+
.replace(/-$/, ''); // Remove any trailing hyphen
1919
}
2020

2121
module.exports = createSlug;

0 commit comments

Comments
 (0)