Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zemuldo committed Dec 27, 2023
1 parent e81558e commit 16b93fe
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 39 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main_zemuldo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Zip artifact for deployment
run: zip release.zip ./* -r
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 16.10.0
5 changes: 2 additions & 3 deletions apis/routes/resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ router.post('/share', async (req, res) => {
const filePath = `/tmp/${resume.name}`;

await blobClient.downloadToFile(filePath);
await sendResume(req.body.email, filePath);
await resumeService.requested(req.body.email, resume)
await sendResume(req.body.email, filePath);
await resumeService.requested(req.body.email, resume);
res.send('Success');


} catch (error) {
console.log(error)
res.status(400).send([{ errorType: 'BAD_REQUEST', errorMessage: error.toString() }]);
}

Expand Down
4 changes: 2 additions & 2 deletions apis/routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ router.get('/auth/github', (req, res, next) => {

router.get(
'/auth/github/callback',
passport.authenticate('github', { failureRedirect: `/blog/login` }),
passport.authenticate('github', { failureRedirect: '/blog/login' }),
(req, res, next) => {
const token = jwt.sign(req.user.id);
if (req.user.username !== 'zemuldo' && req.user.username !== 'rovahrowa') {
return res.redirect(`/403`);
return res.redirect('/403');
}
req.logIn(req.user, function(err) {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion components/blog/ViewBlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { withRouter } from 'next/router';
import Closing from './closing';
import { postUrl } from '../tools';

const { STATIC_IMAGES_URL } = process.env
const { STATIC_IMAGES_URL } = process.env;

const api_url = process.env.API_URL;
const base_url = process.env.BASE_URL;
Expand Down
2 changes: 1 addition & 1 deletion components/blog/featured.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Grid from '@material-ui/core/Grid';
import PropTypes from 'prop-types';
import CustomLink from '../link';
import { format } from 'date-fns';
const { STATIC_IMAGES_URL } = process.env
const { STATIC_IMAGES_URL } = process.env;

const styles = theme => ({
greenAvatar: {
Expand Down
2 changes: 1 addition & 1 deletion components/md/image.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
const { STATIC_IMAGES_URL } = process.env
const { STATIC_IMAGES_URL } = process.env;

function Image({ src, alt }) {
const _style = { minWidth: '100%', position: 'absolute', left: '0', right: '0', zIndex: 24 };
Expand Down
2 changes: 1 addition & 1 deletion components/versionInfo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import meta from '../package.json'
import meta from '../package.json';

export default function VersionInfo() {

Expand Down
2 changes: 1 addition & 1 deletion db/mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ db.once('open', async function() {
.catch(_e=>false);

});
await posService.buildTopTags()
await posService.buildTopTags();
});

module.exports = mongoose;
10 changes: 6 additions & 4 deletions db/services/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const logger = require('../../tools/logger');
module.exports = {
get: async (params) => {
let q = {};
if (params.tag) q = {'tags.value': params.tag};
if (params.tag) q = { 'tags.value': params.tag };
return Post.find(q, [], {
skip: parseInt(params.skip, 10),
limit: parseInt(params.limit, 10),
Expand All @@ -20,7 +20,7 @@ module.exports = {
});
},
getDrafts: async (authorId) => {
return Draft.find({authorId});
return Draft.find({ authorId });
},

getDraftById: async (id) => {
Expand Down Expand Up @@ -151,9 +151,11 @@ module.exports = {
return acc;
}, {});

const final = Object.keys(flat).map(k => ({ name: k, value: flat[k] })).sort((a, b) => (a.value < b.value) ? 1 : -1).slice(0, 8);
const final = Object.keys(flat).map(k => ({ name: k, value: flat[k] }))
.sort((a, b) => (a.value < b.value) ? 1 : -1)
.slice(0, 8);
global.topTags = final;
} )
})
.catch(_ => {
logger.error('Failed to fetch posts in build top tags');
});
Expand Down
2 changes: 1 addition & 1 deletion db/services/resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
requested: async (email, resume) => {
const resumeRequest = new ResumeRequestSchema({ email, resume, timestamp: new Date() });

await resumeRequest.save()
await resumeRequest.save();

return true;
},
Expand Down
10 changes: 5 additions & 5 deletions pages/resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const ResumePage = () => {
};

const sendEmail = async () => {
setSending(true)
setSending(true);
try {
const res = await fetch(`${API_URL}/resume/share`, {
method: 'post',
Expand All @@ -143,14 +143,14 @@ const ResumePage = () => {
if (res.status === 200) {

setResumeSent(true);
setSending(false)
setSending(false);
} else {
setResumeSent(setOperationError('Something went wrong. Please try again.'))
setSending(false)
setResumeSent(setOperationError('Something went wrong. Please try again.'));
setSending(false);
}
} catch (_) {
setResumeSent(setOperationError('Something went wrong. Please try again.'));
setSending(false)
setSending(false);
}
};

Expand Down
8 changes: 4 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const cookieParser = require('cookie-parser');

require('dotenv').config();

const { STATIC_IMAGES_URL } = process.env
const { STATIC_IMAGES_URL } = process.env;

async function log_path(req) {
const _path = `Serving: ${req.originalUrl.split('?')[0]}`.slice(0, 1000);
Expand Down Expand Up @@ -65,14 +65,14 @@ router.use('/blog', express.static('static'));
router.use('/site-stories', express.static(path.join(__dirname, 'public')));
// Backward compatibility for old images url.
router.use('/z-site-images', (req, res) => {
const filePath = `/tmp/${req.url.replace('/', '')}`
const filePath = `/tmp/${req.url.replace('/', '')}`;
const file = fs.createWriteStream(filePath);
https.get(`${STATIC_IMAGES_URL}${req.url}`, function (response) {
response.pipe(file);

file.on("finish", () => {
file.on('finish', () => {
file.close();
return res.sendFile(filePath)
return res.sendFile(filePath);
});
});

Expand Down
36 changes: 22 additions & 14 deletions test/__snapshots__/storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2886,7 +2886,7 @@ exports[`Storyshots Home Page Footer 1`] = `
Zemuldo
</a>
,
2021
2023
<span>
,
<a
Expand All @@ -2904,6 +2904,14 @@ exports[`Storyshots Home Page Footer 1`] = `
>
Terms
</a>
,
<a
href="/attributions"
rel="noopener noreferrer"
target="_blank"
>
Attributions
</a>
</span>
</p>
</div>
Expand Down Expand Up @@ -3871,12 +3879,14 @@ exports[`Storyshots Home Page TerminalMe 1`] = `
"MsTransition": "all .5s ease-out",
"OTransition": "all .5s ease-out",
"WebkitTransition": "all .5s ease-out",
"borderRadius": "10px",
"borderRadius": "7px",
"clear": "both",
"display": "block",
"marginTop": "20px",
"maxWidth": "900px",
"minHeight": "200px",
"overflow": "hidden",
"padding": "10px",
"transition": "all .5s ease-out",
}
}
Expand All @@ -3888,16 +3898,14 @@ exports[`Storyshots Home Page TerminalMe 1`] = `
"MsTransition": "all .5s ease-out",
"OTransition": "all .5s ease-out",
"WebkitTransition": "all .5s ease-out",
"color": "#f0f0f0",
"fontFamily": "Consolas, \\"Courier New\\", Courier",
"fontSize": "1.2em",
"fontWeight": "500",
"fontSize": "1.0em",
"fontWeight": "600",
"height": "auto",
"lineHeight": "1.4em",
"overflow": "hidden",
"padding": "4px",
"textAlign": "left",
"textShadow": "#000 0 1px 0",
"transition": "all .5s ease-out",
}
}
Expand Down Expand Up @@ -3994,7 +4002,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
NodeJS
NodeJS
</span>
<span
className="separator"
Expand All @@ -4012,7 +4020,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
ReactJS
ReactJS
</span>
<span
className="separator"
Expand All @@ -4030,7 +4038,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
Docker
Docker
</span>
<span
className="separator"
Expand All @@ -4048,7 +4056,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
MongoDB
MongoDB
</span>
<span
className="separator"
Expand All @@ -4066,7 +4074,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
RethinkDB
RethinkDB
</span>
<span
className="separator"
Expand All @@ -4084,7 +4092,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
Kubernetes
Kubernetes
</span>
<span
className="separator"
Expand All @@ -4102,7 +4110,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
Google Cloud
Google Cloud
</span>
<span
className="separator"
Expand All @@ -4120,7 +4128,7 @@ exports[`Storyshots Journey Experience 1`] = `
<span
className="color-6"
>
AWS Cloud
AWS Cloud
</span>
<span
className="separator"
Expand Down

0 comments on commit 16b93fe

Please sign in to comment.