From d0e630be2f5a2efdf7f00e6bad53c4183c8c05d9 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Mon, 23 Dec 2024 04:37:36 -0800 Subject: [PATCH] Flow-ignore .hg directory (#1412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: When using Sapling in an OSS checkout, Flow does not ignore files under `.hg`, leading to false errors especially in Sapling's `origbackups`, which may contain old versions of files, complete with `// flow` comments, out of context. Changelog: Internal Pull Request resolved: https://github.com/facebook/metro/pull/1412 Test Plan: ## Before ``` yarn flow ls | grep '\.hg' /Users/robhogan/workspace/metro-sl/.hg/runlog/41hxy19HHF6cGBn491508.json /Users/robhogan/workspace/metro-sl/.hg/runlog/37Z4u1Env4S8RkEa44097.json <...> /Users/robhogan/workspace/metro-sl/.hg/origbackups/packages/metro-file-map/src/watchers/common.js /Users/robhogan/workspace/metro-sl/.hg/origbackups/packages/metro-file-map/src/watchers/FSEventsWatcher.js ``` ``` yarn flow ls | wc -l 25908 ``` ``` yarn flow yarn run v1.22.22 $ /Users/robhogan/workspace/metro-sl/node_modules/.bin/flow Debugger attached. Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ .hg/origbackups/packages/metro-file-map/src/watchers/FSEventsWatcher.js:157:18 Private fields must be declared before they can be referenced. #root has not been declared. 154│ _emit(payload: Omit) { 155│ this.emit(ALL_EVENT, { 156│ ...payload, 157│ root: this.#root, 158│ } as WatcherBackendChangeEvent); 159│ } 160│ ``` ## After ``` yarn flow ls | grep '\.hg' ``` ``` yarn flow ls | wc -l 25861 ``` ``` yarn flow yarn run v1.22.22 $ /Users/robhogan/workspace/metro-sl/node_modules/.bin/flow No errors! ``` Reviewed By: hoxyq Differential Revision: D67562554 Pulled By: robhogan fbshipit-source-id: 2989914d64296643f3e27c8d3c55bc6278d883fd --- .flowconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.flowconfig b/.flowconfig index b6bb98611..d30b5c0e9 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,5 +1,6 @@ [ignore] /packages/.*/build/.* +/\.hg/.* # this transient dep bundles tests with their package, which flow attempts to parse # and crashes out as the test includes purposely malformed json \(/.*\)?/node_modules/resolve/test/.*