Home / File/ prod-error-codes-test.internal.js — react Source File

prod-error-codes-test.internal.js — react Source File

Architecture documentation for prod-error-codes-test.internal.js, a javascript file in the react codebase.

Entity Profile

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.
 *
 * @emails react-core
 */

'use strict';

const rule = require('../prod-error-codes');
const {RuleTester} = require('eslint');
const ruleTester = new RuleTester({
  parserOptions: {
    ecmaVersion: 2017,
  },
});

ruleTester.run('eslint-rules/prod-error-codes', rule, {
  valid: [
    'arbitraryFunction(a, b)',
    'Error(`Expected ${foo} target to be an array; got ${bar}`)',
    "Error('Expected ' + foo + ' target to be an array; got ' + bar)",
    'Error(`Expected ${foo} target to ` + `be an array; got ${bar}`)',
  ],
  invalid: [
    {
      code: "Error('Not in error map')",
      errors: [
        {
          message:
            'Error message does not have a corresponding production error ' +
            'code. Add the following message to codes.json so it can be stripped from ' +
            'the production builds:\n\n' +
            'Not in error map',
        },
      ],
    },
    {
      code: "Error('Not in ' + 'error map')",
      errors: [
        {
          message:
            'Error message does not have a corresponding production error ' +
            'code. Add the following message to codes.json so it can be stripped from ' +
            'the production builds:\n\n' +
            'Not in error map',
        },
      ],
    },
    {
      code: 'Error(`Not in ` + `error map`)',
      errors: [
        {
          message:
            'Error message does not have a corresponding production error ' +
            'code. Add the following message to codes.json so it can be stripped from ' +
            'the production builds:\n\n' +
            'Not in error map',
        },
      ],
    },
    {
      code: "Error(`Not in ${'error'} map`)",
      errors: [
        {
          message:
            'Error message does not have a corresponding production error ' +
            'code. Add the following message to codes.json so it can be stripped from ' +
            'the production builds:\n\n' +
            'Not in %s map',
        },
      ],
    },
  ],
});

Frequently Asked Questions

What does prod-error-codes-test.internal.js do?
prod-error-codes-test.internal.js is a source file in the react codebase, written in javascript.
Where is prod-error-codes-test.internal.js in the architecture?
prod-error-codes-test.internal.js is located at scripts/eslint-rules/__tests__/prod-error-codes-test.internal.js (directory: scripts/eslint-rules/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free