-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: Add Eslint to sentry-javascript #2786
Conversation
size-limit report
|
a877ce0
to
cf7a9f1
Compare
"eslint": "^7.5.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-jsdoc": "^30.0.3", | ||
"eslint-plugin-sentry-sdk": "file:./eslint-plugin-sentry-sdk", |
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.
All of these dependencies are temporary. When we move the main eslint
config out of this repo, we should be able to replace this (at the package level) with just a single eslint-config-sentry-sdks
350b947
to
d26de38
Compare
"chai": "^4.1.2", | ||
"codecov": "^3.6.5", | ||
"danger": "^7.1.3", | ||
"danger-plugin-eslint": "^0.1.0", | ||
"danger-plugin-tslint": "^2.0.0", |
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.
Do we still need this?
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.
Yes, because the other packages still use tslint
. We can remove after we are done.
Sooooooooo good, thank you! |
This PR adds an initial implementation of an eslint-config to the mono-repo. It also adds a eslint-plugin-sentry-sdks, a local npm package we use to write our own custom eslint rules, and converts @sentry/browser from eslint to tslint.
Total changes after disregarding
yarn.lock
: +295 -510.See Asana ticket: https://app.asana.com/0/1159797622087522/1186701350284441/f
This PR adds an initial implementation of an
eslint-config
to the mono-repo. It also adds aeslint-plugin-sentry-sdks
, a local npm package we use to write our own custom eslint rules, and converts@sentry/browser
from eslint to tslint.Here is how this works. I've created an
.eslintignore
that has all the packages that we ignore (everything except@sentry/browser
right now). As I convert packages, I'll be updating and eventually deleting that file.The heart of the matter is in the
.eslintrc.js
file located at the heart of the repo. This specifies all the rules that will eventually go intoeslint-config-sentry-sdks
. I've commented each rule with justification, so go take a look. This maps fairly 1 to 1 with our old tslint config, but I took the liberty with changing some rules.This
eslintrc.js
file in the root of the repo also relies on a neweslint-plugin-sentry-sdks
. This plugin currently only implements one rule, to preventasync await
usage, but I expect to add more as I convert the rest of the packages.The plan for conversion is that I'll address all the packages in the mono-repo, and then move the config out of the repo.
In terms of
@sentry/browser
changes:You'll notice some class methods moved around. This is based on using the default from https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md which I think is better suited to organize classes than what we had before.
I typed
any
->unknown
where I was 100% confident, but for the rest I just slammed theeslint-disable-next-line @typescript-eslint/no-explicit-any
. We should add a task after this is done to review all ourno-explicit-any
usage.I changed some regex because it eslint warned about unnecessary escape.
I removed all instances of tslint, and the
tslint.json
in favour of an.eslintrc.js
file