-
Notifications
You must be signed in to change notification settings - Fork 134
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
Conversation
scripts/
files conventions
There was a problem hiding this comment.
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 ReportAll modified and coverable lines are covered by tests ✅
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. |
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
Motivation
As time pass, we get more complex scripts in our
scripts/
folders. We have some convention to group common libraries intolib
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 ourrequire(...)
.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
I have gone over the contributing documentation.