Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 enforce scripts/ files conventions #3022

Merged
merged 8 commits into from
Oct 1, 2024
Merged

Conversation

BenoitZugmeyer
Copy link
Member

Motivation

As time pass, we get more complex scripts in our scripts/ folders. We have some convention to group common libraries into lib folders.

When a script is getting big, like the scripts/performance, we want to split it into multiple JS files, but then it is hard to understand what is supposed to be a script and what is a lib.

Changes

  • (preliminary) enforce import/no-unresolved on commonjs files. As we are renaming a bunch of files, we want to make sure we don't have any typo in our require(...).

  • Exclude lib/ folders from ESLint scripts rules. This way, we have the same rules for script libs as other source files (in particular naming conventions) but also we can enable more rules targeting scripts specifically. Which leads to...

  • Add a custom lint for scripts to ensure all scripts are effectively scripts (= contains runMain)

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner September 19, 2024 15:47
@BenoitZugmeyer BenoitZugmeyer changed the title Benoit/check scripts 🚨 enforce scripts/ files conventions Sep 19, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

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

💭 thought: ‏ Doesn't seems to be needed, but we could also enforce that scripts don't export anything (because whatever is exported should be in a lib)
Reciprocally, files in lib folders should not contain runMain and have at least one export.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.20%. Comparing base (cd768fe) to head (3181f35).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3022      +/-   ##
==========================================
+ Coverage   93.18%   93.20%   +0.02%     
==========================================
  Files         275      275              
  Lines        7610     7610              
  Branches     1707     1707              
==========================================
+ Hits         7091     7093       +2     
+ Misses        519      517       -2     

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

Copy link

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 160.93 KiB 160.93 KiB 0 B 0.00%
Logs 56.00 KiB 56.00 KiB 0 B 0.00%
Rum Slim 109.50 KiB 109.50 KiB 0 B 0.00%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.002 0.002 -0.000
addaction 0.047 0.032 -0.015
addtiming 0.001 0.001 -0.000
adderror 0.047 0.032 -0.015
startstopsessionreplayrecording 1.189 0.793 -0.396
startview 1.214 0.942 -0.272
logmessage 0.019 0.019 -0.001
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 7.38 KiB 7.13 KiB -254 B
addaction 38.38 KiB 39.24 KiB 878 B
addtiming 5.69 KiB 6.11 KiB 438 B
adderror 43.88 KiB 44.53 KiB 673 B
startstopsessionreplayrecording 4.95 KiB 5.22 KiB 269 B
startview 459.94 KiB 466.33 KiB 6.39 KiB
logmessage 38.98 KiB 40.37 KiB 1.39 KiB

🔗 RealWorld

@BenoitZugmeyer BenoitZugmeyer merged commit f0dea09 into main Oct 1, 2024
19 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/check-scripts branch October 1, 2024 14:14
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