Skip to content

Commit

Permalink
chore: switch to eslint
Browse files Browse the repository at this point in the history
replaced tslint with eslint and updated all dependencies to the latest
  • Loading branch information
shairez committed Feb 28, 2022
1 parent 66cf1ec commit 892b328
Show file tree
Hide file tree
Showing 10 changed files with 1,854 additions and 1,414 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
@@ -0,0 +1,4 @@
node_modules
dist
coverage
.eslintrc.*
23 changes: 23 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,23 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
rules: {
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-undef': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
overrides: [
{
files: ['**/*.spec.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
},
],
};
27 changes: 15 additions & 12 deletions package.json
Expand Up @@ -22,7 +22,7 @@
"test:watch": "jest --watch",
"test:full": "run-s lint test",
"format:fix": "pretty-quick --staged",
"lint": "tslint -p .",
"lint": "eslint . --ext .js,.ts",
"prepublishOnly": "yarn run build",
"postpublish": "yarn run clean",
"semantic-release": "semantic-release",
Expand All @@ -47,24 +47,27 @@
},
"license": "MIT",
"devDependencies": {
"@commitlint/cli": "15.0.0",
"@commitlint/config-conventional": "15.0.0",
"@types/jest": "^27.0.3",
"@commitlint/cli": "16.2.1",
"@commitlint/config-conventional": "16.2.1",
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"all-contributors-cli": "6.20.0",
"commitizen": "4.2.4",
"cz-conventional-changelog": "3.3.0",
"doctoc": "2.1.0",
"husky": "^7.0.0",
"jest": "^27.4.4",
"eslint": "8.10.0",
"eslint-config-prettier": "8.4.0",
"husky": "^7.0.4",
"jest": "^27.5.1",
"npm-run-all": "^4.1.5",
"prettier": "2.5.1",
"pretty-quick": "3.1.2",
"pretty-quick": "3.1.3",
"rimraf": "3.0.2",
"rxjs": "~7.4.0",
"semantic-release": "^18.0.1",
"ts-jest": "^27.1.1",
"tslint": "6.1.3",
"typescript": "^4.5.3"
"rxjs": "~7.5.4",
"semantic-release": "^19.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
},
"peerDependencies": {
"rxjs": ">=6.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/auto-unsubscribe.spec.ts
Expand Up @@ -6,7 +6,6 @@ import {
} from './auto-unsubscribe';
import { subscribeSpyTo } from './subscribe-spy-to';

// tslint:disable-next-line:no-unused-expression
const root = (1, eval)('this');

describe('autoUnsubscribe', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/fake-time.ts
@@ -1,6 +1,6 @@
import { TestScheduler } from 'rxjs/testing';

export function fakeTime(callback: (...args: any[]) => any) {
export function fakeTime(callback: (...args: any[]) => any): any {
if (callback.length === 0) {
throw new Error(`
"fakeTime()" callback must be declared with at least one parameter
Expand Down
4 changes: 2 additions & 2 deletions src/observer-spy.ts
Expand Up @@ -38,7 +38,7 @@ export class ObserverSpy<T> implements Observer<T> {
this.state.nextWasCalled = true;
}

error(errorVal: any): void {
error(errorVal: unknown): void {
if (!this.state.errorIsExpected) {
throw errorVal;
}
Expand All @@ -58,7 +58,7 @@ export class ObserverSpy<T> implements Observer<T> {

onComplete(): Promise<void>;
onComplete(callback: (value?: unknown) => void): void;
onComplete(callback?: (value?: unknown) => void) {
onComplete(callback?: (value?: unknown) => void): any {
if (this.state.completeWasCalled) {
return callback ? callback(undefined) : Promise.resolve();
}
Expand Down
7 changes: 4 additions & 3 deletions src/subscribe-spy-to.ts
Expand Up @@ -6,15 +6,16 @@ import { ObserverSpyConfig } from './observer-spy';
export function subscribeSpyTo<T>(
observableUnderTest: Observable<T>,
config?: ObserverSpyConfig
) {
): SubscriberSpy<T> {
const spy = new SubscriberSpy(observableUnderTest, config);
queueForAutoUnsubscribe(spy);
return spy;
}

/* istanbul ignore next */
export function subscribeAndSpyOn<T>(observableUnderTest: Observable<T>) {
// tslint:disable-next-line:no-console
export function subscribeAndSpyOn<T>(
observableUnderTest: Observable<T>
): SubscriberSpy<T> {
console.warn(
'subscribeAndSpyOn is deprecated and will be removed in the next version, please use "subscribeSpyTo" instead.'
);
Expand Down
2 changes: 0 additions & 2 deletions src/subscriber-spy.ts
Expand Up @@ -16,10 +16,8 @@ export class SubscriberSpy<T> extends ObserverSpy<T> implements Unsubscribable {
}

/* istanbul ignore next */
// tslint:disable-next-line:max-classes-per-file
export class ObserverSpyWithSubscription<T> extends SubscriberSpy<T> {
constructor(observableUnderTest: Observable<T>) {
// tslint:disable-next-line:no-console
console.warn(
'ObserverSpyWithSubscription is deprecated and will be removed in the next version, please use "SubscriberSpy" instead.'
);
Expand Down
21 changes: 0 additions & 21 deletions tslint.json

This file was deleted.

0 comments on commit 892b328

Please sign in to comment.