Closed petergoulborn closed 4 years ago
@walkermatt At the current time, npm run lint
will fail due to unresolved OpenLayers (ol
) dependency. I have a commit pending with OpenLayers added as a dev dependency which will fix that, if that's okay with you?
@devsupportman yep, that sounds fine. Thanks for your work on this
Running prettier in the doc script resolves the issue inconsistent formatting:
diff --git a/package.json b/package.json
index d152622..b7cf7a1 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,7 @@
},
"scripts": {
"watch": "chokidar 'src/**' --initial --command 'WATCH=1 npm run build'",
- "doc": "documentation readme src/ol-layerswitcher.js --section=API",
+ "doc": "documentation readme src/ol-layerswitcher.js --section=API && prettier --write README.md",
"lint": "prettier --check . && eslint src examples",
"format": "prettier --write . && eslint --fix src examples",
"build": "npm run lint && rollup --config rollup.config.js"
Thanks @devsupportman, I've squashed the commits and made a small change to the doc
npm script to avoid documentation outputting the API doc diff each time it runs. Closed in 9602306 :tada:
Re-format all files using the following Prettier rules:
Added ES Lint & Prettier to ensure consistent code formatting and validity. Based on OpenLayers ESLint config from https://github.com/openlayers/eslint-config-openlayers.
Added missing JSDoc comments to ol-layerswitcher.js.
Note: Prettier
singleQuote
,quoteProps
andbracketSpacing
are all specified twice to ensure Prettier executions (and code editor integrations) agree with those of ESLlint. (All these are set in OpenLayers ESLint config, which I think goes against Prettier best practice as of v2.0.)Created
lint
andformat
npm scripts and includelint
inbuild
:lint
runs Prettier and ESLint checks,format
will automatically fix problems where possible.