Skip to content

Commit 4cf32de

Browse files
linting
1 parent f8a159b commit 4cf32de

File tree

11 files changed

+35
-34
lines changed

11 files changed

+35
-34
lines changed

.eslintrc.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const path = require('path');
1+
// const path = require('path');
22

33
module.exports = {
4-
parser: 'babel-eslint',
54
parserOptions: {
65
ecmaVersion: 2018,
7-
sourceType: 'module',
8-
babelOptions: {
9-
configFile: path.join(__dirname, './packages/cli/src/config/babel.config.js')
10-
}
6+
sourceType: 'module'
7+
// TODO should we use this?
8+
// babelOptions: {
9+
// configFile: path.join(__dirname, './packages/cli/src/config/babel.config.js')
10+
// }
1111
},
1212
env: {
1313
browser: true,

packages/cli/src/config/rollup.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function greenwoodHtmlPlugin(compilation) {
100100
// console.debug('NO MATCH?????', innerBundleId);
101101
// TODO better testing
102102
// TODO magic string
103-
if(innerBundleId.indexOf('.greenwood/') < 0 && !mappedBundles.get(innerBundleId)){
103+
if (innerBundleId.indexOf('.greenwood/') < 0 && !mappedBundles.get(innerBundleId)) {
104104
// console.debug('NEW BUNDLE TO INJECT!');
105105
newHtml = newHtml.replace(/<script type="module" src="(.*)"><\/script>/, `
106106
<script type="module" src="/${innerBundleId}"></script>
@@ -127,7 +127,7 @@ function greenwoodHtmlPlugin(compilation) {
127127

128128
module.exports = getRollupConfig = async (compilation) => {
129129

130-
const { scratchDir, outputDir } = compilation.context;;
130+
const { scratchDir, outputDir } = compilation.context;
131131

132132
return [{
133133
// TODO Avoid .greenwood/ directory, do everything in public/?

packages/cli/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ program
2929
.version(greenwoodPackageJson.version)
3030
.arguments('<script-mode>')
3131
.usage('<script-mode> [options]');
32-
// TODO .usage(`${chalk.green('<script-mode>')} [options]`);
32+
// TODO .usage(`${chalk.green('<script-mode>')} [options]`);
3333

3434
program
3535
.command('build')

packages/cli/src/lib/browser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class BrowserRunner {
3838

3939
// only allow puppeteer to load necessary scripts needed for pre-rendering of the site itself
4040
page.on('request', interceptedRequest => {
41-
const interceptedRequestUrl = interceptedRequest.url();
41+
// const interceptedRequestUrl = interceptedRequest.url();
4242

4343
// console.debug('request', interceptedRequestUrl);
4444
// TODO handle serialize only requests

packages/cli/src/lifecycles/bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ module.exports = bundleCompilation = async (compilation) => {
1616
reject(err);
1717
}
1818
});
19-
}
19+
};

packages/cli/src/lifecycles/config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ module.exports = readAndMergeConfig = async() => {
2828

2929
if (await fs.exists(path.join(process.cwd(), 'greenwood.config.js'))) {
3030
const userCfgFile = require(path.join(process.cwd(), 'greenwood.config.js'));
31-
const { workspace, devServer, optimization, publicPath, title, meta, plugins, themeFile, markdown } = userCfgFile;
31+
// TODO const { workspace, devServer, optimization, publicPath, title, meta, plugins, themeFile, markdown } = userCfgFile;
32+
const { workspace, devServer, publicPath, title, meta } = userCfgFile;
3233

3334
// workspace validation
3435
if (workspace) {

packages/cli/src/lifecycles/copy.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ const fsPromises = fs.promises;
33
const path = require('path');
44

55
async function rreaddir (dir, allFiles = []) {
6-
const files = (await fsPromises.readdir(dir)).map(f => path.join(dir, f))
6+
const files = (await fsPromises.readdir(dir)).map(f => path.join(dir, f));
77

88
allFiles.push(...files);
99

1010
await Promise.all(files.map(async f => (
11-
(await fsPromises.stat(f)).isDirectory() && rreaddir(f, allFiles)
11+
await fsPromises.stat(f)).isDirectory() && rreaddir(f, allFiles
1212
)));
1313

1414
return allFiles;
@@ -43,7 +43,7 @@ module.exports = copyAssets = (compilation) => {
4343
console.info('copying assets/ directory...');
4444
const assetPaths = await rreaddir(`${context.userWorkspace}/assets`);
4545

46-
if (assetPaths.length > 0){
46+
if (assetPaths.length > 0) {
4747
if (!fs.existsSync(`${context.outputDir}/assets`)) {
4848
fs.mkdirSync(`${context.outputDir}/assets`);
4949
}
@@ -54,15 +54,15 @@ module.exports = copyAssets = (compilation) => {
5454

5555
if (isDirectory && !fs.existsSync(target)) {
5656
fs.mkdirSync(target);
57-
} else if(!isDirectory){
57+
} else if (!isDirectory) {
5858
return asset;
5959
}
6060
}).map((asset) => {
6161
const target = asset.replace(context.userWorkspace, context.outputDir);
6262

6363
return copyFile(asset, target);
6464
}));
65-
};
65+
}
6666
}
6767

6868
// TODO should be done via rollup detection, so Greenwood will only copy files used when actually imported by the user
@@ -95,4 +95,4 @@ module.exports = copyAssets = (compilation) => {
9595
reject(err);
9696
}
9797
});
98-
}
98+
};

packages/cli/src/lifecycles/graph.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
const fs = require('fs-extra');
33
const { promises: fsp } = require('fs');
4-
const crypto = require('crypto'); // TODO pretty heavy just for some hashing?
4+
const crypto = require('crypto'); // TODO pretty heavy just for some hashing?
55
const path = require('path');
66
const fm = require('front-matter');
77
const toc = require('markdown-toc');
@@ -154,7 +154,7 @@ const createGraphFromPages = async (pagesDir, config) => {
154154
}
155155

156156
// TODO handle top level root index.html
157-
if (ishtmlFile){
157+
if (ishtmlFile) {
158158
// const { label, template, title } = attributes;
159159
// const { meta } = config;
160160

packages/cli/src/lifecycles/serialize.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ module.exports = serializeCompilation = async (compilation) => {
4343
}
4444

4545
await fsp.writeFile(path.join(outputDir, outputPath), htmlModified);
46-
});
47-
}))
46+
});
47+
}));
4848
} catch (e) {
4949
// eslint-disable-next-line no-console
5050
console.error(err);
@@ -72,4 +72,4 @@ module.exports = serializeCompilation = async (compilation) => {
7272
reject(err);
7373
}
7474
});
75-
}
75+
};

www/components/header/header.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class HeaderComponent extends LitElement {
4343
}).sort((a, b) => {
4444
return a.data.index < b.data.index ? -1 : 1;
4545
});
46-
});
46+
});
4747
}
4848

4949
/* eslint-disable indent */

www/components/shelf/shelf.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ class Shelf extends LitElement {
110110
return a.data.index < b.data.index ? -1 : 1;
111111
});
112112
});
113-
// return await client.query({
114-
// query: MenuQuery,
115-
// variables: {
116-
// name: 'side',
117-
// route: `/${this.page}/`,
118-
// order: 'index_asc'
119-
// }
120-
// });
113+
// return await client.query({
114+
// query: MenuQuery,
115+
// variables: {
116+
// name: 'side',
117+
// route: `/${this.page}/`,
118+
// order: 'index_asc'
119+
// }
120+
// });
121121
}
122122

123123
async updated(changedProperties) {
@@ -140,10 +140,10 @@ class Shelf extends LitElement {
140140
if (list && list.length > 0) {
141141
listItems = html`
142142
<ul>
143-
${list.map((item, index) => {
143+
${list.map((item) => {
144144
return html`
145145
<li class="${selected ? '' : 'hidden'}">
146-
<a @click=${() => { this.goTo(`${item.route}`) }}>${item.label}</a>
146+
<a @click=${() => { this.goTo(`${item.route}`); }}>${item.label}</a>
147147
</li>
148148
`;
149149
})}

0 commit comments

Comments
 (0)