Flow version:
version 0.97.0
Flow cannot resolve require with JSON filename starting with a dot:
const meta = require('../.meta.json');
It results in this error:
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ src/apps/graphql-skymock/datasets/__tests__/MetafileConsistency.test.js:7:22
Cannot resolve module ../.meta.json.
4โ import path from 'path';
5โ import Ajv from 'ajv';
6โ
7โ const meta = require('../.meta.json');
8โ
9โ test('every dataset defined in metafile should exist', () => {
10โ expect.hasAssertions();
However, when I remove the dot (and rename the file) everything is fine:
const meta = require('../meta.json');
No errors!
Thank you very much for checking it! :)
This is true even for JS files (.meta.js).
Yeah, Flow ignores all dotfiles, it probably should check if they have extension .meta vs .meta.js
Can I opt-out from this? I know it's unusual to start with a dot so it's not very common but it really makes sense in my case. Why does Flow ignore dot files by default?
No idea, it also wouldn't work with [include]
Maybe you can try symlinks
Hi, can I work on this ?
@gabrielrumiranda Sure you can, what you want to know about codebase?
@goodmind is my first contribution in project, i don't know much about codebase. The module who works with imports is flow/src/typing/import_export.ml ?
@gabrielrumiranda
https://github.com/facebook/flow/blob/95ef2463e608ce74d04fdccb26a673a7870d52fc/src/common/files.ml#L97-L102
This should be here I think
@goodmind the tests of this part of code is in tests/declarations_files_node ?
Not sure where the tests should be, maybe new folder?
I create a PR, #8045
Most helpful comment
I create a PR, #8045