-
Notifications
You must be signed in to change notification settings - Fork 62
Confused by no-undef errors on type declarations #110
Comments
It's a known bug. As a workaround, just disable this rule. It is not necessary, anyway, because TypeScript guards you from that. |
Ok, thanks. So I suppose that means there's just no practical way to lint typescript with standard (which isn't configurable)? |
@searls oh, bro. Maybe try my library? https://github.com/mightyiam/eslint-config-standard-with-typescript/ |
I tried it and couldn't get it to work with the |
(I didn't mean to come across as short, I just remember spending an hour trying to get that eslint configuration to work before giving up—if you know of a minimal example app that uses it I'd be willing to try again) |
Thanks @mightyiam! |
@searls did you find a resolution to your issue? |
Hi @macklinu I haven't had time to come back to this quite yet but I'm sure that @mightyiam's example projects will get me sorted. Closing |
My issue with disabling this rule and leaving TypeScript to enforce it is that TypeScript makes this a compilation error which is really annoying during development. Is there any way around this? |
Why exactly is it annoying during development? Does it have to do with an error message in the editor or something more? |
I'm probably missing something obvious but if I set |
@aboyton yes I guess we are just confused as to how that is more annoying than it failing to lint. You can always add a no output tsc to your lint script. Also you can add TypeScript checking to your editor just like you can add linting. For example VS Code does this automatically |
So I realise that I'm wading into a discussion with a lot of opinions. For me my current workflow is:
This process works reasonable with TSLint's If I switch on |
@aboyton I would recommend using two tsconfigs one for lint and one for build could set your tsconfig.json to have
|
Thanks. I was wondering about that. I'll give it a try. |
Does AngularCLI have something like this for its TypeScript support? |
Not act I've seen. This looks the most promising so far. microsoft/TypeScript#22361 |
Am I correct this issue is still outstanding? Could this be reopened until it's resolved? I'm digging into some issues related to wmonk/create-react-app-typescript#354, and trying to sort out what to do here. |
Running into this, too. We've got a mixed ts and js project as we convert things over, so would rather not disable the rule. Also, it's nice to have a couple layers of checking just in case. |
Running into this. @mockdeep I believe you can selectively disable the rule only for .ts files using the "override" section of eslintrc |
@Offirmo yeah, that's what we ended up doing: overrides:
- files: ['**/*.ts', '**/*.tsx'],
parser: typescript-eslint-parser,
plugins: [typescript],
rules:
no-undef: off |
I'm sure this is me doing it wrong, but I'm a bit confused about how to proceed. I'm invoking this plugin with standard.js via:
If my module looks like this:
I get all of these errors:
I would have figured this plugin's job would be to override the eslint no-undef rule, but to be honest I'm just a bit confused by all the moving parts. Any thoughts would be appreciated.
The text was updated successfully, but these errors were encountered: