Skip to content

Commit

Permalink
ci: switch from dtslint to ESLint (#2103)
Browse files Browse the repository at this point in the history
This commit removes the `dtslint` dependency because it was deprecated a long
time ago and is no longer maintained. The issue was with supporting newer TypeScript
versions, as `dtslint` uses an older TypeScript compiler API. We now use `eslint-plugin-expect-type`
to lint against `$Expect` comments.
  • Loading branch information
arturovt authored Mar 1, 2024
1 parent 9f0fcb0 commit f242756
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
**/*.spec.ts
**/*.lint.ts
packages/store/types/.eslintrc.js
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"build:integration:ssr": "yarn build:integration && nx server integration --configuration production",
"// - TESTING": "Test all modules #requires yarn build:packages",
"test:integration": "nx run integration:test --colors --run-in-band",
"test:types": "cd packages/store/types && yarn --no-lockfile && yarn test:types",
"test:types": "nx lint-types store",
"// - E2E": "E2E testing #requires yarn build:integration",
"cy:open": "cypress open",
"cy:open:ssr": "cross-env SSR=true cypress open",
Expand Down Expand Up @@ -145,6 +145,7 @@
"cross-env": "^5.2.1",
"cypress": "^13.1.0",
"eslint": "8.46.0",
"eslint-plugin-expect-type": "0.3.0",
"express": "^4.17.1",
"husky": "^8.0.0",
"jest": "29.4.3",
Expand Down
13 changes: 12 additions & 1 deletion packages/store/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,18 @@
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["packages/store/**/*.ts", "packages/store/**/*.html"]
"lintFilePatterns": [
"!packages/store/types",
"packages/store/**/*.ts",
"packages/store/**/*.html"
]
}
},
"lint-types": {
"executor": "@nx/eslint:lint",
"options": {
"eslintConfig": "packages/store/types/.eslintrc.js",
"lintFilePatterns": ["packages/store/types/**/*.lint.ts"]
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions packages/store/types/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const path = require('node:path');

/** @type {import("@types/eslint").Linter.Config} */
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: [path.join(__dirname, 'tsconfig.json')],
ecmaVersion: 2022,
sourceType: 'module'
},
extends: ['plugin:expect-type/recommended'],
plugins: ['eslint-plugin-expect-type'],
overrides: [
{
files: ['*.ts'],
rules: {
'prefer-const': 'off'
}
}
]
};
3 changes: 0 additions & 3 deletions packages/store/types/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions packages/store/types/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions packages/store/types/tests/dispatch.lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ describe('[TEST]: Action Types', () => {

it('should be correct type in dispatch', () => {
assertType(() => store.dispatch([])); // $ExpectType Observable<any>
assertType(() => store.dispatch(new FooAction('payload'))); // $ExpectError Actions
assertType(() => store.dispatch(new BarAction('foo'))); // $ExpectError Actions
assertType(() => store.dispatch(new FooAction('payload'))); // $ExpectType Observable<any>
assertType(() => store.dispatch(new BarAction('foo'))); // $ExpectType Observable<any>
assertType(() => store.dispatch()); // $ExpectError
assertType(() => store.dispatch({})); // $ExpectType Observable<any>
});
Expand Down
41 changes: 0 additions & 41 deletions packages/store/types/tslint.json

This file was deleted.

74 changes: 66 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3372,6 +3372,14 @@
"@typescript-eslint/types" "6.13.1"
"@typescript-eslint/visitor-keys" "6.13.1"

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1"
integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==
dependencies:
"@typescript-eslint/types" "6.21.0"
"@typescript-eslint/visitor-keys" "6.21.0"

"@typescript-eslint/[email protected]":
version "6.13.1"
resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.1.tgz#e6e5885e387841cae9c38fc0638fd8b7561973d6"
Expand All @@ -3387,6 +3395,11 @@
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.1.tgz#b56f26130e7eb8fa1e429c75fb969cae6ad7bb5c"
integrity sha512-gjeEskSmiEKKFIbnhDXUyiqVma1gRCQNbVZ1C8q7Zjcxh3WZMbzWVfGE9rHfWd1msQtPS0BVD9Jz9jded44eKg==

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d"
integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==

"@typescript-eslint/[email protected]":
version "6.13.1"
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.1.tgz#d01dda78d2487434d1c503853fa00291c566efa4"
Expand All @@ -3400,6 +3413,20 @@
semver "^7.5.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46"
integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==
dependencies:
"@typescript-eslint/types" "6.21.0"
"@typescript-eslint/visitor-keys" "6.21.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
minimatch "9.0.3"
semver "^7.5.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/[email protected]":
version "6.13.1"
resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.1.tgz#925b3a2453a71ada914ae329b7bb7e7d96634b2f"
Expand All @@ -3413,6 +3440,19 @@
"@typescript-eslint/typescript-estree" "6.13.1"
semver "^7.5.4"

"@typescript-eslint/utils@^6.10.0":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134"
integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==
dependencies:
"@eslint-community/eslint-utils" "^4.4.0"
"@types/json-schema" "^7.0.12"
"@types/semver" "^7.5.0"
"@typescript-eslint/scope-manager" "6.21.0"
"@typescript-eslint/types" "6.21.0"
"@typescript-eslint/typescript-estree" "6.21.0"
semver "^7.5.4"

"@typescript-eslint/[email protected]":
version "6.13.1"
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.1.tgz#c4b692dcc23a4fc60685b718f10fde789d65a540"
Expand All @@ -3421,6 +3461,14 @@
"@typescript-eslint/types" "6.13.1"
eslint-visitor-keys "^3.4.1"

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47"
integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==
dependencies:
"@typescript-eslint/types" "6.21.0"
eslint-visitor-keys "^3.4.1"

"@vitejs/[email protected]":
version "1.0.1"
resolved "https://registry.npmjs.org/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-1.0.1.tgz#48c46eab21e0730921986ce742563ae83fe7fe34"
Expand Down Expand Up @@ -5363,6 +5411,8 @@ default-gateway@^6.0.3:
version "6.0.3"
resolved "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz#819494c888053bdb743edbf343d6cdf7f2943a71"
integrity sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==
dependencies:
execa "^5.0.0"

defaults@^1.0.3:
version "1.0.4"
Expand Down Expand Up @@ -5897,6 +5947,14 @@ escodegen@^2.0.0:
optionalDependencies:
source-map "~0.6.1"

[email protected]:
version "0.3.0"
resolved "https://registry.npmjs.org/eslint-plugin-expect-type/-/eslint-plugin-expect-type-0.3.0.tgz#fa3a3d7e993202c31d39c0aee06c8c375fcefc94"
integrity sha512-BpEK+UVQAltIIEHEKYHpt/RDXOTyCwXb1lglsyN/wGwvR6ZYy1aJ17o1O6eSI965A/dnN37pxyiLxDERE4ai6g==
dependencies:
"@typescript-eslint/utils" "^6.10.0"
fs-extra "^11.1.1"

[email protected]:
version "5.1.1"
resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
Expand Down Expand Up @@ -6590,7 +6648,7 @@ [email protected]:
jsonfile "^3.0.0"
universalify "^0.1.0"

fs-extra@^11.0.0, fs-extra@^11.1.0:
fs-extra@^11.0.0, fs-extra@^11.1.0, fs-extra@^11.1.1:
version "11.2.0"
resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b"
integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==
Expand Down Expand Up @@ -8880,20 +8938,20 @@ [email protected], minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch
dependencies:
brace-expansion "^1.1.7"

[email protected], minimatch@^9.0.0, minimatch@^9.0.1, minimatch@^9.0.3:
version "9.0.3"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
dependencies:
brace-expansion "^2.0.1"

minimatch@^5.0.1:
version "5.1.6"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
dependencies:
brace-expansion "^2.0.1"

minimatch@^9.0.0, minimatch@^9.0.1, minimatch@^9.0.3:
version "9.0.3"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
dependencies:
brace-expansion "^2.0.1"

minimatch@~3.0.4:
version "3.0.8"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1"
Expand Down

0 comments on commit f242756

Please sign in to comment.