-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(eslint): Convert all packages to use central eslint config #4111
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
Changes from all commits
88a4f1c
050df24
9d4eda6
ca84eea
50166ac
e855723
2652098
1ac90e1
52f608c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,7 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
}, | ||
extends: ['@sentry-internal/sdk'], | ||
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**', 'coverage/**', 'src/loader.js'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx', '*.d.ts'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**'], | ||
rules: { | ||
'jsdoc/require-jsdoc': 'off', | ||
'no-console': 'off', | ||
'max-lines': 'off', | ||
'prefer-template': 'off', | ||
'no-unused-expressions': 'off', | ||
'guard-for-in': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['test/integration/**'], | ||
env: { | ||
mocha: true, | ||
}, | ||
rules: { | ||
'no-undef': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['test/integration/common/**', 'test/integration/suites/**'], | ||
rules: { | ||
'no-unused-vars': 'off', | ||
}, | ||
}, | ||
], | ||
rules: { | ||
'no-prototype-builtins': 'off', | ||
}, | ||
ignorePatterns: ['test/integration/**', 'src/loader.js'], | ||
iker-barriocanal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
extends: ['../../.eslintrc.js'], | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -56,6 +56,7 @@ export class XHRTransport extends BaseTransport { | |||||||
|
||||||||
request.open('POST', sentryRequest.url); | ||||||||
for (const header in this.options.headers) { | ||||||||
// eslint-disable-next-line no-prototype-builtins | ||||||||
if (this.options.headers.hasOwnProperty(header)) { | ||||||||
Comment on lines
+59
to
60
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||||
request.setRequestHeader(header, this.options.headers[header]); | ||||||||
} | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,7 +141,7 @@ module.exports = { | |
}, | ||
], | ||
|
||
// We want to prevent async await usage in our files to prevent uncessary bundle size. | ||
// We want to prevent async await usage in our files to prevent uncessary bundle size. Turned off in tests. | ||
'@sentry-internal/sdk/no-async-await': 'error', | ||
|
||
// JSDOC comments are required for classes and methods. As we have a public facing codebase, documentation, | ||
|
@@ -151,6 +151,7 @@ module.exports = { | |
{ | ||
require: { ClassDeclaration: true, MethodDefinition: true }, | ||
checkConstructors: false, | ||
publicOnly: true, | ||
}, | ||
], | ||
|
||
|
@@ -173,6 +174,8 @@ module.exports = { | |
'@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', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious - why turn There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
'@sentry-internal/sdk/no-async-await': 'off', | ||
}, | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
jsx: true, | ||
}, | ||
extends: ['@sentry-internal/sdk'], | ||
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**', 'test/integration/**'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx', '*.d.ts'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
}, | ||
], | ||
ignorePatterns: ['test/integration/**'], | ||
extends: ['../../.eslintrc.js'], | ||
rules: { | ||
'max-lines': 'off', | ||
'@sentry-internal/sdk/no-async-await': 'off', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this if this is the default? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default is |
||
'jsdoc/require-jsdoc': 0, | ||
}, | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable max-lines */ | ||
import { | ||
captureException, | ||
configureScope, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,9 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
}, | ||
extends: ['@sentry-internal/sdk'], | ||
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**', 'test/manual/**'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx', '*.d.ts'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**/*.js'], | ||
rules: { | ||
'import/order': 'off', | ||
}, | ||
}, | ||
], | ||
extends: ['../../.eslintrc.js'], | ||
rules: { | ||
'prefer-rest-params': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@sentry-internal/sdk/no-async-await': 'off', | ||
AbhiPrasad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ function createConsoleWrapper(level: string): (originalConsoleMethod: () => void | |
sentryLevel = Severity.Log; | ||
} | ||
|
||
/* eslint-disable prefer-rest-params */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
return function(this: typeof console): void { | ||
if (getCurrentHub().getIntegration(Console)) { | ||
getCurrentHub().addBreadcrumb( | ||
|
@@ -66,5 +67,6 @@ function createConsoleWrapper(level: string): (originalConsoleMethod: () => void | |
|
||
originalConsoleMethod.apply(this, arguments); | ||
}; | ||
/* eslint-enable prefer-rest-params */ | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,18 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
jsx: true, | ||
}, | ||
extends: ['@sentry-internal/sdk', 'plugin:react/recommended', 'plugin:react-hooks/recommended'], | ||
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**'], | ||
extends: ['../../.eslintrc.js', 'plugin:react/recommended', 'plugin:react-hooks/recommended'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx', '*.d.ts'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
{ | ||
files: ['*.tsx'], | ||
rules: { | ||
'jsdoc/require-jsdoc': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
// Prop types validation is not useful in test environments | ||
'react/prop-types': 'off', | ||
}, | ||
}, | ||
], | ||
rules: { | ||
'react/prop-types': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,9 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
}, | ||
extends: ['@sentry-internal/sdk'], | ||
ignorePatterns: ['dist/**', 'esm/**'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.d.ts'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**'], | ||
rules: { | ||
'no-empty': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
}, | ||
], | ||
extends: ['../../.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@sentry-internal/sdk/no-async-await': 'off', | ||
AbhiPrasad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
} | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.