Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

initial map setup #13

Merged

Conversation

tonypls
Copy link

@tonypls tonypls commented Nov 1, 2022

Issue

Setup map

Should the MapStyle.json live in the map directory?
Do we want camel casing for all files even json?

@madsnedergaard
Copy link
Member

madsnedergaard commented Nov 1, 2022

Oh hey, it works! :party:

Should the MapStyle.json live in the map directory?

Hmm, it could also live in the assets/public folder instead?

Do we want camel casing for all files even json?
Good question 🤔

I don't have any specific preferences here - we could also go kebab-case for non-components and PascalCase for components? Doesn't seem like we can set up a rule for differentiating though.

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md

@VIKTORVAV99
Copy link
Member

We could do it if we name them something like <name>.component.tsx and add eslint overrides for *.component.tsx. It would make things very clear but create long file names so there are both pros and cons.

@tonypls
Copy link
Author

tonypls commented Nov 2, 2022

I think this is a good approach and easy to remember,here

Filename
Name files with camelCase. E.g. utils.ts, map.ts etc.
Reason: Conventional across many JS teams.
When the file exports a component and your framework (like React) wants component to be PascalCased, use pascal case file name to match e.g. Accordion.tsx, MyControl.tsx.
Reason: Helps with consistency (little overthought required) and its what the ecosystem is doing.

I love kebabs but might be better to follow the more common pattern

@@ -31,8 +31,11 @@
"dependencies": {
"@tanstack/react-query": "4.13.0",
"@tanstack/react-query-devtools": "^4.13.0",
"mapbox-gl": "npm:[email protected]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious about this one.
Is this just temporary or how does it work and why do we need it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think this is a required dep for react-map-gl but map-libre-gl does everything it was required for

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit curious, maybe I try delete it or add a comment explaining

Copy link
Member

@VIKTORVAV99 VIKTORVAV99 Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah it's for the peer dependency, that makes sense, I have never seen it used before. 👍🏻

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madsnedergaard
Copy link
Member

I think this is a good approach and easy to remember,here

Filename
Name files with camelCase. E.g. utils.ts, map.ts etc.
Reason: Conventional across many JS teams.
When the file exports a component and your framework (like React) wants component to be PascalCased, use pascal case file name to match e.g. Accordion.tsx, MyControl.tsx.
Reason: Helps with consistency (little overthought required) and its what the ecosystem is doing.

I love kebabs but might be better to follow the more common pattern

Sounds good to me :)
I also think xx.component.tsx will be too long (and not working with VSCode refactoring functionality). If we want to separate things in linting, we could probably also rely on .ts vs .tsx later on.

Copy link
Member

@madsnedergaard madsnedergaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we will most likely delete the MapStyle.json file later on anyway (when our geo-tooling is in place)

@tonypls tonypls merged commit 25d8157 into master Nov 2, 2022
@tonypls tonypls deleted the tonyvanswet/ele-1336-ui-set-up-map-with-react-map-gl-and branch November 2, 2022 17:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants