Skip to content

Conversation

@AbhiPrasad
Copy link
Member

Convert nextjs, react, node, and serverless to using the central eslint config. This should make sure all packages use a consistent eslint config. There are some exceptions which I will walk through.

Note: Ember is not converted as it's special cased (part of the build) - so I kept it separate. We can have a discussion about what we wanna do with ember, but my opinion is that it's fine to keep it a special case.

In our central eslint config, I've disabled our no-async-await rule in tests and made jsdoc required for only exported methods/classes.

For browser we've kept ignorePatterns: ['test/integration/**', 'src/loader.js'],. I think it's fine to not lint the loader, and the integration tests are going to be refactored with the release stability work, so we can keep this for now.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 22.47 KB (-0.01% 🔽)
@sentry/browser - Webpack 23.35 KB (0%)
@sentry/react - Webpack 23.38 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 29.92 KB (-0.01% 🔽)

Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

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

A few small things but generally looks good!

Comment on lines +59 to 60
// eslint-disable-next-line no-prototype-builtins
if (this.options.headers.hasOwnProperty(header)) {
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to just fix this rather than ignore it?

Suggested change
// eslint-disable-next-line no-prototype-builtins
if (this.options.headers.hasOwnProperty(header)) {
if (Object.prototype.hasOwnProperty.call(this, header)) {

Copy link
Member Author

Choose a reason for hiding this comment

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

Wanted to make the code change as minimal as possible. I'll come back and address these low hanging fruits in separate PRs.

'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious - why turn no-empty-function off?

Copy link
Member Author

Choose a reason for hiding this comment

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

Feel like it's not valuable for tests, where you might want to quickly add empty functions if you are stubbing out a class/object.

extends: ['../../.eslintrc.js'],
rules: {
'max-lines': 'off',
'@sentry-internal/sdk/no-async-await': 'off',
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this if this is the default?

Copy link
Member Author

Choose a reason for hiding this comment

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

The default is error (turned on). We turn it off for tests.

sentryLevel = Severity.Log;
}

/* eslint-disable prefer-rest-params */
Copy link
Member

Choose a reason for hiding this comment

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

It's not letting me do this as a suggestion (I guess because it spans a part which it hides by default), but since it's an easy fix IMHO we should just change arguments to ...args and not ignore the rule.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will circle back to this in a PR afterwards to not increase the scope of this PR

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) November 4, 2021 13:46
@AbhiPrasad AbhiPrasad merged commit dcd549b into master Nov 4, 2021
@AbhiPrasad AbhiPrasad deleted the abhi-eslint-ref-2 branch November 4, 2021 13:57
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