hash
hash copied to clipboard
H-2457: Improved ESLint configuration
🌟 What is the purpose of this PR?
This PR adds a new ESLint configuration, which is more encompassing and stricter than the previous one.
Instead of trying to roll our own completely, needing to figure out which plugins to use and where I opted for an alternative method.
Instead of creating one from scratch, one uses an existing configuration and applies the necessary changes.
The big contenders currently around after some research are:
- xo (I have previous experience with this one)
- sheriff
- hardcore
While hardcore looked promising, it does not yet expose the flat config configuration.
The main problem with xo is that it is exposed through an alternative binary, making it unsuitable to use in, e.g., WebStorm. It also, by default, lints stylistic choices covered by prettier.
sheriff instead fully embraces ESLint flat configs, is highly configurable, and has an excellent webpage detailing all the configurations used.
This PR will be split into multiple, as some changes won't be immediately visible. This PR only changes the configuration, introducing a package @repo/eslint (name TBD). A follow-up PR then applies the changes to all packages.
Because styling is always very subjective, we can preview the changes without polluting this PR. Some stylistic changes may be contentious and need further discussion (for example: react/jsx-curly-brace-presence). I have already adjusted several rules, to improve it to our needs, enabling some additional ones or removing them.
I would also suggest that once in a semi-stable state one targets this PR with their new changes, so that we can test developer experience.
(I have linted my package in here, and found it quite an improvement)
Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
- [x] does not modify any publishable blocks or libraries, or modifications do not need publishing
📜 Does this require a change to the docs?
The changes in this PR:
- [x] are internal and do not require a docs change
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
- [x] affected the execution graph, and the
turbo.json's have been updated to reflect this
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 18.25%. Comparing base (
2e13a29) to head (ab1ee49). Report is 1029 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #4232 +/- ##
=======================================
Coverage 18.24% 18.25%
=======================================
Files 482 482
Lines 16041 16038 -3
Branches 2452 2449 -3
=======================================
Hits 2927 2927
+ Misses 13076 13073 -3
Partials 38 38
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Benchmark results
@rust/graph-benches – Integrations
representative_read_multiple_entities
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| link_by_source_by_property | depths: DT=255, PT=255, ET=255, E=255 | $$1.94 \mathrm{s} \pm 10.4 \mathrm{ms}\left({\color{gray}-3.601 \mathrm{\%}}\right) $$ | Flame Graph |
| link_by_source_by_property | depths: DT=0, PT=2, ET=2, E=2 | $$1.01 \mathrm{s} \pm 8.22 \mathrm{ms}\left({\color{gray}-3.593 \mathrm{\%}}\right) $$ | Flame Graph |
| link_by_source_by_property | depths: DT=2, PT=2, ET=2, E=2 | $$1.01 \mathrm{s} \pm 4.38 \mathrm{ms}\left({\color{gray}-1.579 \mathrm{\%}}\right) $$ | Flame Graph |
| link_by_source_by_property | depths: DT=0, PT=0, ET=0, E=0 | $$37.1 \mathrm{ms} \pm 241 \mathrm{μs}\left({\color{lightgreen}-7.284 \mathrm{\%}}\right) $$ | Flame Graph |
| link_by_source_by_property | depths: DT=0, PT=0, ET=2, E=2 | $$391 \mathrm{ms} \pm 2.12 \mathrm{ms}\left({\color{lightgreen}-6.811 \mathrm{\%}}\right) $$ | Flame Graph |
| link_by_source_by_property | depths: DT=0, PT=0, ET=0, E=2 | $$72.4 \mathrm{ms} \pm 301 \mathrm{μs}\left({\color{lightgreen}-5.712 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_property | depths: DT=255, PT=255, ET=255, E=255 | $$2.83 \mathrm{s} \pm 11.8 \mathrm{ms}\left({\color{gray}-3.106 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_property | depths: DT=0, PT=2, ET=2, E=2 | $$951 \mathrm{ms} \pm 4.09 \mathrm{ms}\left({\color{lightgreen}-5.652 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_property | depths: DT=2, PT=2, ET=2, E=2 | $$958 \mathrm{ms} \pm 2.91 \mathrm{ms}\left({\color{lightgreen}-7.981 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_property | depths: DT=0, PT=0, ET=0, E=0 | $$35.3 \mathrm{ms} \pm 198 \mathrm{μs}\left({\color{lightgreen}-7.721 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_property | depths: DT=0, PT=0, ET=2, E=2 | $$360 \mathrm{ms} \pm 1.29 \mathrm{ms}\left({\color{gray}-3.391 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_property | depths: DT=0, PT=0, ET=0, E=2 | $$39.5 \mathrm{ms} \pm 224 \mathrm{μs}\left({\color{gray}-4.519 \mathrm{\%}}\right) $$ | Flame Graph |
scaling_read_entity_linkless
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_id | 100 entities | $$2.01 \mathrm{ms} \pm 4.65 \mathrm{μs}\left({\color{gray}0.596 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 10 entities | $$1.84 \mathrm{ms} \pm 13.5 \mathrm{μs}\left({\color{gray}0.768 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 1 entities | $$1.82 \mathrm{ms} \pm 5.27 \mathrm{μs}\left({\color{gray}1.15 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 1000 entities | $$2.88 \mathrm{ms} \pm 32.8 \mathrm{μs}\left({\color{red}6.62 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 10000 entities | $$12.9 \mathrm{ms} \pm 134 \mathrm{μs}\left({\color{gray}-0.572 \mathrm{\%}}\right) $$ | Flame Graph |
representative_read_entity_type
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| get_entity_type_by_id | Account ID: d4e16033-c281-4cde-aa35-9085bf2e7579 |
$$1.39 \mathrm{ms} \pm 4.77 \mathrm{μs}\left({\color{gray}-0.674 \mathrm{\%}}\right) $$ | Flame Graph |
scaling_read_entity_complete_one_depth
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_id | 25 entities | $$76.2 \mathrm{ms} \pm 435 \mathrm{μs}\left({\color{gray}3.61 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 5 entities | $$24.2 \mathrm{ms} \pm 136 \mathrm{μs}\left({\color{gray}2.00 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 50 entities | $$1.53 \mathrm{s} \pm 3.27 \mathrm{ms}\left({\color{gray}-0.002 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 10 entities | $$50.7 \mathrm{ms} \pm 248 \mathrm{μs}\left({\color{gray}2.02 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 1 entities | $$19.9 \mathrm{ms} \pm 79.5 \mathrm{μs}\left({\color{gray}0.460 \mathrm{\%}}\right) $$ | Flame Graph |
scaling_read_entity_complete_zero_depth
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_id | 25 entities | $$2.59 \mathrm{ms} \pm 22.9 \mathrm{μs}\left({\color{gray}2.32 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 5 entities | $$1.89 \mathrm{ms} \pm 7.28 \mathrm{μs}\left({\color{gray}1.49 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 50 entities | $$3.97 \mathrm{ms} \pm 25.2 \mathrm{μs}\left({\color{gray}3.15 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 10 entities | $$2.00 \mathrm{ms} \pm 9.39 \mathrm{μs}\left({\color{gray}-0.719 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | 1 entities | $$1.85 \mathrm{ms} \pm 9.94 \mathrm{μs}\left({\color{gray}1.25 \mathrm{\%}}\right) $$ | Flame Graph |
representative_read_entity
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 |
$$15.7 \mathrm{ms} \pm 192 \mathrm{μs}\left({\color{gray}2.35 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 |
$$15.9 \mathrm{ms} \pm 192 \mathrm{μs}\left({\color{gray}-3.446 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 |
$$15.8 \mathrm{ms} \pm 172 \mathrm{μs}\left({\color{gray}-1.897 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 |
$$15.3 \mathrm{ms} \pm 168 \mathrm{μs}\left({\color{lightgreen}-8.131 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 |
$$15.6 \mathrm{ms} \pm 170 \mathrm{μs}\left({\color{lightgreen}-34.591 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 |
$$15.7 \mathrm{ms} \pm 190 \mathrm{μs}\left({\color{gray}2.67 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 |
$$15.8 \mathrm{ms} \pm 178 \mathrm{μs}\left({\color{gray}-3.497 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 |
$$15.6 \mathrm{ms} \pm 193 \mathrm{μs}\left({\color{lightgreen}-7.091 \mathrm{\%}}\right) $$ | Flame Graph |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 |
$$16.1 \mathrm{ms} \pm 172 \mathrm{μs}\left({\color{gray}3.94 \mathrm{\%}}\right) $$ | Flame Graph |
closed in favor of https://github.com/hashintel/hash/pull/5847