Home / File/ validateNoUseBeforeDefine.ts — react Source File

validateNoUseBeforeDefine.ts — react Source File

Architecture documentation for validateNoUseBeforeDefine.ts, a typescript file in the react codebase. 3 imports, 0 dependents.

File typescript TestingUtilities E2E 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  31852c9d_8c83_1f8e_95cd_6c7f2775ba56["validateNoUseBeforeDefine.ts"]
  a6eb0c11_a434_301e_3a6b_da11b7bc784e["../../../node_modules/eslint/lib/linter"]
  31852c9d_8c83_1f8e_95cd_6c7f2775ba56 --> a6eb0c11_a434_301e_3a6b_da11b7bc784e
  6ac54a3f_a69d_fd38_4990_8c55e48a4c31["index.ts"]
  31852c9d_8c83_1f8e_95cd_6c7f2775ba56 --> 6ac54a3f_a69d_fd38_4990_8c55e48a4c31
  b72be961_3018_1d4f_353a_fa5e3fae535f["hermes-eslint"]
  31852c9d_8c83_1f8e_95cd_6c7f2775ba56 --> b72be961_3018_1d4f_353a_fa5e3fae535f
  style 31852c9d_8c83_1f8e_95cd_6c7f2775ba56 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.
 */

// @ts-ignore-line
import {Linter} from '../../../node_modules/eslint/lib/linter';
// @ts-ignore-line
import * as HermesESLint from 'hermes-eslint';
// @ts-ignore-line
import {NoUseBeforeDefineRule} from '../..';

const ESLINT_CONFIG: Linter.Config = {
  parser: 'hermes-eslint',
  parserOptions: {
    sourceType: 'module',
  },
  rules: {
    'custom-no-use-before-define': [
      'error',
      {variables: false, functions: false},
    ],
  },
};

/**
 * Post-codegen pass to validate that the generated code does not introduce bugs.
 * Note that the compiler currently incorrectly reorders code in some cases: this
 * step detects this using ESLint's no-use-before-define rule at its strictest
 * setting.
 */
export default function validateNoUseBeforeDefine(
  source: string,
): Array<{line: number; column: number; message: string}> | null {
  const linter = new Linter();
  linter.defineParser('hermes-eslint', HermesESLint);
  linter.defineRule('custom-no-use-before-define', NoUseBeforeDefineRule);
  return linter.verify(source, ESLINT_CONFIG);
}

Subdomains

Dependencies

  • ../../../node_modules/eslint/lib/linter
  • hermes-eslint
  • index.ts

Frequently Asked Questions

What does validateNoUseBeforeDefine.ts do?
validateNoUseBeforeDefine.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, E2E subdomain.
What functions are defined in validateNoUseBeforeDefine.ts?
validateNoUseBeforeDefine.ts defines 1 function(s): validateNoUseBeforeDefine.
What does validateNoUseBeforeDefine.ts depend on?
validateNoUseBeforeDefine.ts imports 3 module(s): ../../../node_modules/eslint/lib/linter, hermes-eslint, index.ts.
Where is validateNoUseBeforeDefine.ts in the architecture?
validateNoUseBeforeDefine.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/test-utils/validateNoUseBeforeDefine.ts (domain: TestingUtilities, subdomain: E2E, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/test-utils).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free