Skip to content

Commit a39a34d

Browse files
committed
build: Switch minimal to using eslint
1 parent b349678 commit a39a34d

File tree

9 files changed

+40
-26
lines changed

9 files changed

+40
-26
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ packages/apm/**/*
55
packages/ember/**/*
66
packages/gatsby/**/*
77
packages/integrations/**/*
8-
packages/minimal/**/*
98
packages/node/**/*
109
packages/react/**/*
1110
packages/tracing/**/*

packages/minimal/.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es6: true,
5+
},
6+
parserOptions: {
7+
ecmaVersion: 2018,
8+
},
9+
extends: ['../../.eslintrc.js'],
10+
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
11+
overrides: [
12+
{
13+
files: ['*.ts', '*.tsx', '*.d.ts'],
14+
parserOptions: {
15+
project: './tsconfig.json',
16+
},
17+
},
18+
{
19+
files: ['test/**/*'],
20+
rules: {
21+
'@typescript-eslint/no-explicit-any': 'off',
22+
'@typescript-eslint/no-non-null-assertion': 'off',
23+
},
24+
},
25+
],
26+
};

packages/minimal/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"prettier": "^1.17.0",
2727
"prettier-check": "^2.0.0",
2828
"rimraf": "^2.6.3",
29-
"tslint": "5.16.0",
3029
"typescript": "3.4.5"
3130
},
3231
"scripts": {
@@ -38,13 +37,13 @@
3837
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
3938
"clean": "rimraf dist coverage",
4039
"link:yarn": "yarn link",
41-
"lint": "run-s lint:prettier lint:tslint",
40+
"lint": "run-s lint:prettier lint:eslint",
4241
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
43-
"lint:tslint": "tslint -t stylish -p .",
44-
"lint:tslint:json": "tslint --format json -p . | tee lint-results.json",
45-
"fix": "run-s fix:tslint fix:prettier",
42+
"lint:eslint": "eslint . --format stylish",
43+
"lint:eslint:json": "eslint . --format json | tee lint-results.json",
44+
"fix": "run-s fix:eslint fix:prettier",
4645
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
47-
"fix:tslint": "tslint --fix -t stylish -p .",
46+
"fix:eslint": "lint:eslint --fix",
4847
"test": "jest",
4948
"test:watch": "jest --watch"
5049
},

packages/minimal/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ import {
1616
* @param method function to call on hub.
1717
* @param args to pass to function.
1818
*/
19+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1920
function callOnHub<T>(method: string, ...args: any[]): T {
2021
const hub = getCurrentHub();
2122
if (hub && hub[method as keyof Hub]) {
22-
// tslint:disable-next-line:no-unsafe-any
23+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2324
return (hub[method as keyof Hub] as any)(...args);
2425
}
2526
throw new Error(`No hub defined or ${method} was not found on the hub, please open a bug report.`);
@@ -31,6 +32,7 @@ function callOnHub<T>(method: string, ...args: any[]): T {
3132
* @param exception An exception-like object.
3233
* @returns The generated eventId.
3334
*/
35+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
3436
export function captureException(exception: any, captureContext?: CaptureContext): string {
3537
let syntheticException: Error;
3638
try {
@@ -107,6 +109,7 @@ export function addBreadcrumb(breadcrumb: Breadcrumb): void {
107109
* @param name of the context
108110
* @param context Any kind of data. This data will be normalized.
109111
*/
112+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
110113
export function setContext(name: string, context: { [key: string]: any } | null): void {
111114
callOnHub<void>('setContext', name, context);
112115
}
@@ -132,7 +135,6 @@ export function setTags(tags: { [key: string]: string }): void {
132135
* @param key String of extra
133136
* @param extra Any kind of data. This data will be normalized.
134137
*/
135-
136138
export function setExtra(key: string, extra: Extra): void {
137139
callOnHub<void>('setExtra', key, extra);
138140
}
@@ -182,6 +184,7 @@ export function withScope(callback: (scope: Scope) => void): void {
182184
* @param args Arguments to pass to the client/fontend.
183185
* @hidden
184186
*/
187+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
185188
export function _callOnClient(method: string, ...args: any[]): void {
186189
callOnHub<void>('_invokeClient', method, ...args);
187190
}

packages/minimal/test/lib/minimal.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from '../../src';
1818
import { init, TestClient, TestClient2 } from '../mocks/client';
1919

20+
// eslint-disable-next-line no-var
2021
declare var global: any;
2122

2223
describe('Minimal', () => {

packages/minimal/test/mocks/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getCurrentHub } from '@sentry/hub';
33
export class TestClient {
44
public static instance?: TestClient;
55

6-
public constructor(public options: object) {
6+
public constructor(public options: Record<string, unknown>) {
77
TestClient.instance = this;
88
}
99

@@ -14,6 +14,6 @@ export class TestClient {
1414

1515
export class TestClient2 {}
1616

17-
export function init(options: object): void {
17+
export function init(options: Record<string, unknown>): void {
1818
getCurrentHub().bindClient(new TestClient(options) as any);
1919
}

packages/minimal/test/tslint.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/minimal/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "./tsconfig.build.json",
3-
"include": ["src/**/*.ts"],
3+
"include": ["src/**/*.ts", "test/**/*.ts"],
44
"exclude": ["dist"],
55
"compilerOptions": {
66
"rootDir": ".",

packages/minimal/tslint.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)