Skip to content

Commit

Permalink
Merge pull request #1524 from ornskoldsvikskommun/fix-lint-errors
Browse files Browse the repository at this point in the history
Fix lint errors
  • Loading branch information
johnnyblasta committed May 30, 2022
2 parents cbc181e + cc86d9c commit e1f8e05
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 13 deletions.
6 changes: 5 additions & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Origo uses OpenLayers as the map component. Development in Origo shall support v
When developing, progressive enhancement is an encouraged strategy. That means that it is allowed to adopt new technology that may not be widely supported today but enhances the user experience in modern web browsers under the condition that the functionality is not critical.

## JavaScript
Origo follows the [Airbnb's JavaScript Style Guide](https://github.com/airbnb/javascript) for EcmaScript 6.
Origo follows the [Airbnb's JavaScript Style Guide](https://github.com/airbnb/javascript) for EcmaScript 6. There are npm scripts that can be used
to verify that the code complies with the rules: `npm run lint`to check the code, `npm run lint-run` to run the _webpack dev server_ with lint enabled and
`npm run lint-build` to lint and build. As the lint rules are also enforced when creating a pull request, there must be no errors in the code. If an error can not be avoided
it must be ignored by adding a _eslint_ ignore comment: `// eslint-disable-next-line <name-of-error>`. There should also be a comment that
clearly states why it is ignored instead of fixed.

We wish to promote modular development, and in order to do this we have chosen [webpack](https://github.com/webpack/webpack) as the bundler.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"main": "origo.js",
"scripts": {
"start": "npm run prebuild-sass | run-p watch-js watch-sass",
"lint": "eslint -c .eslintrc.json src/* --fix",
"lint": "eslint -c .eslintrc.json origo.js src/**/*.js --fix",
"lint-run": "npm run prebuild-sass | webpack-dev-server --config ./tasks/webpack.lint.dev.js --mode development",
"lint-build": "webpack --config ./tasks/webpack.lint.prod.js && npm run build-sass | npm run copy-plugins | npm run copy",
"watch-js": "webpack-dev-server --config ./tasks/webpack.dev.js --mode development",
Expand Down
2 changes: 1 addition & 1 deletion src/controls/editor/editorlayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const createElement = utils.createElement;

let viewer;

export default function editorLayers(editableLayers, optOptions = {}, v) {
export default function editorLayers(editableLayers, v, optOptions = {}) {
viewer = v;
function selectionModel(layerNames) {
const selectOptions = layerNames.map((layerName) => {
Expand Down
4 changes: 2 additions & 2 deletions src/controls/editor/editortoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ function init(options, v) {
if (options.autoSave) {
$editSave.classList.add('o-hidden');
}
editorLayers(editableLayers, {
editorLayers(editableLayers, v, {
activeLayer: currentLayer
}, v);
});
drawTools(options.drawTools, currentLayer, v);

document.addEventListener('enableInteraction', onEnableInteraction);
Expand Down
2 changes: 1 addition & 1 deletion src/controls/legend/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import GroupList from './grouplist';
* type is grouplayer, it will be treated as a subgroup
* with tick all and untick check boxes.
*/
const Group = function Group(options = {}, viewer) {
const Group = function Group(viewer, options = {}) {
const {
icon = '#ic_chevron_right_24px',
cls = '',
Expand Down
4 changes: 2 additions & 2 deletions src/controls/legend/overlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Overlays = function Overlays(options) {

const groupCmps = viewer.getGroups().reduce((acc, group) => {
if (nonGroupNames.includes(group.name)) return acc;
return acc.concat(Group(group, viewer));
return acc.concat(Group(viewer, group));
}, []);

groupCmps.forEach((groupCmp) => {
Expand Down Expand Up @@ -182,7 +182,7 @@ const Overlays = function Overlays(options) {
};

const addGroup = function addGroup(groupOptions) {
const groupCmp = Group(groupOptions, viewer);
const groupCmp = Group(viewer, groupOptions);
groupCmps.push(groupCmp);
if (groupCmp.type === 'grouplayer') {
const parent = groupCmps.find((cmp) => cmp.name === groupCmp.parent);
Expand Down
4 changes: 2 additions & 2 deletions src/controls/print/print-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ const PrintSettings = function PrintSettings(options = {}) {
width: sizes.custom ? sizes.custom[1] : sizeCustomMinWidth,
state: size === 'custom' ? 'active' : 'initial'
});
setScaleControl = SetScaleControl({
setScaleControl = SetScaleControl(map, {
scales,
initialScale: scaleInitial
}, map);
});

contentComponent = Component({
onRender() { this.dispatch('render'); },
Expand Down
2 changes: 1 addition & 1 deletion src/controls/print/set-scale-control.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Dropdown, Component } from '../../ui';
import mapUtils from '../../maputils';

export default function SetScaleControl(options = {}, map) {
export default function SetScaleControl(map, options = {}) {
const {
scales = [],
initialScale
Expand Down
5 changes: 4 additions & 1 deletion src/getattributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,7 @@ function getAttributes(feature, layer, map) {
return content;
}

export { getAttributes as default, getContent };
// export { getAttributes as default, getContent };

export default getAttributes;
export { getContent };
2 changes: 1 addition & 1 deletion src/utils/isurl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function isUrl(s) {
const regexp = new RegExp('^(?:[a-z]+:)?//', 'i');
const regexp = /^(?:[a-z]+:)?\/\//i;
return regexp.test(s);
}

0 comments on commit e1f8e05

Please sign in to comment.