Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_modules give errors in Windows and not Linux/Mac OS #6086

Open
massimonewsuk opened this issue Apr 3, 2018 · 4 comments
Open

node_modules give errors in Windows and not Linux/Mac OS #6086

massimonewsuk opened this issue Apr 3, 2018 · 4 comments

Comments

@massimonewsuk
Copy link

massimonewsuk commented Apr 3, 2018

  1. Clone this repo https://github.com/massimonewsuk/flow-windows-issue
  2. Run npm install
  3. Run npx flow

On Linux systems and Mac OS, you won't get any errors.

On Windows (specifically Windows 10 x64 Version 10.0.16299 Build 16299), you will get errors like the following:

Error ----------------------------------------------------------- node_modules/graphql/error/GraphQLError.js.flow:178:62

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   178|       value: extensions || (originalError && (originalError: any).extensions),
                                                                     ^^^


Error ----------------------------------------------------------- node_modules/graphql/error/GraphQLError.js.flow:200:16

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   200| (GraphQLError: any).prototype = Object.create(Error.prototype, {
                       ^^^


Error ------------------------------------------------------------ node_modules/graphql/error/locatedError.js.flow:27:28

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   27|     return (originalError: any);
                                  ^^^


Error ------------------------------------------------------------ node_modules/graphql/error/locatedError.js.flow:32:39

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   32|     (originalError && (originalError: any).nodes) || nodes,
                                             ^^^


Error ------------------------------------------------------------ node_modules/graphql/error/locatedError.js.flow:33:38

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   33|     originalError && (originalError: any).source,
                                            ^^^


Error ------------------------------------------------------------ node_modules/graphql/error/locatedError.js.flow:34:38

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   34|     originalError && (originalError: any).positions,
                                            ^^^


Error ------------------------------------------------------------- node_modules/graphql/execution/execute.js.flow:10:10

Dependencies of a `@flow strict` module must also be `@flow strict`! (`nonstrict-import`)

   10| import { forEach, isCollection } from 'iterall';
                ^^^^^^^


Error ------------------------------------------------------------- node_modules/graphql/execution/execute.js.flow:10:19

Dependencies of a `@flow strict` module must also be `@flow strict`! (`nonstrict-import`)

   10| import { forEach, isCollection } from 'iterall';
                         ^^^^^^^^^^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:101:39

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   101|   fieldResolver: GraphQLFieldResolver<any, any>,
                                              ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:101:44

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   101|   fieldResolver: GraphQLFieldResolver<any, any>,
                                                   ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:123:41

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   123|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:123:46

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   123|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                     ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:150:41

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   150|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:150:46

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   150|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                     ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:300:40

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   300|   fieldResolver: ?GraphQLFieldResolver<any, any>,
                                               ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:300:45

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   300|   fieldResolver: ?GraphQLFieldResolver<any, any>,
                                                    ^^^


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:310:14

Sketchy null check on string [1] which is potentially an empty string. Perhaps you meant to check for null or
undefined [2]? (`sketchy-null-string`)

   node_modules/graphql/execution/execute.js.flow:310:14
   310|         if (!operationName && operation) {
                     ^^^^^^^^^^^^^

References:
   node_modules/graphql/execution/execute.js.flow:299:19
   299|   operationName: ?string,
                          ^^^^^^ [1]
   node_modules/graphql/execution/execute.js.flow:299:18
   299|   operationName: ?string,
                         ^^^^^^^ [2]


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:313:12

Sketchy null check on string [1] which is potentially an empty string. Perhaps you meant to check for null or
undefined [2]? (`sketchy-null-string`)

   node_modules/graphql/execution/execute.js.flow:313:12
   313|           !operationName ||
                   ^^^^^^^^^^^^^

References:
   node_modules/graphql/execution/execute.js.flow:299:19
   299|   operationName: ?string,
                          ^^^^^^ [1]
   node_modules/graphql/execution/execute.js.flow:299:18
   299|   operationName: ?string,
                         ^^^^^^^ [2]


Error ------------------------------------------------------------- node_modules/graphql/execution/execute.js.flow:326:9

Sketchy null check on string [1] which is potentially an empty string. Perhaps you meant to check for null or
undefined [2]? (`sketchy-null-string`)

   node_modules/graphql/execution/execute.js.flow:326:9
   326|     if (operationName) {
                ^^^^^^^^^^^^^

References:
   node_modules/graphql/execution/execute.js.flow:299:19
   299|   operationName: ?string,
                          ^^^^^^ [1]
   node_modules/graphql/execution/execute.js.flow:299:18
   299|   operationName: ?string,
                         ^^^^^^^ [2]


Error ------------------------------------------------------------ node_modules/graphql/execution/execute.js.flow:782:53

Sketchy null check on mixed [1] which is potentially false. Perhaps you meant to check for null or undefined [1]?
(`sketchy-null-mixed`)

   node_modules/graphql/execution/execute.js.flow:782:53
   782|   return error instanceof Error ? error : new Error(error || undefined);
                                                            ^^^^^

References:
   node_modules/graphql/execution/execute.js.flow:781:33
   781| function asErrorInstance(error: mixed): Error {
                                        ^^^^^ [1]


Error ----------------------------------------------------------- node_modules/graphql/execution/execute.js.flow:1021:20

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   1021|   forEach((result: any), (item, index) => {
                            ^^^


Error ----------------------------------------------------------- node_modules/graphql/execution/execute.js.flow:1308:57

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   1308| export const defaultFieldResolver: GraphQLFieldResolver<any, *> = function(
                                                                 ^^^


Error -------------------------------------------------------------- node_modules/graphql/execution/values.js.flow:18:10

Importing from an untyped module makes it `any` and is not safe! Did you mean to add `// @flow` to the top of
`../language/printer`? (`untyped-import`)

   18| import { print } from '../language/printer';
                ^^^^^


Error ----------------------------------------------------------------------- node_modules/graphql/graphql.js.flow:58:41

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   58|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                               ^^^


Error ----------------------------------------------------------------------- node_modules/graphql/graphql.js.flow:58:46

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   58|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                    ^^^


Error ----------------------------------------------------------------------- node_modules/graphql/graphql.js.flow:69:41

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   69|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                               ^^^


Error ----------------------------------------------------------------------- node_modules/graphql/graphql.js.flow:69:46

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   69|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                    ^^^


Error ---------------------------------------------------------------------- node_modules/graphql/graphql.js.flow:123:41

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   123|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                ^^^


Error ---------------------------------------------------------------------- node_modules/graphql/graphql.js.flow:123:46

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   123|   fieldResolver?: ?GraphQLFieldResolver<any, any>,
                                                     ^^^


Error ----------------------------------------------------------------------- node_modules/graphql/graphql.js.flow:157:7

Sketchy null check on mixed [1] which is potentially false. Perhaps you meant to check for null or undefined [1]?
(`sketchy-null-mixed`)

   157|   if (result.then) {
              ^^^^^^^^^^^ [1]


Error ------------------------------------------------------------ node_modules/graphql/jsutils/instanceOf.js.flow:21:32

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   21|     function instanceOf(value: any, constructor: any) {
                                      ^^^


Error ------------------------------------------------------------ node_modules/graphql/jsutils/instanceOf.js.flow:21:50

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   21|     function instanceOf(value: any, constructor: any) {
                                                        ^^^


Error ------------------------------------------------------------ node_modules/graphql/jsutils/instanceOf.js.flow:48:32

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   48|     function instanceOf(value: any, constructor: any) {
                                      ^^^


Error ------------------------------------------------------------ node_modules/graphql/jsutils/instanceOf.js.flow:48:50

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   48|     function instanceOf(value: any, constructor: any) {
                                                        ^^^


Error -------------------------------------------------------------- node_modules/graphql/jsutils/invariant.js.flow:12:8

Sketchy null check on mixed [1] which is potentially false. Perhaps you meant to check for null or undefined [1]?
(`sketchy-null-mixed`)

   node_modules/graphql/jsutils/invariant.js.flow:12:8
   12|   if (!condition) {
              ^^^^^^^^^

References:
   node_modules/graphql/jsutils/invariant.js.flow:10:46
   10| export default function invariant(condition: mixed, message: string) {
                                                    ^^^^^ [1]


Error -------------------------------------------------------------- node_modules/graphql/jsutils/memoize3.js.flow:13:42

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   13| export default function memoize3<T: (a1: any, a2: any, a3: any) => any>(
                                                ^^^


Error -------------------------------------------------------------- node_modules/graphql/jsutils/memoize3.js.flow:13:51

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   13| export default function memoize3<T: (a1: any, a2: any, a3: any) => any>(
                                                         ^^^


Error -------------------------------------------------------------- node_modules/graphql/jsutils/memoize3.js.flow:13:60

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   13| export default function memoize3<T: (a1: any, a2: any, a3: any) => any>(
                                                                  ^^^


Error -------------------------------------------------------------- node_modules/graphql/jsutils/memoize3.js.flow:13:68

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   13| export default function memoize3<T: (a1: any, a2: any, a3: any) => any>(
                                                                          ^^^


Error -------------------------------------------------------------- node_modules/graphql/jsutils/memoize3.js.flow:43:21

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   43|   return (memoized: any);
                           ^^^


Error ------------------------------------------------------ node_modules/graphql/language/blockStringValue.js.flow:36:7

Sketchy null check on number [1] which is potentially 0. Perhaps you meant to check for null or undefined [2]?
(`sketchy-null-number`)

   node_modules/graphql/language/blockStringValue.js.flow:36:7
   36|   if (commonIndent) {
             ^^^^^^^^^^^^

References:
   node_modules/graphql/language/blockStringValue.js.flow:29:22
   29|       commonIndent = indent;
                            ^^^^^^ [1]
   node_modules/graphql/language/blockStringValue.js.flow:21:22
   21|   let commonIndent = null;
                            ^^^^ [2]


Error ---------------------------------------------------------------- node_modules/graphql/language/index.js.flow:16:23

Importing from an untyped module makes it `any` and is not safe! Did you mean to add `// @flow` to the top of
`./printer`? (`untyped-import`)

   16| export { print } from './printer';
                             ^^^^^^^^^^^


Error ---------------------------------------------------------------- node_modules/graphql/language/lexer.js.flow:52:38

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   52|       token = token.next || ((token: any).next = readToken(this, token));
                                            ^^^


Error --------------------------------------------------------------- node_modules/graphql/language/lexer.js.flow:136:10

Sketchy null check on string [1] which is potentially an empty string. Perhaps you meant to check for null or
undefined [2]? (`sketchy-null-string`)

   node_modules/graphql/language/lexer.js.flow:136:10
   136|   return value ? `${token.kind} "${value}"` : token.kind;
                 ^^^^^

References:
   node_modules/graphql/language/ast.js.flow:77:11
    77|   +value: string | void,
                  ^^^^^^ [1]
   node_modules/graphql/language/ast.js.flow:77:20
    77|   +value: string | void,
                           ^^^^ [2]


Error -------------------------------------------------------------- node_modules/graphql/language/parser.js.flow:185:27

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   185|     value: ((token.value: any): string),
                                  ^^^


Error --------------------------------------------------------------- node_modules/graphql/language/parser.js.flow:505:7

Sketchy null check on boolean [1] which is potentially false. Perhaps you meant to check for null or undefined [1]?
(`sketchy-null-bool`)

   node_modules/graphql/language/parser.js.flow:505:7
   505|   if (lexer.options.experimentalFragmentVariables) {
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   node_modules/graphql/language/parser.js.flow:115:35
   115|   experimentalFragmentVariables?: boolean,
                                          ^^^^^^^ [1]


Error -------------------------------------------------------------- node_modules/graphql/language/parser.js.flow:567:31

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   567|         value: ((token.value: any): string),
                                      ^^^


Error -------------------------------------------------------------- node_modules/graphql/language/parser.js.flow:574:31

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   574|         value: ((token.value: any): string),
                                      ^^^


Error -------------------------------------------------------------- node_modules/graphql/language/parser.js.flow:598:31

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   598|         value: ((token.value: any): string),
                                      ^^^


Error -------------------------------------------------------------- node_modules/graphql/language/parser.js.flow:615:27

Unclear type. Using `any`, `Object`, or `Function` types is not safe! (`unclear-type`)

   615|     value: ((token.value: any): string),
                                  ^^^



... 122 more errors (only 50 out of 172 errors displayed)
@massimonewsuk
Copy link
Author

massimonewsuk commented Apr 3, 2018

A colleague of mine is using Debian Unstable x86-64 and he says it works fine (i.e. no errors)
4.15.0-1-amd64 #1 SMP Debian 4.15.4-1 (2018-02-18) x86_64 GNU/Linux

@massimonewsuk
Copy link
Author

massimonewsuk commented Apr 3, 2018

As @mjomble commented on another ticket (#5164 (comment)), it seems the flow linter is running on node_modules on Windows, but not on Mac OS or Linux. Should it run on node_modules or not? Should it be configurable? The documentation is not clear on these questions: https://flow.org/en/docs/linting/

@massimonewsuk
Copy link
Author

I have tried versions 0.52.0 all the way up to 0.69.0 and I've been unable to find a version of flow that can compile the example repository without errors on Windows.

@massimonewsuk
Copy link
Author

Still an issue in v0.70.0

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

No branches or pull requests

2 participants