Support negative lookaheads in .flowconfig excludes
There's currently no good way to exclude an entire directory except for a single subdirectory. For example, say you have
foo/.flowconfig
foo/bar/a/
foo/bar/b/
foo/bar/...
foo/bar/z/
and you want to exclude foo/bar/ except foo/bar/b/.
since excludes win over includes, I think the only way right now is to list all of the other dirs in excludes.
it'd be nice if we supported negative lookaheads, like bar/(?!b/). using Pcre would do it.
:+1:
This will be nice for including certain flow definitions from node_modules without pulling in all the errors from modules you don't care about
+1
As for the proposed switch to PCRE, note that the current OCaml-flavor uses slashes in its syntax: \(...\) for groups and \| for alternatives. This wouldn’t be compatible with PCRE, which doesn’t uses those slashes.
As a temporary workaround, I resorted to .*\(\(\([^/]s\|[^s]\)r\|[^r]\)c\|[^c]\)/main.js today (matching .../main.js but not .../src/main.js).
+1 Does anybody could clarify why flowtype uses different approaches to define [ignore] and [include]. I can't see any advantages in using OCaml regular expressions and match it against absolute path.
we use ocaml regular expressions simply because flow is written in ocaml. linking in PCRE or using ocaml-re adds dependencies that would make building flow more difficult. obviously that's not a very good reason which is why I want to change them as soon as we can figure out a migration path.
We already have !