-
-
Notifications
You must be signed in to change notification settings - Fork 243
fix(eslint-plugin): [no-output-native] update native event names #2236
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
fix(eslint-plugin): [no-output-native] update native event names #2236
Conversation
View your CI Pipeline Execution ↗ for commit b5fbd68.
☁️ Nx Cloud last updated this comment at |
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.
Thank you! Please could you set up a nightly workflow that runs the script and errors if there is a diff (you can look at existing workflows for inspiration from some related logic). Please also give it a manual trigger in addition to the schedule so we can run it on demand.
In future we could make it open a PR with the diff committed, but I won't hold the PR up on that if you don't have chance to implement that now. I just want to make sure we have some automated way to know that this is not up to date, and it doesn't feel right to have the overhead in every CI run, so that's why a nightly makes sense to me
Woah, I just discovered that the data is actually available as an npm package. 🤦♂️ Perhaps it would be better to add that package as a development dependency and regenerate |
Doh! Post-upgrade tasks can only be run on self-hosted instances, so that rules out that option. I guess the closest we can get is a workflow similar to |
…s source for event names
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2236 +/- ##
==========================================
+ Coverage 90.53% 92.25% +1.72%
==========================================
Files 179 179
Lines 3559 3333 -226
Branches 600 678 +78
==========================================
- Hits 3222 3075 -147
- Misses 183 200 +17
+ Partials 154 58 -96
Flags with carried forward coverage won't be shown. Click here to find out more. |
Awesome, thanks! |
Fixes #2230
I had a search around the web to see if there was anywhere that had a definitive list of DOM event names. The best place I could find was https://github.com/mdn/browser-compat-data . Specifically, the
api
directory contains JSON files for each DOM element type (as well as other browser API types). The events are defined against properties ending with_event
. For example,Document.json
has anafterscriptexecute_event
property.Using that information, we can build the full set of native event names, and we can automate the process of updating the list.
I've created a script that will:
mdn/browser-compat-data
repository.api
directory and find JSON files that end withElement
, as well as includingDocument.json
,Node.json
andWindow.json
.get-native-event-names.ts
file with the event names.This has added the missing event names, but it has also removed some event names. I believe that the events that were removed should not have been defined as native events in the first place. The
no-output-native
rule ensures that output bindings are not named as standard DOM events. The event names that have been removed were not raised on DOM types. For example, theaudiostart
andaudioend
events are emitted from aSpeechRecognition
object, but you don't find aSpeechRecognition
object in the DOM.