Closed jcreamer898 closed 8 years ago
hey @jcreamer898, thanks for reporting the issue. I'm going to close this one because #36 duplicates it and its a little more specific even though this one is older.
Getting this exact same issue. Flow errors appear on the console but are not visible in the main editor panel. Strangely, the mini-output panel at the bottom of the editor reports that: flow(ok)
even though things should clearly be different.
SublimeLinter: #30 linter.py:1159: Running ...
/home/neutraali/example-project (working dir)
$ cat components/button/Button.js | /home/neutraali/example-project/node_modules/.bin/flow check-contents /home/neutraali/example-project/components/button/Button.js --show-all-errors --json
SublimeLinter: #30 linter.py:790: flow output: [{ ... }, { ... }, { ... }, ...]
SublimeLinter: flow 8 errors. passed: False
Package Control versions:
SublimeLinter 4.5.1
SublimeLinter-eslint 4.1.1
SublimeLinter-flow 4.5.0
Flow version: flow-bin@0.72.0
PTAL at what flow actually outputs here. (Your { ... }
.) It could be that flow finds problems in other files.
The errors (8 in total) themselves seem perfectly logical and useful, and only concern themselves with the currently "active" file - The filepaths point to an existing file etc. As an example (actual filepaths / filenames dummified):
[
{
"flowVersion": "0.72.0",
"jsonVersion": "1",
"errors": [
{
"kind": "infer",
"level": "error",
"suppressions": [],
"message": [
{
"context": "import ExampleLibrary from 'path/to/example/library';",
"descr": "Cannot resolve module `path/to/example/library`.",
"type": "Blame",
"loc": {
"source": "/home/neutraali/example-project/components/button/Button.js",
"type": "SourceFile",
"start": {
"line": 4,
"column": 21,
"offset": 67
},
"end": {
"line": 4,
"column": 59,
"offset": 106
}
},
"path": "/home/neutraali/example-project/components/button/Button.js",
"line": 4,
"endline": 4,
"start": 21,
"end": 59
}
]
},
{ ... },
{ ... },
{ ... },
...
],
"passed": false
},
{}
]
... The only thing weird in the above code (from my perspective) is the empty object in the second root level array element, but that could also be a non-issue. What's slightly more worrying is that I see the following mention in the console logs:
SublimeLinter: #2 sublime_linter.py:393: Buffer 25 inconsistent. Aborting lint.
SublimeLinter: sublime_linter.py:286: Linting buffer 25 took 5.34s
... With #2
being the thread/process/whatever that is used for Flow parsing.
If all threads abort, then we never draw at least.
Buffer x inconsistent.
means the content of the view/buffer changed so we cannot draw anymore. This happens when you type while linting in background. But could also come from an auto-fixer/prettyfier etc.
But, you should see also something like this for each parsed error
I should do what and how, exactly? I'm sorry but it's not really clear from your message.
I tried setting the SublimeLinter lint_mode
to manual
and triggering the linter - Now I had no buffer errors but the problem remained (no errors showing up in the editor area).
I essentially just ask if you have more debug output. E.g. flow line: ...
I mean the errors are mostly just Flow errors, right (e.g. not related to SublimeLinter functions)? I can list the descriptions for all 7 if you'd like:
"Cannot resolve module `path/to/custom/library/CustomLibrary`."
"Cannot resolve name `React`."
"Missing type annotation for `props`."
"Missing type annotation for `e`."
"Cannot resolve name `$`."
"Cannot resolve name `ReactDOM`."
"Cannot resolve name `Safely`."
I've listed a more structured example above; the rest are more or less similar. Running cat components/button/Button.js | /usr/local/bin/flow check-contents /home/neutraali/example-project/components/button/Button.js --show-all-errors --json
manually returns a correct-looking error JSON.
EDIT: Complete and total debug output with filepaths and some library names dummified
Okay, sorry but at this point you have to get your hands dirty bc I cannot just see the error.
To get you into debug, it would be enough to just git clone https://github.com/SublimeLinter/SublimeLinter-flow.git
into your Packages folder of Sublime Text. Probably restart Sublime. And open subl SublimeLinter-flow/
We consider just the following method
As you can see there are only two ways to return here. Either it returns early https://github.com/SublimeLinter/SublimeLinter-flow/blob/5fb7ce6436afe9e8d1e909e2bbdf51983c5eb62d/linter.py#L107-L108 or successfully at the end.
Now, you could add some print('Here')
statements, to see if you actually return early for each of these errors. If so, you could further pin point here
@kaste Thank you so much for your help so far. With your advice, I was able to pinpoint the error here...
I tracked the error down to the _find_matching_msg_for_file
-function. Apparently the issues arise from having a source
vs. self.filename
mismatch. I'm using an alias for my Dev -folder, which points to /mnt/5276d7ee-63b9-400b-a3f0-935f438bf97b
. So as an example, the error here would be trying to compare:
/mnt/5276d7ee-63b9-400b-a3f0-935f438bf97b/example-project/components/button/Button.js
vs.
/home/neutraali/Dev/example-project/components/button/Button.js
... But I haven't figured out how to reset the "alias path" though. I made sure that the official mount paths are used at my project settings, but not exactly sure how to get those two paths to match appropriately.
I usually make sure my project file is at the top level of my project folder (but gitignored) and then
"folders":
[
{
"path": "."
}
],
This works for me for aliased/mapped paths well enough. 🤷♂️
Yeah, my problem as that I was still trying to evaluate files that were opened with the "old alias" instead of the absolute mount path. Once I reopened the files my screen lit up. I now have a "wonderful" list of Flow -errors directly visible on my editor pane that I can start resolving. :smile_cat:
Thanks again @kaste
😂 😤
I was expecting to see an error pop down like it does for ESLint, but am not.
I saw this in the console...
Here's my Linter settings...
Let me know if I might be missing something!