refactor: lint JS

Follows on from d18b2c9def
This commit is contained in:
George Cushen committed 2021-01-09 19:53:11 +00:00
1 parent e233094d2c
commit a4bc42feb6
3 files changed
+13 -4

No files matched your search

+11
View File
@@ -20,6 +20,17 @@ If you have a straightforward bug fix or improvement, feel free to contribute it
If you have an idea for a new feature, please start by [searching the issues](https://github.com/wowchemy/wowchemy-hugo-modules/issues) to check that the feature has not already been suggested and then suggest it by [opening a new issue](https://github.com/wowchemy/wowchemy-hugo-modules/issues/new/choose), as adding new features to Wowchemy first requires some analysis around the design and spec.
Code linting and formatting form part of the Continuous Integration process to help catch bugs and code issues in contributions.
Contributors can also run the flow on their fork of the "Wowchemy Hugo Modules" repo when making contributions (you'll need Node and Yarn to run):
```sh
cd wowchemy
yarn install
yarn run lint:js
yarn run lint:style
yarn run format
```
### Contribute a widget
[Create and publish your own widget](https://github.com/wowchemy/wowchemy-widget-starter)
+1 -3
View File
@@ -5,7 +5,7 @@
* Core JS functions and initialization.
**************************************************/
import {hugoEnvironment, codeHighlighting} from '@params';
import {hugoEnvironment, codeHighlighting, searchEnabled} from '@params';
import {fixMermaid} from './wowchemy-utils';
@@ -16,8 +16,6 @@ import {
onMediaQueryListEvent,
} from './wowchemy-theming';
const searchEnabled = typeof search_config !== 'undefined';
console.debug(`Environment: ${hugoEnvironment}`);
/* ---------------------------------------------------------------------------
+1 -1
View File
@@ -136,7 +136,7 @@
{{ $js_license := $js_license | printf "%s/*! License: https://github.com/wowchemy/wowchemy-hugo-modules/blob/master/LICENSE.md */\n" }}
{{ $js_bundle_head := $js_license | resources.FromString "js/bundle-head.js" }}
{{ $js_linebreak := "\n" | resources.FromString "js/linebreak.js" }}{{/* Fix no line break after Bootstrap JS causing error. */}}
{{ $js_params := dict "hugoEnvironment" hugo.Environment "codeHighlighting" ($scr.Get "highlight_enabled" | default false) }}
{{ $js_params := dict "hugoEnvironment" hugo.Environment "codeHighlighting" ($scr.Get "highlight_enabled" | default false) "searchEnabled" (ne site.Params.search.engine 0) }}
{{ $js_academic := resources.Get "js/wowchemy.js" | js.Build (dict "params" $js_params) }}
{{ $js_bootstrap := resources.Get "js/_vendor/bootstrap.bundle.js" }}
{{ $js_bundle := slice $js_bootstrap $js_linebreak $js_academic }}