Suppression.ts — react Source File
Architecture documentation for Suppression.ts, a typescript file in the react codebase. 10 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR f3160d78_61c2_0ad9_2d19_6daf9a63b386["Suppression.ts"] e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> e96f281e_f381_272d_2359_3e6a091c9a1d 0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042["CompilerDiagnostic"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> 0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042 e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> e51fd0d2_bb38_cc97_7763_efe37f300a47 9afe20b4_0a64_4dc2_7282_6f45a54697ed["CompilerSuggestionOperation"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> 9afe20b4_0a64_4dc2_7282_6f45a54697ed a2b91621_58d3_1d04_4663_00cd808f1034["ErrorCategory"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> a2b91621_58d3_1d04_4663_00cd808f1034 eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> eb9d33f9_42c1_205c_93e6_8e1365a31839 d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> d7fde76c_4fd9_feb3_299b_798689f05bc6 0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> 0423f759_97e0_9101_4634_ed555abc5ca9 102f7d62_f771_0080_dd43_d867f5a8bd55["core"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> 102f7d62_f771_0080_dd43_d867f5a8bd55 52e3d8d7_abf4_7343_1f98_3f701ec04082["types"] f3160d78_61c2_0ad9_2d19_6daf9a63b386 --> 52e3d8d7_abf4_7343_1f98_3f701ec04082 2a7e50cd_6171_085d_277c_6ced6ddd7148["Imports.ts"] 2a7e50cd_6171_085d_277c_6ced6ddd7148 --> f3160d78_61c2_0ad9_2d19_6daf9a63b386 9aa4477d_960b_1ea1_b6d9_36076aaa70bd["Program.ts"] 9aa4477d_960b_1ea1_b6d9_36076aaa70bd --> f3160d78_61c2_0ad9_2d19_6daf9a63b386 style f3160d78_61c2_0ad9_2d19_6daf9a63b386 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {NodePath} from '@babel/core';
import * as t from '@babel/types';
import {
CompilerDiagnostic,
CompilerError,
CompilerSuggestionOperation,
ErrorCategory,
} from '../CompilerError';
import {assertExhaustive} from '../Utils/utils';
import {GeneratedSource} from '../HIR';
/**
* Captures the start and end range of a pair of eslint-disable ... eslint-enable comments. In the
* case of a CommentLine or a relevant Flow suppression, both the disable and enable point to the
* same comment.
*
* The enable comment can be missing in the case where only a disable block is present, ie the rest
* of the file has potential React violations.
*/
export type SuppressionRange = {
disableComment: t.Comment;
enableComment: t.Comment | null;
source: SuppressionSource;
};
type SuppressionSource = 'Eslint' | 'Flow';
/**
* An suppression affects a function if:
* 1. The suppression is within the function's body; or
* 2. The suppression wraps the function
*/
export function filterSuppressionsThatAffectFunction(
suppressionRanges: Array<SuppressionRange>,
fn: NodePath<t.Function>,
): Array<SuppressionRange> {
const suppressionsInScope: Array<SuppressionRange> = [];
const fnNode = fn.node;
for (const suppressionRange of suppressionRanges) {
if (
suppressionRange.disableComment.start == null ||
fnNode.start == null ||
fnNode.end == null
) {
continue;
}
// The suppression is within the function
if (
suppressionRange.disableComment.start > fnNode.start &&
// If there is no matching enable, the rest of the file has potential violations
(suppressionRange.enableComment === null ||
(suppressionRange.enableComment.end != null &&
suppressionRange.enableComment.end < fnNode.end))
// ... (159 more lines)
Domain
Subdomains
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does Suppression.ts do?
Suppression.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in Suppression.ts?
Suppression.ts defines 3 function(s): filterSuppressionsThatAffectFunction, findProgramSuppressions, suppressionsToCompilerError.
What does Suppression.ts depend on?
Suppression.ts imports 10 module(s): CompilerDiagnostic, CompilerError, CompilerError.ts, CompilerSuggestionOperation, ErrorCategory, assertExhaustive, core, index.ts, and 2 more.
What files import Suppression.ts?
Suppression.ts is imported by 2 file(s): Imports.ts, Program.ts.
Where is Suppression.ts in the architecture?
Suppression.ts is located at compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Suppression.ts (domain: BabelCompiler, subdomain: Entrypoint, directory: compiler/packages/babel-plugin-react-compiler/src/Entrypoint).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free