From 04c3eaf0f91d5dcd139ec035f48548dcaea1f000 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Wed, 28 Jun 2023 21:20:24 -0400 Subject: [PATCH] add ESLint rules for whitespace linting (#1119) --- .eslintrc.cjs | 6 +- packages/cli/src/commands/build.js | 10 +-- packages/cli/src/commands/develop.js | 4 +- packages/cli/src/commands/eject.js | 4 +- packages/cli/src/config/rollup.config.js | 2 +- packages/cli/src/index.js | 2 +- packages/cli/src/lib/node-modules-utils.js | 2 +- packages/cli/src/lib/server-interface.js | 4 +- packages/cli/src/lib/walker-package-ranger.js | 16 ++-- packages/cli/src/lifecycles/bundle.js | 2 +- packages/cli/src/lifecycles/context.js | 2 +- packages/cli/src/lifecycles/graph.js | 12 +-- packages/cli/src/lifecycles/prerender.js | 2 +- packages/cli/src/lifecycles/serve.js | 8 +- packages/cli/src/loader.js | 2 +- .../src/plugins/resource/plugin-api-routes.js | 2 +- .../src/plugins/resource/plugin-dev-proxy.js | 2 +- .../plugins/resource/plugin-node-modules.js | 6 +- .../plugins/resource/plugin-source-maps.js | 2 +- .../plugins/resource/plugin-standard-audio.js | 2 +- .../plugins/resource/plugin-standard-font.js | 2 +- .../plugins/resource/plugin-standard-image.js | 2 +- .../resource/plugin-standard-javascript.js | 2 +- .../plugins/resource/plugin-standard-json.js | 2 +- .../plugins/resource/plugin-standard-video.js | 4 +- .../plugins/resource/plugin-static-router.js | 4 +- .../plugins/resource/plugin-user-workspace.js | 4 +- .../src/plugins/server/plugin-livereload.js | 6 +- .../build.config.default.spec.js | 4 +- ...ild.config.interpolate-frontmatter.spec.js | 2 +- .../build.config.markdown-custom.spec.js | 6 +- ...ld.config.markdown-custom.settings.spec.js | 2 +- .../build.config-optimization-default.spec.js | 4 +- .../build.config-optimization-inline.spec.js | 14 ++-- .../build.config-optimization-none.spec.js | 8 +- ...uild.config-optimization-overrides.spec.js | 12 +-- .../src/components/footer.js | 2 +- .../src/components/header.js | 2 +- .../build.config-optimization-static.spec.js | 4 +- .../build.config.pages-directory.spec.js | 4 +- .../build.config.prerender.spec.js | 6 +- .../src/pages/artists.js | 2 +- .../build.config.templates-directory.spec.js | 4 +- .../build.default.import-node-modules.spec.js | 66 ++++++++-------- .../build.default.markdown.spec.js | 12 +-- .../build.default.meta-files.spec.js | 4 +- .../build.default.quick-start-npx.spec.js | 10 +-- .../build.default.spa.spec.js | 34 ++++---- .../src/components/footer.js | 2 +- .../src/components/footer.js | 2 +- .../build.default.ssr-static-export.spec.js | 34 ++++---- .../src/components/counter.js | 4 +- .../src/components/footer.js | 2 +- .../src/pages/artists.js | 2 +- .../build.default.title.spec.js | 4 +- ...ild.default.workspace-404-markdown.spec.js | 14 ++-- .../src/scripts/header.js | 2 +- .../build.default.workspace-404.spec.js | 14 ++-- .../src/scripts/header.js | 2 +- ...ault.workspace-frontmatter-imports.spec.js | 16 ++-- .../src/components/counter/counter.js | 2 +- .../components/multi-hyphen/multi-hyphen.js | 2 +- ....default.workspace-getting-started.spec.js | 58 +++++++------- ...lt.workspace-javascript-css-remote.spec.js | 14 ++-- ...d.default.workspace-javascript-css.spec.js | 10 +-- .../build.default.workspace-nested.spec.js | 6 +- ...rkspace-template-page-bare-merging.spec.js | 14 ++-- ...ld.default.workspace-template-page.spec.js | 18 ++--- ....default.workspace-templates-empty.spec.js | 4 +- .../src/components/footer.js | 2 +- .../src/components/greeting.js | 2 +- .../src/components/header.js | 2 +- ....default.workspace-top-level-pages.spec.js | 2 +- .../cases/build.default/build.default.spec.js | 8 +- .../fixtures/components/greeting.js | 2 +- .../theme-pack-context-plugin.js | 2 +- .../greenwood.config.js | 4 +- .../greenwood.config.js | 4 +- .../greenwood.config.js | 4 +- .../build.config.plugins-resource.spec.js | 2 +- .../greenwood.config.js | 2 +- .../build.plugins-source.spec.js | 24 +++--- .../develop.default.hud-disabled.spec.js | 2 +- .../develop.default.hud.spec.js | 2 +- .../develop.default/develop.default.spec.js | 8 +- .../develop.plugins.context.spec.js | 2 +- .../fixtures/components/greeting.js | 2 +- .../cases/develop.spa/develop.spa.spec.js | 8 +- .../cases/develop.ssr/develop.ssr.spec.js | 30 +++---- .../develop.ssr/src/components/counter.js | 4 +- .../develop.ssr/src/components/footer.js | 2 +- .../cases/develop.ssr/src/pages/artists.js | 2 +- .../serve.config.static-router.spec.js | 12 +-- .../src/pages/artists.js | 2 +- .../serve.default.api.spec.js | 6 +- ...e.default.ssr-prerender-api-hybrid.spec.js | 4 +- .../src/components/footer.js | 2 +- .../serve.default.ssr-prerender.spec.js | 4 +- .../src/components/footer.js | 2 +- .../serve.default.ssr-static-export.spec.js | 34 ++++---- .../src/components/counter.js | 4 +- .../src/components/footer.js | 2 +- .../src/pages/artists.js | 2 +- .../serve.default.ssr.spec.js | 2 +- .../src/components/counter.js | 4 +- .../cases/serve.default/serve.default.spec.js | 2 +- .../test/cases/serve.spa/serve.spa.spec.js | 8 +- .../test/cases/theme-pack/greenwood.config.js | 2 +- .../cases/theme-pack/src/components/header.js | 2 +- .../cases/theme-pack/theme-pack.build.spec.js | 9 +-- .../theme-pack/theme-pack.develop.spec.js | 11 ++- packages/init/src/copy-folder.js | 2 +- packages/init/src/index.js | 18 ++--- .../cases/build.default/build.default.spec.js | 4 +- .../develop.default/develop.default.spec.js | 8 +- .../cases/init.default/init.default.spec.js | 6 +- .../cases/init.template/init.template.spec.js | 4 +- .../test/cases/init.yarn/init.yarn.spec.js | 4 +- packages/plugin-babel/src/index.js | 10 +-- .../test/cases/default/default.spec.js | 6 +- .../options.extend-config.spec.js | 8 +- packages/plugin-google-analytics/src/index.js | 2 +- packages/plugin-graphql/src/core/cache.js | 2 +- packages/plugin-graphql/src/core/client.js | 2 +- packages/plugin-graphql/src/core/server.js | 2 +- packages/plugin-graphql/src/index.js | 4 +- packages/plugin-graphql/src/schema/schema.js | 10 +-- .../cases/develop.default/greenwood.config.js | 2 +- .../qraphql-server/graphql-server.spec.js | 2 +- .../cases/qraphql-server/greenwood.config.js | 2 +- .../query-children/query-children.spec.js | 42 +++++----- .../cases/query-config/query-config.spec.js | 8 +- .../query-config/src/components/footer.js | 2 +- .../query-custom-frontmatter.spec.js | 42 +++++----- .../query-custom-schema.spec.js | 8 +- .../cases/query-graph/query-graph.spec.js | 38 ++++----- .../test/cases/query-menu/query-menu.spec.js | 42 +++++----- .../plugin-graphql/test/unit/common.spec.js | 2 +- .../plugin-graphql/test/unit/mocks/config.js | 2 +- .../test/unit/schema/config.spec.js | 2 +- packages/plugin-import-commonjs/src/index.js | 6 +- .../test/cases/default/default.spec.js | 8 +- packages/plugin-import-css/src/index.js | 4 +- .../test/cases/default/default.spec.js | 2 +- .../exp-build.prerender.spec.js | 2 +- packages/plugin-import-json/src/index.js | 2 +- .../test/cases/default/default.spec.js | 4 +- .../develop.default/develop.default.spec.js | 2 +- .../cases/develop.default/greenwood.config.js | 2 +- .../exp-build.prerender.spec.js | 2 +- packages/plugin-import-jsx/src/index.js | 2 +- .../cases/default/default.prerender.spec.js | 2 +- .../exp-build.prerender.spec.js | 2 +- .../build.default.custom-element.spec.js | 6 +- .../build.default.link-tag.spec.js | 6 +- .../test/cases/default/default.spec.js | 2 +- packages/plugin-postcss/src/index.js | 2 +- .../test/cases/default/default.spec.js | 2 +- .../options.extend-config.spec.js | 4 +- .../build.prerender.getting-started.spec.js | 10 +-- .../cases/serve.default/serve.default.spec.js | 34 ++++---- .../serve.default/src/components/footer.js | 2 +- .../cases/serve.default/src/pages/artists.js | 2 +- .../src/lib/browser.js | 2 +- .../src/plugins/server.js | 2 +- .../src/puppeteer-handler.js | 2 +- .../cases/build.default/build.default.spec.js | 78 +++++++++---------- .../test/cases/default/default.spec.js | 8 +- .../test/cases/default/greenwood.config.js | 2 +- .../cases/develop.default/greenwood.config.js | 2 +- .../options.extend-config/greenwood.config.js | 2 +- .../options.extend-config.spec.js | 6 +- test/smoke-test.js | 4 +- test/utils.js | 2 +- www/components/card/card.js | 2 +- www/components/header/header.js | 2 +- www/components/shelf/shelf.js | 2 +- www/components/social-icons/social-icons.js | 2 +- www/pages/blog/release/v0-28-0.md | 2 +- www/pages/plugins/resource.md | 6 +- 180 files changed, 651 insertions(+), 653 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index eb83912e2..0c06c5089 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -99,7 +99,7 @@ module.exports = { 'no-unused-expressions': 0, 'no-useless-call': 0, 'no-void': 0, - 'no-warning-comments': [1, { + 'no-warning-comments': [1, { 'terms': [ 'todo', ' fixme', @@ -142,7 +142,7 @@ module.exports = { 'comma-style': [2, 'last'], 'computed-property-spacing': 0, 'consistent-this': [0, 'self', 'that'], - 'eol-last': 0, + 'eol-last': [2, 'never'], 'func-names': 0, 'func-style': 0, 'id-length': 0, @@ -172,7 +172,7 @@ module.exports = { 'no-new-object': 2, 'no-spaced-func': 2, 'no-ternary': 0, - 'no-trailing-spaces': 0, + 'no-trailing-spaces': 2, 'no-underscore-dangle': [2, { 'allowAfterThis': true }], 'no-unneeded-ternary': 2, 'object-curly-spacing': [2, 'always', {}], diff --git a/packages/cli/src/commands/build.js b/packages/cli/src/commands/build.js index 1dbd30a61..1d4502195 100644 --- a/packages/cli/src/commands/build.js +++ b/packages/cli/src/commands/build.js @@ -84,17 +84,17 @@ const runProductionBuild = async (compilation) => { return plugin.type === 'server'; }).map((plugin) => { const provider = plugin.provider(compilation); - + if (!(provider instanceof ServerInterface)) { console.warn(`WARNING: ${plugin.name}'s provider is not an instance of ServerInterface.`); } - + return provider; })]; - + await Promise.all(servers.map(async (server) => { await server.start(); - + return Promise.resolve(server); })); @@ -119,7 +119,7 @@ const runProductionBuild = async (compilation) => { reject(err); } }); - + }; export { runProductionBuild }; \ No newline at end of file diff --git a/packages/cli/src/commands/develop.js b/packages/cli/src/commands/develop.js index 1d5183f72..a5ea59a5c 100644 --- a/packages/cli/src/commands/develop.js +++ b/packages/cli/src/commands/develop.js @@ -7,9 +7,9 @@ const runDevServer = async (compilation) => { try { const { port } = compilation.config.devServer; - + (await getDevServer(compilation)).listen(port, () => { - + console.info(`Started local development server at localhost:${port}`); const servers = [...compilation.config.plugins.filter((plugin) => { diff --git a/packages/cli/src/commands/eject.js b/packages/cli/src/commands/eject.js index 886b74e2a..9786331c0 100644 --- a/packages/cli/src/commands/eject.js +++ b/packages/cli/src/commands/eject.js @@ -5,13 +5,13 @@ const ejectConfiguration = async (compilation) => { try { const configFileDirUrl = new URL('../config/', import.meta.url); const configFiles = await fs.readdir(configFileDirUrl); - + for (const file of configFiles) { const from = new URL(`./${file}`, configFileDirUrl); const to = new URL(`./${file}`, compilation.context.projectDirectory); await fs.copyFile(from, to); - + console.log(`Ejected ${file} successfully.`); } diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 8c3642aa1..f3d0ebd4f 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -144,7 +144,7 @@ const getRollupConfigForScriptResources = async (compilation) => { return [{ preserveEntrySignatures: 'strict', // https://github.com/ProjectEvergreen/greenwood/pull/990 input, - output: { + output: { dir: normalizePathnameForWindows(outputDir), entryFileNames: '[name].[hash].js', chunkFileNames: '[name].[hash].js', diff --git a/packages/cli/src/index.js b/packages/cli/src/index.js index e09962e61..22fc77cc0 100755 --- a/packages/cli/src/index.js +++ b/packages/cli/src/index.js @@ -79,7 +79,7 @@ const run = async() => { await (await import('./commands/eject.js')).ejectConfiguration(compilation); break; - default: + default: console.warn(` Error: not able to detect command. try using the --help flag if you're encountering issues running Greenwood. Visit our docs for more diff --git a/packages/cli/src/lib/node-modules-utils.js b/packages/cli/src/lib/node-modules-utils.js index 688d00686..eb5be2ecc 100644 --- a/packages/cli/src/lib/node-modules-utils.js +++ b/packages/cli/src/lib/node-modules-utils.js @@ -8,7 +8,7 @@ import fs from 'fs/promises'; // and return the root absolute location async function getNodeModulesLocationForPackage(packageName) { let nodeModulesUrl; - + try { const packageEntryLocation = (await import.meta.resolve(packageName)).replace(/\\/g, '/'); // force / for consistency and path matching diff --git a/packages/cli/src/lib/server-interface.js b/packages/cli/src/lib/server-interface.js index f7aeb855b..c7c90a85e 100644 --- a/packages/cli/src/lib/server-interface.js +++ b/packages/cli/src/lib/server-interface.js @@ -3,11 +3,11 @@ class ServerInterface { this.compilation = compilation; this.options = options; } - + async start() { return Promise.resolve(true); } - + async stop() { return Promise.resolve(true); } diff --git a/packages/cli/src/lib/walker-package-ranger.js b/packages/cli/src/lib/walker-package-ranger.js index 320ba5d6f..5ce30c114 100644 --- a/packages/cli/src/lib/walker-package-ranger.js +++ b/packages/cli/src/lib/walker-package-ranger.js @@ -60,7 +60,7 @@ async function walkModule(modulePath, dependency) { if (!importMap[sourceValue]) { updateImportMap(sourceValue, `/node_modules/${sourceValue}`); } - + await walkPackageJson(path.join(absoluteNodeModulesLocation, 'package.json')); } else if (isBarePath) { updateImportMap(sourceValue, `/node_modules/${sourceValue}`); @@ -128,18 +128,18 @@ async function walkPackageJson(packageJson = {}) { if (Array.isArray(entry)) { // we have an exportMap const exportMap = entry; - + for (const entry of exportMap) { const exportMapEntry = dependencyPackageJson.exports[entry]; let packageExport; - + if (Array.isArray(exportMapEntry)) { let fallbackPath; let esmPath; - + exportMapEntry.forEach((mapItem) => { switch (typeof mapItem) { - + case 'string': fallbackPath = mapItem; break; @@ -159,10 +159,10 @@ async function walkPackageJson(packageJson = {}) { default: console.warn(`Sorry, we were unable to detect the module type for ${mapItem} :(. please consider opening an issue to let us know about your use case.`); break; - + } }); - + packageExport = esmPath ? esmPath : fallbackPath; @@ -170,7 +170,7 @@ async function walkPackageJson(packageJson = {}) { packageExport = exportMapEntry.import ? exportMapEntry.import : exportMapEntry.default; - + // use the dependency itself as an entry in the importMap if (entry === '.') { updateImportMap(dependency, `/node_modules/${path.join(dependency, packageExport)}`); diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index 3ad6bf00d..974619223 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -91,7 +91,7 @@ async function bundleStyleResources(compilation, resourcePlugins) { if (src) { const basename = path.basename(srcPath); const basenamePieces = path.basename(srcPath).split('.'); - const fileNamePieces = srcPath.split('/').filter(piece => piece !== ''); // normalize by removing any leading /'s + const fileNamePieces = srcPath.split('/').filter(piece => piece !== ''); // normalize by removing any leading /'s optimizedFileName = srcPath.indexOf('/node_modules') >= 0 ? `${basenamePieces[0]}.${hashString(contents)}.css` diff --git a/packages/cli/src/lifecycles/context.js b/packages/cli/src/lifecycles/context.js index 05d52c511..d49ae226b 100644 --- a/packages/cli/src/lifecycles/context.js +++ b/packages/cli/src/lifecycles/context.js @@ -34,7 +34,7 @@ const initContext = async({ config }) => { recursive: true }); } - + resolve(context); } catch (err) { console.log(err); diff --git a/packages/cli/src/lifecycles/graph.js b/packages/cli/src/lifecycles/graph.js index e70c46e6a..8c66ab3ae 100644 --- a/packages/cli/src/lifecycles/graph.js +++ b/packages/cli/src/lifecycles/graph.js @@ -34,7 +34,7 @@ const generateGraph = async (compilation) => { if (isDirectory) { pages = await walkDirectoryForPages(filenameUrlAsDir, pages); } else { - const extension = `.${filenameUrl.pathname.split('.').pop()}`; + const extension = `.${filenameUrl.pathname.split('.').pop()}`; const isStatic = extension === '.md' || extension === '.html'; const isDynamic = extension === '.js'; const relativePagePath = filenameUrl.pathname.replace(pagesDir.pathname, '/'); @@ -69,7 +69,7 @@ const generateGraph = async (compilation) => { if (isStatic) { const fileContents = await fs.readFile(filenameUrl, 'utf8'); const { attributes } = fm(fileContents); - + template = attributes.template || 'page'; title = attributes.title || title; id = attributes.label || id; @@ -120,7 +120,7 @@ const generateGraph = async (compilation) => { let ssrFrontmatter; filePath = route; - + await new Promise((resolve, reject) => { const worker = new Worker(routeWorkerUrl); @@ -144,13 +144,13 @@ const generateGraph = async (compilation) => { route }); }); - + if (ssrFrontmatter) { template = ssrFrontmatter.template || template; title = ssrFrontmatter.title || title; imports = ssrFrontmatter.imports || imports; customData = ssrFrontmatter.data || customData; - + /* Menu Query * Custom front matter - Variable Definitions * -------------------------------------------------- @@ -161,7 +161,7 @@ const generateGraph = async (compilation) => { */ customData.menu = ssrFrontmatter.menu || ''; customData.index = ssrFrontmatter.index || ''; - } + } } else { console.debug(`Unhandled extension (.${extension}) for route => ${route}`); } diff --git a/packages/cli/src/lifecycles/prerender.js b/packages/cli/src/lifecycles/prerender.js index 6e13b95b1..48f8e8fdd 100644 --- a/packages/cli/src/lifecycles/prerender.js +++ b/packages/cli/src/lifecycles/prerender.js @@ -131,7 +131,7 @@ async function staticRenderCompilation(compilation) { const plugins = getPluginInstances(compilation); console.info('pages to generate', `\n ${pages.map(page => page.route).join('\n ')}`); - + await Promise.all(pages.map(async (page) => { const { route, outputPath } = page; const outputDirUrl = new URL(`.${route}`, scratchDir); diff --git a/packages/cli/src/lifecycles/serve.js b/packages/cli/src/lifecycles/serve.js index e0cc4f7a7..ea8991f2f 100644 --- a/packages/cli/src/lifecycles/serve.js +++ b/packages/cli/src/lifecycles/serve.js @@ -125,7 +125,7 @@ async function getDevServer(compilation) { ctx.status = 500; console.error(e); } - + await next(); }); @@ -159,7 +159,7 @@ async function getDevServer(compilation) { ctx.status = ctx.status; ctx.set('Content-Type', ctx.response.header['content-type']); ctx.set('Etag', etagHash); - + // TODO automatically loop and apply all custom headers to Koa response, include Content-Type below // https://github.com/ProjectEvergreen/greenwood/issues/1048 if (response.headers.has('Content-Length')) { @@ -280,7 +280,7 @@ async function getStaticServer(compilation, composable) { await next(); } }); - + return app; } @@ -326,7 +326,7 @@ async function getHybridServer(compilation) { return app; } -export { +export { getDevServer, getStaticServer, getHybridServer diff --git a/packages/cli/src/loader.js b/packages/cli/src/loader.js index a282dfff4..7955b2484 100644 --- a/packages/cli/src/loader.js +++ b/packages/cli/src/loader.js @@ -20,7 +20,7 @@ async function getCustomLoaderResponse(url, body = '', checkOnly = false) { for (const plugin of resourcePlugins) { if (plugin.shouldServe && await plugin.shouldServe(url, request)) { shouldHandle = true; - + if (!checkOnly) { response = await plugin.serve(url, request); } diff --git a/packages/cli/src/plugins/resource/plugin-api-routes.js b/packages/cli/src/plugins/resource/plugin-api-routes.js index 6de913772..66eef9d27 100644 --- a/packages/cli/src/plugins/resource/plugin-api-routes.js +++ b/packages/cli/src/plugins/resource/plugin-api-routes.js @@ -1,5 +1,5 @@ /* - * + * * Manages routing to API routes. * */ diff --git a/packages/cli/src/plugins/resource/plugin-dev-proxy.js b/packages/cli/src/plugins/resource/plugin-dev-proxy.js index b45a40873..a85b1d5c9 100644 --- a/packages/cli/src/plugins/resource/plugin-dev-proxy.js +++ b/packages/cli/src/plugins/resource/plugin-dev-proxy.js @@ -1,5 +1,5 @@ /* - * + * * Manages routing devServer.proxy entries to their destination. * */ diff --git a/packages/cli/src/plugins/resource/plugin-node-modules.js b/packages/cli/src/plugins/resource/plugin-node-modules.js index cc3d673c8..b12dd3fe0 100644 --- a/packages/cli/src/plugins/resource/plugin-node-modules.js +++ b/packages/cli/src/plugins/resource/plugin-node-modules.js @@ -1,5 +1,5 @@ /* - * + * * Detects and fully resolves requests to node_modules and handles creating an importMap. * */ @@ -81,7 +81,7 @@ class NodeModulesResource extends ResourceInterface { } const userPackageJson = await getPackageJson(context); - + // if there are dependencies and we haven't generated the importMap already // walk the project's package.json for all its direct dependencies // for each entry found in dependencies, find its entry point @@ -118,7 +118,7 @@ const greenwoodPluginNodeModules = [{ replace({ // https://github.com/ProjectEvergreen/greenwood/issues/582 'preventAssignment': true, - + // https://github.com/rollup/rollup/issues/487#issuecomment-177596512 'process.env.NODE_ENV': JSON.stringify('production') }), diff --git a/packages/cli/src/plugins/resource/plugin-source-maps.js b/packages/cli/src/plugins/resource/plugin-source-maps.js index 320915bdd..f9bf3abcc 100644 --- a/packages/cli/src/plugins/resource/plugin-source-maps.js +++ b/packages/cli/src/plugins/resource/plugin-source-maps.js @@ -1,5 +1,5 @@ /* - * + * * Detects and fully resolve requests to source map (.map) files. * */ diff --git a/packages/cli/src/plugins/resource/plugin-standard-audio.js b/packages/cli/src/plugins/resource/plugin-standard-audio.js index 7b1b3e7a3..234415020 100644 --- a/packages/cli/src/plugins/resource/plugin-standard-audio.js +++ b/packages/cli/src/plugins/resource/plugin-standard-audio.js @@ -1,5 +1,5 @@ /* - * + * * Manages web standard resource related operations for audio formats. * This is a Greenwood default plugin. * diff --git a/packages/cli/src/plugins/resource/plugin-standard-font.js b/packages/cli/src/plugins/resource/plugin-standard-font.js index 41b609aaf..23c319150 100644 --- a/packages/cli/src/plugins/resource/plugin-standard-font.js +++ b/packages/cli/src/plugins/resource/plugin-standard-font.js @@ -1,5 +1,5 @@ /* - * + * * Manages web standard resource related operations for fonts. * This is a Greenwood default plugin. * diff --git a/packages/cli/src/plugins/resource/plugin-standard-image.js b/packages/cli/src/plugins/resource/plugin-standard-image.js index 20997351e..b2d6c68f8 100644 --- a/packages/cli/src/plugins/resource/plugin-standard-image.js +++ b/packages/cli/src/plugins/resource/plugin-standard-image.js @@ -1,5 +1,5 @@ /* - * + * * Manages web standard resource related operations for image formats. * This is a Greenwood default plugin. * diff --git a/packages/cli/src/plugins/resource/plugin-standard-javascript.js b/packages/cli/src/plugins/resource/plugin-standard-javascript.js index 987ac8b37..820899a4e 100644 --- a/packages/cli/src/plugins/resource/plugin-standard-javascript.js +++ b/packages/cli/src/plugins/resource/plugin-standard-javascript.js @@ -1,5 +1,5 @@ /* - * + * * Manages web standard resource related operations for JavaScript. * This is a Greenwood default plugin. * diff --git a/packages/cli/src/plugins/resource/plugin-standard-json.js b/packages/cli/src/plugins/resource/plugin-standard-json.js index f525f8f08..ee29ae8be 100644 --- a/packages/cli/src/plugins/resource/plugin-standard-json.js +++ b/packages/cli/src/plugins/resource/plugin-standard-json.js @@ -1,5 +1,5 @@ /* - * + * * Manages web standard resource related operations for JSON. * This is a Greenwood default plugin. * diff --git a/packages/cli/src/plugins/resource/plugin-standard-video.js b/packages/cli/src/plugins/resource/plugin-standard-video.js index 7843907f4..5e5569916 100644 --- a/packages/cli/src/plugins/resource/plugin-standard-video.js +++ b/packages/cli/src/plugins/resource/plugin-standard-video.js @@ -1,5 +1,5 @@ /* - * + * * Manages web standard resource related operations for video formats. * This is a Greenwood default plugin. * @@ -34,7 +34,7 @@ class StandardVideoResource extends ResourceInterface { break; case 'avi': contentType = 'video/x-msvideo'; - break; + break; case 'flv': contentType = 'video/x-flv'; break; diff --git a/packages/cli/src/plugins/resource/plugin-static-router.js b/packages/cli/src/plugins/resource/plugin-static-router.js index f68e320a1..48af82277 100644 --- a/packages/cli/src/plugins/resource/plugin-static-router.js +++ b/packages/cli/src/plugins/resource/plugin-static-router.js @@ -1,6 +1,6 @@ /* * - * + * * Manages SPA like client side routing for static pages. * This is a Greenwood default plugin. * @@ -23,7 +23,7 @@ class StaticRouterResource extends ResourceInterface { async resolve() { const routerUrl = new URL('../../lib/router.js', import.meta.url); - + return new Request(`file://${routerUrl.pathname}`); } diff --git a/packages/cli/src/plugins/resource/plugin-user-workspace.js b/packages/cli/src/plugins/resource/plugin-user-workspace.js index cb67c6041..38fb6561f 100644 --- a/packages/cli/src/plugins/resource/plugin-user-workspace.js +++ b/packages/cli/src/plugins/resource/plugin-user-workspace.js @@ -1,6 +1,6 @@ /* - * - * Detects and fully resolve requests to the user's workspace. + * + * Detects and fully resolve requests to the user's workspace. * This sets the default value for requests in Greenwood. * */ diff --git a/packages/cli/src/plugins/server/plugin-livereload.js b/packages/cli/src/plugins/server/plugin-livereload.js index 36dd15bdf..07d2eb120 100644 --- a/packages/cli/src/plugins/server/plugin-livereload.js +++ b/packages/cli/src/plugins/server/plugin-livereload.js @@ -16,7 +16,7 @@ class LiveReloadServer extends ServerInterface { const standardPluginsExtensions = (await Promise.all(standardPluginsNames.map(async (filename) => { const pluginImport = await import(new URL(`./${filename}`, standardPluginsDirectoryPath)); const plugin = pluginImport[Object.keys(pluginImport)[0]]; - + return plugin; }))) .filter(plugin => plugin.type === 'resource') @@ -50,7 +50,7 @@ class LiveReloadServer extends ServerInterface { } class LiveReloadResource extends ResourceInterface { - + async shouldIntercept(url, request, response) { const contentType = response.headers.get('Content-Type'); @@ -59,7 +59,7 @@ class LiveReloadResource extends ResourceInterface { async intercept(url, request, response) { let body = await response.text(); - + body = body.replace('', ` diff --git a/packages/cli/test/cases/build.config.default/build.config.default.spec.js b/packages/cli/test/cases/build.config.default/build.config.default.spec.js index 7e4fa9803..b73d3ae6d 100644 --- a/packages/cli/test/cases/build.config.default/build.config.default.spec.js +++ b/packages/cli/test/cases/build.config.default/build.config.default.spec.js @@ -27,8 +27,8 @@ describe('Build Greenwood With: ', function() { let runner; before(function() { - this.context = { - publicDir: path.join(outputPath, 'public') + this.context = { + publicDir: path.join(outputPath, 'public') }; runner = new Runner(); }); diff --git a/packages/cli/test/cases/build.config.interpolate-frontmatter/build.config.interpolate-frontmatter.spec.js b/packages/cli/test/cases/build.config.interpolate-frontmatter/build.config.interpolate-frontmatter.spec.js index 2d7f9eefb..6e4428eea 100644 --- a/packages/cli/test/cases/build.config.interpolate-frontmatter/build.config.interpolate-frontmatter.spec.js +++ b/packages/cli/test/cases/build.config.interpolate-frontmatter/build.config.interpolate-frontmatter.spec.js @@ -45,7 +45,7 @@ describe('Build Greenwood With: ', function() { }); describe(LABEL, function() { - + before(async function() { await runner.setup(outputPath, getSetupFiles(outputPath)); await runner.runCommand(cliPath, 'build'); diff --git a/packages/cli/test/cases/build.config.markdown-custom.plugins/build.config.markdown-custom.spec.js b/packages/cli/test/cases/build.config.markdown-custom.plugins/build.config.markdown-custom.spec.js index daa893302..1d01f6a3c 100644 --- a/packages/cli/test/cases/build.config.markdown-custom.plugins/build.config.markdown-custom.spec.js +++ b/packages/cli/test/cases/build.config.markdown-custom.plugins/build.config.markdown-custom.spec.js @@ -64,20 +64,20 @@ describe('Build Greenwood With: ', function() { expect(pre.length).to.equal(1); expect(pre[0].getAttribute('class')).to.equal('language-js'); - + expect(code.length).to.equal(1); expect(code[0].getAttribute('class')).to.equal('language-js'); }); it('should use our custom markdown preset rehype-autolink-headings and rehype-slug plugins', function() { let heading = dom.window.document.querySelector('h1 > a'); - + expect(heading.getAttribute('href')).to.equal('#greenwood-markdown-syntax-highlighting-test'); }); it('should use our custom markdown preset rremark-TBD plugins', function() { let heading = dom.window.document.querySelector('h3 > a'); - + expect(heading.getAttribute('href')).to.equal('#lower-heading-test'); }); }); diff --git a/packages/cli/test/cases/build.config.markdown-custom.settings/build.config.markdown-custom.settings.spec.js b/packages/cli/test/cases/build.config.markdown-custom.settings/build.config.markdown-custom.settings.spec.js index 94e6c319e..7b12820f4 100644 --- a/packages/cli/test/cases/build.config.markdown-custom.settings/build.config.markdown-custom.settings.spec.js +++ b/packages/cli/test/cases/build.config.markdown-custom.settings/build.config.markdown-custom.settings.spec.js @@ -56,7 +56,7 @@ describe('Build Greenwood With: ', function() { // gfm: false disables things like fenced code blocks https://www.npmjs.com/package/remark-parse#optionsgfm it('should intentionally fail to compile code fencing using our custom markdown preset settings', async function() { - let pre = dom.window.document.querySelector('pre > code'); + let pre = dom.window.document.querySelector('pre > code'); expect(pre).to.equal(null); }); diff --git a/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js b/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js index 53c232b3c..4c6a66793 100644 --- a/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js +++ b/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js @@ -58,7 +58,7 @@ describe('Build Greenwood With: ', function() { ]); await runner.runCommand(cliPath, 'build'); }); - + describe('Output for JavaScript / CSS tags and files', function() { let dom; @@ -114,7 +114,7 @@ describe('Build Greenwood With: ', function() { it('should have the expect preload CSS content in the file', async function() { const cssFiles = await glob.promise(path.join(this.context.publicDir, 'styles/*.css')); const customCss = await fs.promises.readFile(cssFiles[0], 'utf-8'); - + expect(cssFiles.length).to.be.equal(1); expect(customCss).to.be.equal(expectedCss); }); diff --git a/packages/cli/test/cases/build.config.optimization-inline/build.config-optimization-inline.spec.js b/packages/cli/test/cases/build.config.optimization-inline/build.config-optimization-inline.spec.js index 18c21083c..02f673b0b 100644 --- a/packages/cli/test/cases/build.config.optimization-inline/build.config-optimization-inline.spec.js +++ b/packages/cli/test/cases/build.config.optimization-inline/build.config-optimization-inline.spec.js @@ -12,7 +12,7 @@ * { * optimization: 'inline' * } - * + * * Custom Workspace * src/ * components/ @@ -53,14 +53,14 @@ describe('Build Greenwood With: ', function() { await runner.setup(outputPath, getSetupFiles(outputPath)); await runner.runCommand(cliPath, 'build'); }); - + describe('Output for JavaScript / CSS tags and files', function() { let dom; before(async function() { dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, './index.html')); }); - + it('should contain no link in the tag', function() { const linkTags = dom.window.document.querySelectorAll('head link'); @@ -79,10 +79,10 @@ describe('Build Greenwood With: ', function() { expect(allSrcScriptTags.length).to.be.equal(0); }); - + it('should contain no Javascript files in the output directory', async function() { const jsFiles = await glob.promise(`${this.context.publicDir}**/**/*.js`); - + expect(jsFiles).to.have.lengthOf(0); }); }); @@ -91,7 +91,7 @@ describe('Build Greenwood With: ', function() { describe('Header', function() { it('should contain one tag in the with mixed attribute ordering', function() { it('should have two