Skip to content

Commit 9673546

Browse files
committed
Fix linting issues
Close #14
1 parent 3b115d7 commit 9673546

File tree

4 files changed

+40
-46
lines changed

4 files changed

+40
-46
lines changed

.eslintrc

+4-8
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,10 @@
220220
],
221221
"id-length": 0,
222222
"id-match": 0,
223-
"indent": [
224-
2,
225-
"tab",
226-
{
227-
"SwitchCase": 1,
228-
"VariableDeclarator": 1
229-
}
230-
],
223+
"indent": ["error", 4, {
224+
"SwitchCase": 1,
225+
"VariableDeclarator": 1
226+
}],
231227
"key-spacing": [
232228
2,
233229
{

server.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,46 @@ const app = express();
1515

1616
const menuData = yaml.safeLoad(fs.readFileSync(menuDataDir, 'utf8')); // eslint-disable-line no-sync
1717
const scannerHelper = {
18-
url_for: (url) => { // eslint-disable-line camelcase
19-
return url;
20-
}
18+
url_for: (url) => { // eslint-disable-line camelcase
19+
return url;
20+
}
2121
};
2222
const helpers = _.merge(handlebars.helpers, themeHelpers, scannerHelper); // combine helpers
2323
const port = process.env.PORT || 4000; // eslint-disable-line no-process-env
2424
const scannerIntro = {
25-
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
26-
title: 'Scanner'
25+
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
26+
title: 'Scanner'
2727
};
2828

2929
app.set('views', partialsDir);
3030

3131
const hbs = exphbs.create({
32-
defaultLayout: 'index',
33-
extname: '.hbs',
34-
helpers,
35-
layoutsDir,
36-
partialsDir
32+
defaultLayout: 'index',
33+
extname: '.hbs',
34+
helpers,
35+
layoutsDir,
36+
partialsDir
3737
});
3838

3939
app.engine('hbs', hbs.engine);
4040
app.set('view engine', 'hbs');
4141

4242
app.get('/scanner', (req, res) => {
43-
res.render('scan', {
44-
intro: scannerIntro,
45-
isScanner: true,
46-
menuData
47-
});
43+
res.render('scan', {
44+
intro: scannerIntro,
45+
isScanner: true,
46+
menuData
47+
});
4848
});
4949

5050
app.post('/scanner', (req, res) => {
51-
res.render('scan-result', {
52-
isScanner: true,
53-
menuData
54-
});
51+
res.render('scan-result', {
52+
isScanner: true,
53+
menuData
54+
});
5555
});
5656

5757
app.use('/', express.static(path.join(__dirname, '/public')));
5858
app.listen(port, () => {
59-
console.log(`Server listening on port ${port}.`);
59+
console.log(`Server listening on port ${port}.`);
6060
});
+13-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/* eslint-env browser */
22
/* eslint-disable no-var, prefer-template, strict, prefer-arrow-callback, object-shorthand, no-continue */
33
window.onload = function () {
4-
var toggleDocDropdown = function (e) {
5-
e.preventDefault();
6-
document.getElementById('submenu-docs').style.display = 'block';
7-
};
8-
var toggleAboutDropdown = function (e) {
9-
e.preventDefault();
10-
document.getElementById('submenu-about').style.display = 'block';
11-
};
12-
var registerEvent = function () {
13-
document.getElementById('docs').addEventListener('click', toggleDocDropdown, false);
14-
document.getElementById('about').addEventListener('click', toggleAboutDropdown, false);
15-
};
4+
var toggleDocDropdown = function (e) {
5+
e.preventDefault();
6+
document.getElementById('submenu-docs').style.display = 'block';
7+
};
8+
var toggleAboutDropdown = function (e) {
9+
e.preventDefault();
10+
document.getElementById('submenu-about').style.display = 'block';
11+
};
12+
var registerEvent = function () {
13+
document.getElementById('docs').addEventListener('click', toggleDocDropdown, false);
14+
document.getElementById('about').addEventListener('click', toggleAboutDropdown, false);
15+
};
1616

17-
registerEvent();
17+
registerEvent();
1818
};

updater.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ const addFrontMatter = async (filePath) => {
4343
content = data;
4444
}
4545

46-
const title = _.trim(content.match(/# (.*)\n\n/).pop().replace(/\(.*\)/, ''));
46+
const title = _.trim(content.match(/# (.*)\n\n/).pop()
47+
.replace(/\(.*\)/, ''));
4748

4849
const frontMatter = generateFrontMatterInfo(filePath, title);
4950

@@ -52,8 +53,6 @@ const addFrontMatter = async (filePath) => {
5253
await fs.writeFile(filePath, newData);
5354
};
5455

55-
56-
5756
// Iterate all the files in the dest folder and add frontmatter to each file
5857
klaw(directory)
5958
.on('data', (item) => {
@@ -69,6 +68,5 @@ klaw(directory)
6968

7069
await Promise.all(promises);
7170

72-
console.log('Front Matter added to each file.')
71+
console.log('Front Matter added to each file.');
7372
});
74-

0 commit comments

Comments
 (0)