Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Depending on next causes fragile code. #231

Open
Raynos opened this issue May 15, 2019 · 5 comments
Open

Depending on next causes fragile code. #231

Raynos opened this issue May 15, 2019 · 5 comments

Comments

@Raynos
Copy link

Raynos commented May 15, 2019

For some reason running tslint locally broke. I managed to identify that it's a breaking change between dtslint and typescript.

I reverted the version of typescript in dtslint to work around this bug.

It would be great if dtslint did not depend on next because it causes me problems and unstabilities.

There is a breaking change in upstream typescript

         "typescript": {
-          "version": "3.5.0-dev.20190418",
-          "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.0-dev.20190418.tgz",
-          "integrity": "sha512-8jAlZFhE5dOcvUD7m/eOrPAxhvzELU+tFPLumOGM76jslhTvFIIKcJw3vEDX/3q00Vs2Bgv+sTSsdiL9nXxGWQ==",
+          "version": "3.5.0-dev.20190515",
+          "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.0-dev.20190515.tgz",
+          "integrity": "sha512-pE5yxFLdt5gT8PEX1Ra7vWU6HCdo4039be182oeWk8PTBWCWqr/XxlTjRxWfYgycNrI1vMjOux+n2y0aFJ9eUg==",
           "dev": true
         }
       }

My local version updated from 0418 to 0515.

Then when I run tslint it complains about sig.parameters is not iterable

> nsolid-ingress@0.0.1 lint /home/raynos/nodesource/nsolid-ingress
> tslint -t stylish --project "tsconfig.json"

The 'no-unnecessary-generics' rule threw an error in '/home/raynos/nodesource/nsolid-ingress/src/lib/deferred.ts':
TypeError: sig.parameters is not iterable
    at getSoleUse (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:67:33)
    at checkSignature (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:40:25)
    at cb (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:30:13)
    at visitNodes (/home/raynos/nodesource/nsolid-ingress/node_modules/typescript/lib/typescript.js:16514:30)
    at Object.forEachChild (/home/raynos/nodesource/nsolid-ingress/node_modules/typescript/lib/typescript.js:16742:24)
    at SourceFileObject.NodeObject.forEachChild (/home/raynos/nodesource/nsolid-ingress/node_modules/typescript/lib/typescript.js:120230:23)
    at walk (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:28:16)
    at applyWithFunction.ctx (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:14:58)
    at Rule.AbstractRule.applyWithFunction (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
    at Rule.applyWithProgram (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:14:21)
The 'no-unnecessary-generics' rule threw an error in '/home/raynos/nodesource/nsolid-ingress/src/nsolid-ws-connection.ts':
TypeError: sig.parameters is not iterable
    at getSoleUse (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:67:33)
    at checkSignature (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:40:25)
    at cb (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:30:13)
    at visitNodes (/home/raynos/nodesource/nsolid-ingress/node_modules/typescript/lib/typescript.js:16514:30)
    at Object.forEachChild (/home/raynos/nodesource/nsolid-ingress/node_modules/typescript/lib/typescript.js:16742:24)
    at SourceFileObject.NodeObject.forEachChild (/home/raynos/nodesource/nsolid-ingress/node_modules/typescript/lib/typescript.js:120230:23)
    at walk (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:28:16)
    at applyWithFunction.ctx (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:14:58)
    at Rule.AbstractRule.applyWithFunction (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
    at Rule.applyWithProgram (/home/raynos/nodesource/nsolid-ingress/node_modules/dtslint/bin/rules/noUnnecessaryGenericsRule.js:14:21)
/home/raynos/nodesource/nsolid-ingress/src/lib/promise-ws.ts:126:25
ERROR: 126:25  no-unnecessary-generics  Type parameter T is never used. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nsolid-ingress@0.0.1 lint: `tslint -t stylish --project "tsconfig.json"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the nsolid-ingress@0.0.1 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/raynos/.npm/_logs/2019-05-15T10_24_36_755Z-debug.log
@Raynos
Copy link
Author

Raynos commented May 27, 2019

dtslint is still broken on version 0.7.5 & 0.7.6

@Raynos
Copy link
Author

Raynos commented May 27, 2019

The errors are different this time :

The 'member-access' rule threw an error in '/home/raynos/projects/sync-wait-group/types/tape/index.d.ts':
TypeError: Cannot read property 'length' of undefined
    at recur (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/memberAccessRule.js:91:57)
    at visitNodes (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16630:30)
    at Object.forEachChild (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16858:24)
    at walk (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/memberAccessRule.js:89:15)
    at Rule.AbstractRule.applyWithFunction (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
    at Rule.apply (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/memberAccessRule.js:50:21)
    at Linter.applyRule (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/linter.js:214:29)
    at /home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/linter.js:155:85
    at Object.flatMap (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/utils.js:160:29)
    at Linter.getAllFailures (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/linter.js:155:32)
The 'no-unnecessary-class' rule threw an error in '/home/raynos/projects/sync-wait-group/types/tape/index.d.ts':
TypeError: Cannot read property 'length' of undefined
    at NoUnnecessaryClassWalker.checkMembers (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js:82:26)
    at checkIfUnnecessaryClass (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js:75:23)
    at visitNodes (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16630:30)
    at Object.forEachChild (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16858:24)
    at NoUnnecessaryClassWalker.walk (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js:79:12)
    at Rule.AbstractRule.applyWithWalker (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/language/rule/abstractRule.js:31:16)
    at Rule.apply (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js:39:21)
    at Linter.applyRule (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/linter.js:214:29)
    at /home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/linter.js:155:85
    at Object.flatMap (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/utils.js:160:29)
The 'interface-over-type-literal' rule threw an error in '/home/raynos/projects/sync-wait-group/types/tape/index.d.ts':
TypeError: Cannot read property 'kind' of undefined
    at Object.isTypeLiteralNode (/home/raynos/projects/sync-wait-group/node_modules/tsutils/typeguard/2.8/node.js:640:17)
    at cb (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js:50:65)
    at visitNodes (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16630:30)
    at Object.forEachChild (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16856:24)
    at cb (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js:64:19)
    at visitNode (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16621:24)
    at Object.forEachChild (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16957:21)
    at cb (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js:64:19)
    at visitNodes (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16630:30)
    at Object.forEachChild (/home/raynos/projects/sync-wait-group/node_modules/dtslint/node_modules/typescript/lib/typescript.js:16858:24)

@Raynos
Copy link
Author

Raynos commented Jun 27, 2019

In case anyone else runs into this problem, I've published a fork which fixes this http://npmjs.org/raynos-dtslint

@markwhitfeld
Copy link

I am experiencing a similar issue.
My angular library uses angular-cli to build its package and that is locked to TS 3.4.5.
dtslint will only work if I install a later version of Typescript.
I am stuck between either my build not working, or my tests not working!

Thanks for your package @Raynos it allowed me to resolved my issue perfectly!

@splincode
Copy link

@Raynos If you want to use your version of typescript, you can specify

dtslint --localTs node_modules/typescript/lib

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants