Skip to content

Commit 5ddd5dd

Browse files
authored
chore: add 'prettier' + 'simple-import-sort' linting rules (#169)
Only apply linting fixes
1 parent 6472326 commit 5ddd5dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+256
-176
lines changed

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
"prepare": "husky install"
1919
},
2020
"lint-staged": {
21-
"**/*": "prettier --write --ignore-unknown"
21+
"**/*.{ts,tsx}": [
22+
"prettier --write --ignore-unknown",
23+
"eslint --fix"
24+
],
25+
"**/*.{json,yml}": [
26+
"prettier --write --ignore-unknown"
27+
]
2228
},
2329
"devDependencies": {
2430
"@changesets/cli": "^2.26.1",
@@ -29,13 +35,15 @@
2935
"@typescript-eslint/eslint-plugin": "^5.59.9",
3036
"@typescript-eslint/parser": "^5.59.9",
3137
"eslint": "^8.42.0",
32-
"eslint-config-prettier": "^8.8.0",
38+
"eslint-config-prettier": "^9.1.0",
3339
"eslint-plugin-jest": "^27.2.1",
40+
"eslint-plugin-prettier": "^5.2.1",
41+
"eslint-plugin-simple-import-sort": "^12.1.1",
3442
"husky": "^8.0.3",
3543
"jest": "^29.5.0",
3644
"lint-staged": "^13.2.2",
3745
"nx": "^15.9.2",
38-
"prettier": "^2.8.7",
46+
"prettier": "^3.3.3",
3947
"rimraf": "^5.0.1",
4048
"ts-jest": "^29.1.0",
4149
"ts-node": "^10.9.1",

packages/browser/.eslintrc.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@
1010
"sourceType": "module",
1111
"ecmaVersion": 2020
1212
},
13-
"plugins": ["@typescript-eslint", "jest"],
13+
"plugins": ["@typescript-eslint", "jest", "prettier", "simple-import-sort"],
1414
"extends": [
1515
"eslint:recommended",
1616
"plugin:@typescript-eslint/recommended",
1717
"plugin:jest/recommended",
18-
"prettier"
18+
"plugin:prettier/recommended"
1919
],
2020
"rules": {
21-
// The following rule is enabled only to supplement the inline suppression
22-
// examples, and because it is not a recommended rule, you should either
23-
// disable it, or understand what it enforces.
24-
// https://typescript-eslint.io/rules/explicit-function-return-type/
25-
"@typescript-eslint/explicit-function-return-type": "warn"
21+
"@typescript-eslint/explicit-function-return-type": "warn",
22+
"prettier/prettier": "error",
23+
"simple-import-sort/exports": "error",
24+
"simple-import-sort/imports": "error"
2625
}
2726
}

packages/browser/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
import type { RumOtelWebConfig } from '@hyperdx/otel-web';
12
import Rum from '@hyperdx/otel-web';
23
import SessionRecorder from '@hyperdx/otel-web-session-recorder';
34
import opentelemetry, { Attributes } from '@opentelemetry/api';
45

56
import { resolveAsyncGlobal } from './utils';
67

7-
import type { RumOtelWebConfig } from '@hyperdx/otel-web';
8-
98
type ErrorBoundaryComponent = any; // TODO: Define ErrorBoundary type
109

1110
type Instrumentations = RumOtelWebConfig['instrumentations'];

packages/instrumentation-exception/.eslintrc.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@
1010
"sourceType": "module",
1111
"ecmaVersion": 2020
1212
},
13-
"plugins": ["@typescript-eslint", "jest"],
13+
"plugins": ["@typescript-eslint", "jest", "prettier", "simple-import-sort"],
1414
"extends": [
1515
"eslint:recommended",
1616
"plugin:@typescript-eslint/recommended",
1717
"plugin:jest/recommended",
18-
"prettier"
18+
"plugin:prettier/recommended"
1919
],
2020
"rules": {
21-
// The following rule is enabled only to supplement the inline suppression
22-
// examples, and because it is not a recommended rule, you should either
23-
// disable it, or understand what it enforces.
24-
// https://typescript-eslint.io/rules/explicit-function-return-type/
2521
"@typescript-eslint/ban-ts-comment": "warn",
2622
"@typescript-eslint/explicit-function-return-type": "warn",
27-
"@typescript-eslint/no-this-alias": "warn"
23+
"@typescript-eslint/no-this-alias": "warn",
24+
"prettier/prettier": "error",
25+
"simple-import-sort/exports": "error",
26+
"simple-import-sort/imports": "error"
2827
}
2928
}

