Adds static typing to JavaScript to improve developer productivity and code quality.
by facebookRust
Last 12 weeks · 570 commits
6 of 6 standards met
Summary Fixes #9407. When running a codemod over multiple files (e.g. ), every file was rewritten with the first file's transformed output. Root cause used so all files were transformed concurrently. is not safe to use this way: Prettier memoizes loaded parser plugins with of the plugin options. 's printer passes a plugin whose only per-call difference is the closure returning the current file's AST. drops functions, so the cache key is identical for every file. The second file's therefore reuses the first file's parser, which returns the first file's AST, and every file gets printed with the first file's content. Clearing / from (the existing workaround) only helps when files are processed one at a time; under concurrent execution the reset races between files. Fix Process files sequentially. The per-file failure tolerance of is preserved with a try/catch around each file. Added two regression tests: — verifies each file is transformed independently (the reported bug's exact scenario). — mocks and asserts that transform invocations never overlap. Test plan — both pass. — all 14 suites / 91 tests pass. Reproduced the bug with the reporter's A/B/C fixture before the change (all files got A.js's output) and confirmed the fix yields each file's own correct output.
Flow version: 0.312.0 Not sure if this is an issue with codemods in general or just the one, but it seems to be completely broken (see the linked repo). It doesn't always take the types from A.js. It may randomly take the types from B.js or C.js instead. Link to Try-Flow or Github repo: https://github.com/mwiencek/flow-codemod-issue
Repository: facebook/flow. Description: Adds static typing to JavaScript to improve developer productivity and code quality. Stars: 22277, Forks: 1891. Primary language: Rust. Languages: Rust (73.7%), JavaScript (23.7%), Shell (1.3%), TypeScript (0.8%), CSS (0.3%). License: MIT. Homepage: https://flow.org/ Latest release: v0.329.0 (2d ago). Open PRs: 7, open issues: 516. Last activity: 7h ago. Community health: 87%. Top contributors: SamChou19815, mroch, panagosg7, samwgoldman, gkz, gabelevi, nmote, jbrown215, avikchaudhuri, mvitousek and others.