Repository Analysis

facebook/flow

Adds static typing to JavaScript to improve developer productivity and code quality.

0.6 Likely human-written View on GitHub
0.6
Adjusted Score
0.6
Raw Score
100%
Time Factor
2026-05-30
Last Push
22,213
Stars
Rust
Language
1,423,994
Lines of Code
13191
Files
685
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 10HIGH 4MEDIUM 7LOW 664

Pattern Findings

685 matches across 13 categories. Click a row to expand file-level details.

Over-Commented Block451 hits · 450 pts
SeverityFileLineSnippet
LOWwebsite/tests/check_flow_examples.sh1#!/bin/bash
LOWtests/fs.sh1#!/bin/bash
LOWtests/type_at_pos_types/recursive.js41// The following exhibits a use of the RemoveTopLevelTvarVisitor
LOWtests/suppress_unused_lazy_3/test.sh1#!/bin/bash
LOWtests/import_typeof/import_typeof.js81(() => {}) as functionFoo4T; // Error: return types are not compatible
LOWtests/rust_port_flowset_clear/test.js1// Regression test for FlowSet::clear() destroying speculation levels.
LOWtests/jsx_pragma/invalid_jsx_unsupported.js1// @jsx (x)=>x
LOWtests/jsx_pragma/invalid_no_expr.js1// @jsx
LOWtests/lint_severity_vim/test.sh1#!/bin/bash
LOWtests/hook_syntax_compatibility/rules_of_hooks.js1041/* [classError('use')] */
LOWtests/hook_syntax_compatibility/rules_of_hooks.js1061// },
LOWtests/type_spread/inline.js21// Ensuring we still error in these cases when the RHS is a spread
LOWtests/type_at_pos_statement/test.sh1#!/bin/bash
LOWtests/type_at_pos_match_pattern/test.sh1#!/bin/bash
LOWtests/lint_flag_redundant/test.sh1#!/bin/bash
LOW…sts/saved_state_reinit_libdef_change_mergebase/test.sh1#!/bin/bash
LOWtests/suppress_unused_lazy_2/test.sh1#!/bin/bash
LOWtests/spread_performance/type_spread.js1//@flow
LOWtests/type_at_pos_template_literal/test.sh1#!/bin/bash
LOWtests/cli_renderer_not_all/test.sh1#!/bin/bash
LOWtests/type_at_pos_namespace/test.sh1#!/bin/bash
LOWtests/ide_unmerged_deps_dependents/test.sh1#!/bin/bash
LOWtests/lint_redundant_comments/test.js1//Comments Redundant with Default (Error.)
LOWtests/lint_cli_no_override_none/test.sh1#!/bin/bash
LOWtests/get_def_types_first/test.sh1#!/bin/bash
LOWtests/import_type/import_type.js61//////////////////////////////////////////////
LOWtests/cli_renderer_unicode/code_frame_omit.js21 const x = 42;
LOWtests/cli_renderer_unicode/test.sh1#!/bin/bash
LOW…ts/autocomplete_haste_multiplatform_autoimport/test.sh1#!/bin/bash
LOWtests/cli_renderer_color/code_frame_omit.js21 const x = 42;
LOWtests/cli_renderer_color/large_locs.js181really
LOWtests/cli_renderer_color/large_locs.js201 // 14
LOWtests/cli_renderer_color/large_locs.js221 // 4
LOWtests/cli_renderer_color/large_locs.js241 // 14
LOWtests/cli_renderer_color/large_locs.js261 // 5
LOWtests/cli_renderer_color/large_locs.js281 // 13
LOWtests/cli_renderer_color/large_locs.js301 // 6
LOWtests/cli_renderer_color/large_locs.js321 // 12
LOWtests/cli_renderer_color/large_locs.js341 // 8
LOWtests/cli_renderer_color/basic.js1/**
LOWtests/cli_renderer_color/test.sh1#!/bin/bash
LOWtests/cli_renderer_color/max_line/test.js1/**
LOWtests/cli_renderer_color/max_line/test.js21// intentionally empty line
LOWtests/cli_renderer_color/max_line/test.js41// intentionally empty line
LOWtests/cli_renderer_color/max_line/test.js61// intentionally empty line
LOWtests/cli_renderer_color/max_line/test.js81// intentionally empty line
LOWtests/cli_renderer_color/max_line/foo.js1/**
LOWtests/cli_renderer_color/max_line/foo.js21// intentionally empty line
LOWtests/cli_renderer_color/max_line/foo.js41// intentionally empty line
LOWtests/cli_renderer_color/max_line/foo.js61// intentionally empty line
LOWtests/cli_renderer_color/max_line/foo.js81// intentionally empty line
LOWtests/focus_check/test.sh1#!/bin/bash
LOWtests/typecast/typecast.js21 // control case:
LOWtests/shorthand/test.sh1#!/bin/bash
LOWtests/lint_cli_remove_all/test.sh1#!/bin/bash
LOWtests/ts_primitive_as_obj/string_literal_widening.ts1// Repro of the `T | (string & {})` widening idiom commonly used in TS
LOWtests/type_at_pos_indexed_access/test.sh1#!/bin/bash
LOWtests/libdef_outside_of_root/test.sh1#!/bin/bash
LOWtests/lint_flag_shadowed/test.sh1#!/bin/bash
LOWtests/typecheck_contents_error_suppression/test.sh1#!/bin/bash
391 more matches not shown…
Hyper-Verbose Identifiers197 hits · 209 pts
SeverityFileLineSnippet
LOWwebsite/docusaurus.config.js37 function polyfillNodeBuiltinsForFlowJS(context, options) {
LOWwebsite/docusaurus.config.js64 function enableSomeEnvVarsAsBuildTimeConstants() {
LOWwebsite/libs/lz-string.js11 declare export function decompressFromEncodedURIComponent(s: string): string;
LOWwebsite/libs/lz-string.js12 declare export function compressToEncodedURIComponent(s: string): string;
LOWwebsite/src/try-flow/flow-loader.js72function normalizeFlowReleaseVersion(version: string): string {
LOWwebsite/src/try-flow/tokens-theme-provider.js52function generateTokensCSSForColorMap(colorMap) {
LOWtests/hook_syntax_compatibility/syntax_compatibility.js5export function useHooklikeAnnotatedFunction(): void { }
LOWtests/hook_syntax_compatibility/syntax_compatibility.js7function useHooklikeInferredFunction() { return 42; }
LOWtests/hook_syntax_compatibility/syntax_compatibility.js9declare export function useDeclaredHooklikeFunction(): number;
LOWtests/hook_syntax_compatibility/rules_of_hooks.js51function normalFunctionWithNormalFunction() {
LOWtests/hook_syntax_compatibility/rules_of_hooks.js56function normalFunctionWithConditionalFunction() {
LOWtests/hook_syntax_compatibility/rules_of_hooks.js64function functionThatStartsWithUseButIsntAHook() {
LOWtests/hook_syntax_compatibility/rules_of_hooks.js746function normalFunctionWithConditionalHook() {
LOWtests/refinements/computed_string_literal.js29function testSwitchLiteralProperty(b: B) {
LOWtests/refinements/typeof.js59function testInvalidTemplateLiteral(x: string | number) {
LOWtests/refinements/typeof.js101function testAnyWithNumberPostConditional(x: any) {
LOWtests/refinements/typeof.js132function testPolyClassCtorWithFunction() {
LOWtests/optional/optional_param.js22function testOptionalNullableDefault(x?: ?string = "hi"): string {
LOWtests/optional/optional_param.js27function testOptionalNullableProperty(obj: {x?: ?string}): string {
LOWtests/optional/optional_param.js32function testOptionalNullableFlowingToNullable(x?: ?string): ?string {
LOWtests/multiflow/spread.js28function funWithReadonlyObjectInRestSpread(...args: [{+bar: string, ... }]): void {}
LOWtests/exact_empty_objects/test.js31function paramDefaultDestructuring({a, b}: {a?: string, b?: number} = {}) {
LOWtests/exact_empty_objects/test.js39function paramDefaultDestructuringWithInnerDefault({a, b = 1}: {a?: string, b?: number} = {}) {
LOWtests/type_guards/inferred.js6 declare function takesBoolReturningFunction(fn: (x: unknown) => boolean): void;
LOWtests/types_first/function.js5export function functionWithTypeofAndDestructuring(
LOWtests/types_first/function.js11export function functionWithTypeofAndOptional(x?: number = 1, y: typeof x) {}
LOWtests/lti_implicit_instantiation/upper_non_t.js107function ResolveSpreadsToMultiflowSubtypeFull() {
LOWtests/arrows/arrows.js1function selectBestEffortImageForWidth(
LOW…s/strict_es6_import_export/named_exported_this_func.js28export function thisWithinNestedFunctionDecl() {
LOW…s/strict_es6_import_export/named_exported_this_func.js34export function thisWithinNestedAsyncFunction(): () => void {
LOWtests/hook_syntax/syntax_compatibility.js5export function useHooklikeAnnotatedFunction(): void { }
LOWtests/hook_syntax/syntax_compatibility.js7function useHooklikeInferredFunction() { return 42; }
LOWtests/hook_syntax/syntax_compatibility.js9declare export function useDeclaredHooklikeFunction(): number;
LOWtests/hook_syntax/rules_of_hooks.js51function normalFunctionWithNormalFunction() {
LOWtests/hook_syntax/rules_of_hooks.js56function normalFunctionWithConditionalFunction() {
LOWtests/hook_syntax/rules_of_hooks.js64function functionThatStartsWithUseButIsntAHook() {
LOWtests/hook_syntax/rules_of_hooks.js739function normalFunctionWithConditionalHook() {
LOW…/babel-plugin-syntax-flow-parser-oxidized/src/index.js30export default function BabelPluginSyntaxHermesParser(
LOWpackages/flow-for-vscode/src/handlers.ts24export function onDidChangeActiveTextEditor(
LOWpackages/flow-for-vscode/src/handlers.ts148export function onDidRemoveWorkspaceFolders(
LOW…r-vscode/src/FlowLanguageClient/DetailedDiagnostics.ts127function validatedRenderedFromDiagnostic(
LOW…-for-vscode/src/FlowLanguageClient/createMiddleware.ts27function chainHandleDiagnosticsMiddleware(
LOW…r-vscode/src/FlowLanguageClient/SemanticDecorations.ts17function refinedValueRangesFromDiagostics(
LOW…r-vscode/src/FlowLanguageClient/SemanticDecorations.ts66export function getFilterSemanticDecorationsMiddleWare(
LOWpackages/flow-for-vscode/src/utils/uriToString.ts70function makeWindowsDriveLetterUppercase(
LOW…flow-for-vscode/src/utils/checkFlowVersionSatisfies.ts10export default function checkFlowVersionSatisfies(
LOW…-for-vscode/src/utils/checkRelativePatternSupported.ts12export default function checkRelativePatternSupported(
LOW…es/flow-for-vscode/src/utils/getVerifiedFlowBinPath.ts21function getFlowBinDirPrefixForPlatform(): null | string {
LOW…ils/LanguageClient/TypeCoverageFeature/TypeCoverage.ts210function uncoveredRangeToDiagnostic(
LOW…ugin-fb-flow/rules/use-exact-by-default-object-type.js13function isFileWithAmbiguousObjectTypes(context) {
LOWpackages/flow-dev-tools/src/flowResult.js172function prettyPrintMessageOfError(
LOWpackages/flow-dev-tools/src/errors.js63function getFlowErrorsWithWarnings(
LOWpackages/flow-dev-tools/src/errors.js89async function getUnusedSuppressionErrors(
LOW…ages/flow-dev-tools/src/check-test/checkDiffCompare.js84function substituteVersionForRecord(text: string, version: string): string {
LOW…flow-dev-tools/src/test/searchStackForTestAssertion.js15function searchStackForTestAssertion(): ?AssertionLocation {
LOW…ools/src/test/assertions/lspNoNewMessagesAfterSleep.js22function lspNoNewMessagesAfterSleep(
LOW…tools/src/test/assertions/lspNewMessagesWithTimeout.js20function lspNewMessagesWithTimeout(
LOWpackages/flow-dev-tools/src/comment/getPathToLoc.js23function getChildNodeContainingLocation(
LOW…es/flow-dev-tools/src/comment/remove-commentsRunner.js33async function removeUnusedErrorSuppressions(
LOW…es/flow-dev-tools/src/comment/remove-commentsRunner.js48async function removeUnusedErrorSuppressionsFromText(
137 more matches not shown…
Hallucination Indicators10 hits · 100 pts
SeverityFileLineSnippet
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1098 self.0.metadata.frozen.react_rules.contains(&rule)
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1139 match self.0.metadata.frozen.deprecated_utilities.get(t) {
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1205 self.0.metadata.frozen.file_options.dupe()
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1342 self.0.metadata.overridable.available_platforms.as_ref()
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1394 self.0.metadata.frozen.facebook_fbs.as_deref()
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1398 self.0.metadata.frozen.facebook_fbt.as_deref()
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1418 self.0.metadata.frozen.stylex_shorthand_prop.as_deref()
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1482 self.0.metadata.frozen.assert_operator.usable()
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1486 self.0.metadata.frozen.assert_operator.specialized()
CRITICALrust_port/crates/flow_typing_context/src/lib.rs1796 self.0.metadata.frozen.verbose.as_deref()
Cross-Language Confusion (JS/TS)3 hits · 15 pts
SeverityFileLineSnippet
HIGHtests/union_new/issue-1462-i.js21 print(val.foo); // <--- foo could be an array
HIGHtests/union_new/issue-1462-ii.js23 print(val.foo);
HIGH…ages/flow-dev-tools/src/check-test/checkTestHelpers.js136 print(text: string): void {
AI Slop Vocabulary5 hits · 15 pts
SeverityFileLineSnippet
MEDIUM…_port/crates/flow_typing_flow_common/src/flow_cache.rs63 // corresponding typing rules are already sufficiently robust.
MEDIUM…/crates/flow_env_builder_resolver/src/name_resolver.rs3377 // possibly undefined variable. Essentially, we are treating var redeclaration as a
MEDIUM…kages/flow-dev-tools/src/check-test/checkTestRunner.js208 // Build results map by test name for robust matching
MEDIUM…ges/flow-parser-oxidized/__tests__/runContractTests.sh39# same `$WASM_OUT` (the JS test harness `require()`s a hard-coded
MEDIUMnewtests/lsp/diagnostics/test.js29 // To be robust against races: we'll wait up to 9s to get the
Verbosity Indicators6 hits · 9 pts
SeverityFileLineSnippet
LOWrust_port/crates/flow_parser_wasm/src/position.rs76 // Step 1: Build line-start byte offset table and parallel UTF-16 offset table.
LOWrust_port/crates/flow_parser_wasm/src/position.rs137 // Step 2: Compute byte_offset for each position and sort.
LOWrust_port/crates/flow_parser_wasm/src/position.rs162 // Step 3: Single-pass through source text computing UTF-16 offsets.
LOWsrc/heap/hh_shared.c1350 // Step 1: Scan the root set, threading any pointers to the heap. The
LOWsrc/heap/hh_shared.c1358 // Step 2: Scan the heap object-by-object from bottom to top. The dst pointer
LOWsrc/heap/hh_shared.c1398 // Step 3: Scan the heap object-by-object again, actually moving objects this
Redundant / Tautological Comments3 hits · 4 pts
SeverityFileLineSnippet
LOWruntests.sh370 # Print the results in order in a pretty way
LOWrust_port/.claude/porting-reminder.sh51# Increment counter
LOWpackages/scripts/build.sh61 # Check if file contains flow annotation
Slop Phrases2 hits · 4 pts
SeverityFileLineSnippet
LOW…t_port/crates/flow_parser_utils/src/flow_ast_differ.rs2534 // We keep this so that we don't forget to create handlers above when we add new AST nodes.
MEDIUMnewtests/tool_test_example/test.js31 // And here is how you can assert that a step introduces new flow errors. I
Example Usage Blocks2 hits · 3 pts
SeverityFileLineSnippet
LOWwebsite/tests/check_flow_examples.sh12# Usage:
LOWpackages/scripts/runOxidizedJestTests.sh12# Usage:
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippet
MEDIUMpackages/scripts/build.sh63 # Create a new file with .js.flow extension
Cross-Language Confusion1 hit · 2 pts
SeverityFileLineSnippet
HIGHsrc/hack_forked/test/unit/utils/to_lsp.py17 initialize {"initializationOptions":{},"processId":null,"rootPath":"/data/users/waleedk/test","capabilities":{}}
Overly Generic Function Names2 hits · 2 pts
SeverityFileLineSnippet
LOWtests/hook_syntax_compatibility/rules_of_hooks.js12declare function doSomething(): void
LOWtests/hook_syntax/rules_of_hooks.js12declare function doSomething(): void
Fake / Example Data2 hits · 2 pts
SeverityFileLineSnippet
LOWtests/custom_errors/imported.js21const emailTest1: Email = "user@example.com"; // OK
LOWtests/custom_errors/imported.js164 email: "user@example.com",