packages/instrumentation-exception/src/browser/eventbuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ function eventFromPlainObject(
8383
type: isEvent(exception)
8484
? exception.constructor.name
8585
: isUnhandledRejection
86-
? 'UnhandledRejection'
87-
: 'Error',
86+
? 'UnhandledRejection'
87+
: 'Error',
8888
value: getNonErrorObjectExceptionValue(exception, {
8989
isUnhandledRejection,
9090
}),

packages/instrumentation-exception/src/browser/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { captureException, withScope } from '@sentry/core';
22
import type { Mechanism, WrappedFunction } from '@sentry/types';
33
import {
4-
GLOBAL_OBJ,
54
addExceptionMechanism,
65
addExceptionTypeValue,
76
addNonEnumerableProperty,
87
getOriginalFunction,
8+
GLOBAL_OBJ,
99
markFunctionWrapped,
1010
} from '@sentry/utils';
1111

packages/instrumentation-exception/src/browser/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import type { ClientOptions, Event, EventHint } from '@sentry/types';
1+
import { getEventProcessor } from '@hyperdx/instrumentation-sentry-node';
2+
import { Attributes, diag, Span, trace, Tracer } from '@opentelemetry/api';
23
import {
34
dedupeIntegration,
45
functionToStringIntegration,
56
inboundFiltersIntegration,
67
prepareEvent,
78
} from '@sentry/core';
8-
import { Attributes, Span, Tracer, diag, trace } from '@opentelemetry/api';
9-
import { getEventProcessor } from '@hyperdx/instrumentation-sentry-node';
9+
import type { ClientOptions, Event, EventHint } from '@sentry/types';
1010

11+
import { name as PKG_NAME, version as PKG_VERSION } from '../../package.json';
12+
import { eventFromUnknownInput } from './eventbuilder';
1113
import { browserApiErrorsIntegration } from './integrations/browserapierrors';
1214
import { contextLinesIntegration } from './integrations/contextlines';
13-
import { defaultStackParser } from './stack-parsers';
14-
import { eventFromUnknownInput } from './eventbuilder';
1515
import { globalHandlersIntegration } from './integrations/globalhandlers';
1616
import { httpContextIntegration } from './integrations/httpcontext';
1717
import { hyperdxIntegration } from './integrations/hyperdx';
1818
import { linkedErrorsIntegration } from './integrations/linkederrors';
19-
import { name as PKG_NAME, version as PKG_VERSION } from '../../package.json';
19+
import { defaultStackParser } from './stack-parsers';
2020

2121
// TODO: does it make sense to have a default tracer here?
2222
const defaultTracer = trace.getTracer(PKG_NAME, PKG_VERSION);

packages/instrumentation-exception/src/browser/instrumentations/HyperDXErrorInstrumentation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import * as shimmer from 'shimmer';
21
import { Span } from '@opentelemetry/api';
32
import {
43
InstrumentationBase,
54
InstrumentationConfig,
65
} from '@opentelemetry/instrumentation';
6+
import * as shimmer from 'shimmer';
77

88
import { recordException } from '../';
9-
import { limitLen, getElementXPath } from './utils';
9+
import { getElementXPath, limitLen } from './utils';
1010

1111
// FIXME take timestamps from events?
1212

@@ -109,8 +109,8 @@ export class HyperDXErrorInstrumentation extends InstrumentationBase {
109109
useful(err.name)
110110
? err.name
111111
: err.constructor && err.constructor.name
112-
? err.constructor.name
113-
: 'Error',
112+
? err.constructor.name
113+
: 'Error',
114114
);
115115
span.setAttribute('error.message', limitLen(msg, MESSAGE_LIMIT));
116116
addStackIfUseful(span, err);

packages/instrumentation-exception/src/browser/integrations/contextlines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { defineIntegration } from '@sentry/core';
22
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
33
import {
4-
GLOBAL_OBJ,
54
addContextToFrame,
5+
GLOBAL_OBJ,
66
stripUrlQueryAndFragment,
77
} from '@sentry/utils';
88

packages/instrumentation-exception/src/browser/integrations/globalhandlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { captureEvent, defineIntegration, getClient } from '@sentry/core';
21
import { diag } from '@opentelemetry/api';
2+
import { captureEvent, defineIntegration, getClient } from '@sentry/core';
33
import type {
44
Client,
55
Event,
@@ -8,12 +8,12 @@ import type {
88
StackParser,
99
} from '@sentry/types';
1010
import {
11-
UNKNOWN_FUNCTION,
1211
addGlobalErrorInstrumentationHandler,
1312
addGlobalUnhandledRejectionInstrumentationHandler,
1413
getLocationHref,
1514
isPrimitive,
1615
isString,
16+
UNKNOWN_FUNCTION,
1717
} from '@sentry/utils';
1818

1919
import { eventFromUnknownInput } from '../eventbuilder';

0 commit comments

Comments
 (0)