Skip to content

Commit 5af28f7

Browse files
committed
chore: migrate to expecttype eslint rules
This migrates to using an eslint plugin for `$ExpectType` and friends so we can do it as part of the lint script. For now, `typescript` had to be added to the root project since the rxjs site is still on an older typescript which confuses eslint (since it ends up being hoisted by yarn).
1 parent c666574 commit 5af28f7

File tree

10 files changed

+203
-79
lines changed

10 files changed

+203
-79
lines changed

.github/workflows/ci_main.yml

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ jobs:
3030
run: yarn workspace rxjs build
3131
- name: rxjs test
3232
run: yarn workspace rxjs test
33-
- name: rxjs dtslint
34-
run: yarn workspace rxjs dtslint
3533
- name: rxjs test:import
3634
run: yarn workspace rxjs test:import
3735
- name: rxjs test:esm

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"dependencies": {},
2626
"devDependencies": {
2727
"@nx/js": "17.3.0-beta.4",
28-
"nx": "17.3.0-beta.4"
28+
"nx": "17.3.0-beta.4",
29+
"typescript": "~4.9.4"
2930
}
3031
}

packages/rxjs/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
"scripts": {
7575
"changelog": "npx conventional-changelog-cli -p angular -i CHANGELOG.md -s",
7676
"lint": "eslint --ext=ts,js src spec spec-dtslint",
77-
"dtslint": "npm run lint && tsc -b ./src/tsconfig.types.json",
7877
"test": "yarn build && cross-env TS_NODE_PROJECT=tsconfig.mocha.json mocha --config spec/support/.mocharc.js \"spec/**/*-spec.ts\"",
7978
"test:esm": "node spec/module-test-spec.mjs",
8079
"test:circular": "dependency-cruiser --validate .dependency-cruiser.json -x \"^node_modules\" dist/esm",
@@ -83,7 +82,6 @@
8382
"build:clean": "shx rm -rf ./dist",
8483
"build": "yarn build:clean && yarn compile && node ./tools/generate-alias.js",
8584
"watch": "nodemon -w \"src/\" -w \"spec/\" -e ts -x npm test",
86-
"watch:dtslint": "nodemon -w \"src/\" -w \"spec-dtslint/\" -e ts -x yarn dtslint",
8785
"copy_common_package_files": "node ../../scripts/copy-common-package-files.js"
8886
},
8987
"repository": {
@@ -143,15 +141,16 @@
143141
"@types/shelljs": "^0.8.8",
144142
"@types/sinon": "^10.0.13",
145143
"@types/sinon-chai": "^3.2.9",
146-
"@typescript-eslint/eslint-plugin": "^6.9.0",
147-
"@typescript-eslint/parser": "^6.9.0",
144+
"@typescript-eslint/eslint-plugin": "^6.16.0",
145+
"@typescript-eslint/parser": "^6.16.0",
148146
"chai": "^4.3.7",
149147
"color": "3.0.0",
150148
"colors": "1.1.2",
151149
"cross-env": "5.1.3",
152150
"cz-conventional-changelog": "1.2.0",
153151
"dependency-cruiser": "^9.12.0",
154152
"eslint": "^8.52.0",
153+
"eslint-plugin-expect-type": "^0.3.0",
155154
"form-data": "^3.0.0",
156155
"fs-extra": "^8.1.0",
157156
"husky": "^4.2.5",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"plugin:expect-type/recommended"
4+
],
5+
"plugins": [
6+
"expect-type"
7+
]
8+
}

packages/rxjs/spec-dtslint/firstValueFrom-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { firstValueFrom } from 'rxjs';
2-
import { a$ } from 'helpers';
2+
import { a$ } from './helpers';
33

44
describe('firstValueFrom', () => {
55
it('should infer the element type', () => {

packages/rxjs/spec-dtslint/lastValueFrom-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { lastValueFrom } from 'rxjs';
2-
import { a$ } from 'helpers';
2+
import { a$ } from './helpers';
33

44
describe('lastValueFrom', () => {
55
it('should infer the element type', () => {

packages/rxjs/spec-dtslint/observables/forkJoin-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { a$, b$, c$ } from 'helpers';
1+
import { a$, b$, c$ } from '../helpers';
22
import { of, forkJoin } from 'rxjs';
33

44
describe('deprecated rest args', () => {

packages/rxjs/spec-dtslint/observables/iif-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { a$, b$ } from 'helpers';
1+
import { a$, b$ } from '../helpers';
22
import { iif, EMPTY } from 'rxjs';
33

44
const randomBoolean = () => Math.random() > 0.5;
@@ -31,4 +31,4 @@ it('should support inference from a predicate that returns any', () => {
3131
}
3232

3333
const o$ = iif(alwaysTrueButReturnsAny, a$, b$) // $ExpectType Observable<A | B>
34-
});
34+
});

packages/rxjs/spec-dtslint/operators/concatWith-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { of } from 'rxjs';
22
import { concatWith } from 'rxjs/operators';
3-
import { a$, b$, c$, d$, e$ } from 'helpers';
3+
import { a$, b$, c$, d$, e$ } from '../helpers';
44

55
it('should support rest params', () => {
66
const arr = [b$, c$];

0 commit comments

Comments
 (0)