Skip to content

Conversation

@CommanderStorm
Copy link
Member

Currently, our code is unformatted.
I think adding a formatter would be nice.

Adding it to CI should be a different PR for better reviewability

@codecov-commenter
Copy link

codecov-commenter commented Nov 30, 2025

Codecov Report

❌ Patch coverage is 93.34764% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.73%. Comparing base (7fcea88) to head (7da7239).

Files with missing lines Patch % Lines
src/diff.ts 78.94% 12 Missing ⚠️
src/expression/compound_expression.ts 91.46% 7 Missing ⚠️
src/expression/index.ts 90.32% 6 Missing ⚠️
src/expression/definitions/interpolate.ts 72.22% 5 Missing ⚠️
src/validate/validate_filter.ts 60.00% 4 Missing ⚠️
src/validate/validate_light.ts 62.50% 3 Missing ⚠️
src/expression/definitions/coercion.ts 88.23% 2 Missing ⚠️
src/expression/definitions/let.ts 50.00% 2 Missing ⚠️
src/expression/definitions/step.ts 60.00% 2 Missing ⚠️
src/expression/definitions/within.ts 89.47% 2 Missing ⚠️
... and 15 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1392      +/-   ##
==========================================
+ Coverage   93.70%   93.73%   +0.02%     
==========================================
  Files         111      111              
  Lines        4387     4626     +239     
  Branches     1389     1557     +168     
==========================================
+ Hits         4111     4336     +225     
- Misses        276      290      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 30, 2025

Size Change: +675 B (+0.5%)

Total Size: 135 kB

Filename Size Change
dist/index.cjs 67.8 kB +317 B (+0.47%)
dist/index.mjs 66.8 kB +358 B (+0.54%)

compressed-size-action

@HarelM
Copy link
Collaborator

HarelM commented Nov 30, 2025

The currently known pair is eslint and prettier, I'm not sure keen to introduce this tool which seems to be a bit "too" new.
Is it possible to achieve the required formatting with eslint somehow and avoid the extra tool? What formatting is missing here that you think is critical?
(Don't get me wrong, I'm in favor of formatting and coding standards, but less about adding more tools and configuration to maintain).

@CommanderStorm
Copy link
Member Author

Eslint does not do formatting of spaces.
We could use prettier, but the difference there is just that it is slower for our use case. There does not seem to be any downside to choosing a more modern tooling.

1 similar comment
@CommanderStorm
Copy link
Member Author

Eslint does not do formatting of spaces.
We could use prettier, but the difference there is just that it is slower for our use case. There does not seem to be any downside to choosing a more modern tooling.

@HarelM
Copy link
Collaborator

HarelM commented Nov 30, 2025

Doesn't indent take care of spacing for example?
https://eslint.style/rules/indent

@HarelM
Copy link
Collaborator

HarelM commented Nov 30, 2025

Moreover, I think stylistic took that part of eslint and there are some "default" recommendations:
stylistic.configs.recommended
See here:
https://eslint.style/guide/config-presets

I'm not saying it the best solution, I'm just offering alternatives.

@CommanderStorm
Copy link
Member Author

I am not talking about indents, I am talking about things like below comments.

Eslint is a linter and the job of a linter is a bit different from a formatter.
Historically, mixing these two has resulted in worse results on both sides.
I would like to move to a place where these two are decoupled as I think this simplifies our life.

https://typescript-eslint.io/users/what-about-formatting/

Copy link
Member Author

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

Here are some of the reasons why I think adding a formatter is beneficial

// there is no support yet but there is a tracking issue
const maplibreIssue = /https:\/\/github.com\/maplibre\/[^/]+\/issues\/(\d+)/;
const match = support.match(maplibreIssue);
const match = support.match(maplibreIssue);
Copy link
Member Author

Choose a reason for hiding this comment

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

Before: One space too many

Comment on lines +147 to +151
return key
.split('-')
.map((k) => k.replace(/(.)(.*)/, (_, _1, _2) => `${_1.toUpperCase()}${_2}`))
.concat('LayerSpecification')
.join('');
Copy link
Member Author

Choose a reason for hiding this comment

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

Before: harder to read due to line length

Comment on lines +187 to +188
writeFileSync(
'src/types.g.ts',
Copy link
Member Author

Choose a reason for hiding this comment

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

Before: weird indentation

Copy link
Member Author

Choose a reason for hiding this comment

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

Before: seemingly ignored by foematting

Comment on lines +29 to 30
const config: RollupOptions[] = [
{
Copy link
Member Author

Choose a reason for hiding this comment

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

Before: inconsistent indentation of brackets

@HarelM
Copy link
Collaborator

HarelM commented Nov 30, 2025

I think this requires looking into the eslint configuration deeper, I did a shallow pass.
I don't have strong feelings against oxfmt, just want to make sure we understand that it's not just adding this tool, but really cleaning the previous tool that used to do the job...

@CommanderStorm
Copy link
Member Author

Fair. I just removed all of https://eslint.org/blog/2023/10/deprecating-formatting-rules/

Has the advantage that the migration to v11 will be simpler as now only 2 deprecations relating to commonjs are remaining.

@CommanderStorm CommanderStorm merged commit 50b7f07 into main Nov 30, 2025
7 checks passed
@CommanderStorm CommanderStorm deleted the fmt branch November 30, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants