Skip to content

Commit 6c5cd37

Browse files
committed
feat(eslint): Add naming convention for typeLike
Update @typescript-eslint/naming-convention to use 'PascalCase' for typeLike declarations -> (class, interface, typeAlias, enum, typeParameter)
1 parent 60e1982 commit 6c5cd37

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"fix": "lerna run --parallel fix",
1010
"link:yarn": "lerna run --stream --concurrency 1 link:yarn",
1111
"lint": "lerna run --parallel lint",
12+
"lint:eslint": "lerna run --parallel lint:eslint",
1213
"test": "lerna run --stream --concurrency 1 --sort test",
1314
"codecov": "codecov",
1415
"pack:changed": "lerna run pack --since",

packages/eslint-config-sdk/src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ module.exports = {
5252
// in SDKs, we should make sure that we are correctly preserving class scope.
5353
'@typescript-eslint/unbound-method': 'error',
5454

55-
// Private and protected members of a class should be prefixed with a leading underscore
55+
// Private and protected members of a class should be prefixed with a leading underscore.
56+
// typeLike declarations (class, interface, typeAlias, enum, typeParameter) should be
57+
// PascalCase.
5658
'@typescript-eslint/naming-convention': [
5759
'error',
5860
{
@@ -67,6 +69,10 @@ module.exports = {
6769
format: ['camelCase'],
6870
leadingUnderscore: 'require',
6971
},
72+
{
73+
selector: 'typeLike',
74+
format: ['PascalCase'],
75+
},
7076
],
7177

7278
// Prefer for-of loop over for loop if index is only used to access array

packages/node/src/integrations/onuncaughtexception.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { logger } from '@sentry/utils';
55
import { NodeClient } from '../client';
66
import { logAndExitProcess } from './utils/errorhandling';
77

8+
type OnFatalErrorHandler = (firstError: Error, secondError?: Error) => void;
9+
810
/** Global Promise Rejection handler */
911
export class OnUncaughtException implements Integration {
1012
/**
@@ -53,17 +55,15 @@ export class OnUncaughtException implements Integration {
5355
let firstError: Error;
5456

5557
return (error: Error): void => {
56-
type onFatalErrorHandlerType = (firstError: Error, secondError?: Error) => void;
57-
58-
let onFatalError: onFatalErrorHandlerType = logAndExitProcess;
58+
let onFatalError: OnFatalErrorHandler = logAndExitProcess;
5959
const client = getCurrentHub().getClient<NodeClient>();
6060

6161
if (this._options.onFatalError) {
6262
// eslint-disable-next-line @typescript-eslint/unbound-method
6363
onFatalError = this._options.onFatalError;
6464
} else if (client && client.getOptions().onFatalError) {
6565
// eslint-disable-next-line @typescript-eslint/unbound-method
66-
onFatalError = client.getOptions().onFatalError as onFatalErrorHandlerType;
66+
onFatalError = client.getOptions().onFatalError as OnFatalErrorHandler;
6767
}
6868

6969
if (!caughtFirstError) {

0 commit comments

Comments
 (0)