Vscode: [Flow] type can be used by only '.ts' files?

Created on 13 Apr 2016  路  23Comments  路  Source: microsoft/vscode

  • VSCode Version: 0.10.11
  • OS Version: Mac 10.11.4

Steps to Reproduce:

  1. I set type for return-type, argument-type and variable-type, etc.
  2. Got this message
    2016-04-13 2 45 10

Type is not only for TypeScript. Flow can be used by other javascript

Most helpful comment

@Falconerd javascript.validate.enable: false doesn't disable ESLint for me. I have ESLint and Flow Language Support extensions installed in Code. I followed the instruction from the Flow Language Support extension repo. Adding these two lines to my user settings.json

    "flow.useNPMPackagedFlow": true,
    "javascript.validate.enable": false,

I have ESLint setup in my repo using babel-eslint parser. Installed flow-bin and init it locally in my repo.

All 23 comments

Code doesn't know about Flow by default. To teach it about flow you can:

Please let me know how this works for you.

@Beingbook could you try out what I suggested above?

@egamma sorry, I'm late.
I installed the flow extension and made the language type flow.
Result:
2016-04-15 6 42 20
I think it is still.

And your last link looks broken

@egamma I retested the extension and I saw it works correctly!

This is the broken link https://github.com/Microsoft/vscode-docs/blob/master/release-notes/latest.md#file-to-language-association sorry.

@egamma I retested the extension and I saw it works correctly!

Did you retest it on Version 1.0?

@egamma yes my environment is 1.0

@Beingbook thanks for the confirmation - closing.

@egamma I know this is closed, but @egamma do you know of any way to run eslint as well? I can't seem to get it working with the flow language.

@ericwooley never done this, sorry. There is an eslint flow plugin that might help https://github.com/zertosh/eslint-plugin-flow-vars

@egamma vscode doesn't resolve eslint plugins in OSX El Cap latest. Hope you to check this.

@Beingbook this looks this issue https://github.com/Microsoft/vscode-eslint/issues/71

This isn't working for me. I've installed the extension, associated the file extension (and restarted), the project has flowconfig, flow CLI works, but VSCode (v1.10.2) still not recognizing flow.

Edit: Ahh! sorry nevermind. Just needed to set "javascript.validate.enable": false (as said on the extension page)

set "javascript.validate.enable": false how? where pls am having same issues

oh..never mind, fixed

Doesn't setting javascript.validate.enable to false just disable ESLint?

Is ESLint not needed when using Flowtype?

My understanding is that they aren't mutually exclusive. Unless Flowtype lets you set rules for things like quotes, semicolons, spacing, etc?

@Falconerd javascript.validate.enable: false doesn't disable ESLint for me. I have ESLint and Flow Language Support extensions installed in Code. I followed the instruction from the Flow Language Support extension repo. Adding these two lines to my user settings.json

    "flow.useNPMPackagedFlow": true,
    "javascript.validate.enable": false,

I have ESLint setup in my repo using babel-eslint parser. Installed flow-bin and init it locally in my repo.

It disables VSCode's inbuilt javascript validator which is still very important because you don't get errors like these highlighted anymore:

import _ from 'lodash';
import1 React from 'react'; <<< should cause "Cannot find name 'import1'" error

I haven't used flow much so I'm not sure if it completely takes care of errors like above, does it?

@laggingreflex good to know!

For my use-case, I use ESLint with babel-eslint parser, and it catches:

import1 React from 'react'  // [eslint] Parsing error: ...

I'd love to know a way to configure them to work together properly though.

This is a good eslint plugin that helps with this issue,
https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-installation

Any news on this?

The Flow plugin should really override just what's needed. Seem to be a lot of conflicts between JS checking, TS, and Flow.

Was this page helpful?
0 / 5 - 0 ratings