Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

v5.9.0 breaks build for bm-tslint-rules #3700

Closed
karfau opened this issue Feb 6, 2018 · 4 comments
Closed

v5.9.0 breaks build for bm-tslint-rules #3700

karfau opened this issue Feb 6, 2018 · 4 comments

Comments

@karfau
Copy link

karfau commented Feb 6, 2018

Bug Report

  • TSLint version: 5.9.0, 5.9.1
  • TypeScript version: 2.6.1, 2.7.1 (I only checked with those two versions)
  • Running TSLint via: CLI

tslint rule being compiled

https://github.com/bettermarks/bm-tslint-rules/blob/b550b5914d3ab4a405c95bddcac770fa8cde7c4e/src/noAbsoluteImportToOwnParentRule.ts

Actual behavior

running npm run build returns

> [email protected] build /home/karfau/dev/bettermarks/bm-tslint-rules
> tsc -p .

node_modules/tslint/lib/runner.d.ts(60,27): error TS1209: Ambient const enums are not allowed when the '--isolatedModules' flag is provided.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc -p .`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build 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/karfau/.npm/_logs/2018-02-06T21_57_59_975Z-debug.log

2018-02-06T21_57_59_975Z-debug.log

Expected behavior

With tslint 5.8.0 the rule did compile just fine.

I also found out that transpiiling rules to js files is no longer needed since one can use ts-node to run them, as is stated here (in the "final notes").
This worked for running the tests, but I have difficulties using the ts file as a rule in another projects.
I'm willing to create a minimal example for that problem, but I thin this is a rather different issue because it has a lot of implications on what dependees would need to do to be able to use the rule this way, so I think this should rather be sep. issue.

@alangpierce
Copy link

I'm running into this problem as well. In my case, I'm working on a tool (which happens to use isolatedModules in its config) that needs to parse TSLint output, so I pulled in the IRuleFailureJson type exported by tslint, which works great. However, importing that type causes the rest of tslint to be imported, so the export declare const enum Status line in runner.d.ts causes a type error.

Some more discussion about the issue here: microsoft/TypeScript#20703

My understanding is that it's generally bad practice to expose const enums in the public types for a package (partly because they can break some build configurations, and partly because inlining across projects can lead to subtle bugs after upgrading a dependency), so maybe it's best to just turn this into a regular enum?

@karfau
Copy link
Author

karfau commented Sep 1, 2018

@contributers I'm still not able upgrade my rule set even to newest version 5.11

Can somebody help me to understand how to either get around the problem or how to support a fix?

@karfau
Copy link
Author

karfau commented Sep 2, 2018

When removing the compiler option isolatedModules the uild output didn't change but the error stopped popping up.

@karfau karfau closed this as completed Sep 2, 2018
@alangpierce
Copy link

This is still causing problems for me, since I want to be able to import TSLint types without having to disable isolatedModules in my project. I guess I'll file another issue or submit a PR.

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

2 participants