compiler/.eslintrc.js JAVASCRIPT 107 lines View on github.com → Search inside
1/**2 * Copyright (c) Meta Platforms, Inc. and affiliates.3 *4 * This source code is licensed under the MIT license found in the5 * LICENSE file in the root directory of this source tree.6 */78/**9 * Our philosophy for linting is that lints should be very high-signal:10 * - Error, don't warn. If it's worth mentioning it's worth fixing.11 * - Enable rules that consistently identify real problems. If we frequently would have to12 *   disable the rule due to false positives, it isn't high-signal.13 * - Enable rules that help improve consistent style (to avoid code review about style rather14 *   than substance).15 */16module.exports = {17  extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],18  rules: {19    /*20     * We prefer using const where variables are not reassigned, but occassional mistakes21     * aren't a major issue22     */23    "prefer-const": "off",2425    // Not valuable enough to enable26    "no-useless-escape": "off",2728    /*29     * There are valid use cases for loops with constant conditions where the body contains the30     * break31     */32    "no-constant-condition": "off",3334    // eslint only knows about builtin control flow (eg throw, return, break) and not custom ones35    // like invariant.36    "no-fallthrough": "off",3738    /*39     * Low-value: this fires even for declarations that capture references which wouldn't be as40     * obvious if the declaration was lifted to the parent root41     */42    "no-inner-declarations": "off",4344    "multiline-comment-style": ["error", "starred-block"],4546    /**47     * We sometimes need to check for control characters in regexes for things like preserving input48     * strings49     */50    "no-control-regex": "off",5152    "@typescript-eslint/no-empty-function": "off",5354    /*55     * Explicitly casting to/through any is sometimes required, often for error messages to56     * assertExhaustive()57     */58    "@typescript-eslint/no-explicit-any": "off",5960    /*61     * We use non-null assertions carefully. Ideally, there would be a TS option to codegen62     * a non-null check at the assertion site.63     */64    "@typescript-eslint/no-non-null-assertion": "off",6566    // Being explicit provides value in cases where inference may later change67    "@typescript-eslint/no-inferrable-types": "off",68    "@typescript-eslint/explicit-function-return-type": "error",6970    /*71     * Unused variables are frequently a bug. Prefix unused variables with an _ to fix, but note72     * that eslint won't warn you that an underscore prefixed variable is used and that the prefix73     * should be dropped.74     */75    "@typescript-eslint/no-unused-vars": [76      "error",77      {78        argsIgnorePattern: "^_",79        varsIgnorePattern: "^_",80        caughtErrorsIgnorePattern: "^_",81      },82    ],8384    // Consider enabling for consistency. Ideally violations could be auto-fixed.85    "@typescript-eslint/consistent-generic-constructors": [86      "off",87      "constructor",88    ],89    "@typescript-eslint/array-type": ["error", { default: "generic" }],90    "@typescript-eslint/triple-slash-reference": "off",91    "@typescript-eslint/no-var-requires": "off",92  },93  parser: "@typescript-eslint/parser",94  plugins: ["@typescript-eslint"],95  root: true,96  ignorePatterns: ["**/__tests__/**/*", "**/*.d.ts", "**/dist/**/*"],97  env: {98    node: true,99  },100  /*101   * If rules need to be disabled then the rule is insufficiently high signal102   * and should be diasbled altogether or customized (in either case via a standalone PR)103   */104  noInlineConfig: true,105  reportUnusedDisableDirectives: true,106};

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.