READ-ONLY PACKAGE PREVIEW

astro-developer/repository-context/biome.jsonc

Version 28e74103fe3d.bb1 · MIT. This preview displays packaged text and does not execute code. Treat the contents as untrusted instructions.

← Return to resource and package checksum

{
  "$schema": "https://biomejs.dev/schemas/2.5.3/schema.json",
  "files": {
    "includes": [
      "**",
      "!**/vendor",
      "!!**/smoke",
      "!!**/fixtures",
      "!!**/fixture",
      "!!**/_temp-fixtures",
      "!!**/dist",
      "packages/language-tools/vscode/syntaxes/*.json",
      "!!**/.vscode-test",
      "!!benchmark/static-projects"
    ]
  },
  "vcs": {
    "enabled": true,
    "clientKind": "git",
    "useIgnoreFile": true
  },
  "formatter": {
    "indentStyle": "tab",
    "indentWidth": 2,
    "lineWidth": 100,
    "includes": ["**", "!**/.changeset", "!**/pnpm-lock.yaml", "!**/*.astro"],
    "expand": "auto"
  },
  "assist": {
    "actions": {
      "source": {
        "organizeImports": "off"
      }
    }
  },
  "linter": {
    "enabled": true,

    "domains": {
      "test": "recommended"
    },
    "rules": {
      "preset": "none",
      "style": {
        "useNodejsImportProtocol": "error",
        // Enforce separate type imports for type-only imports to avoid bundling unneeded code
        "useImportType": "error",
        "useExportType": "error",
        "useNumberNamespace": "warn",
        "noInferrableTypes": "error"
      },
      "suspicious": {
        // This one is specific to catch `console.log`. The rest of logs are permitted
        "noConsole": {
          "level": "warn",
          "options": {
            "allow": ["error", "warn", "info", "debug"]
          }
        },
        "noVar": "error",
        "noDoubleEquals": "error",
        "noDebugger": "error",
        "noDuplicateCase": "error",
        "noExplicitAny": "off",
        // To enable later
        "noImplicitAnyLet": "off",
        "noSparseArray": "error"
      },
      "correctness": {
        "noUnusedVariables": {
          "level": "error",
          "options": {
            "ignoreRestSiblings": true
          }
        },
        "noUnusedFunctionParameters": "error",
        "noUnusedImports": "error",
        "noUnreachable": "error",
        "noConstantCondition": "warn",
        "noConstructorReturn": "error",
        "noEmptyPattern": "error"
      },
      "complexity": {
        // There are many violations which require manual check
        "noForEach": "off",
        "noUselessFragments": "warn",
        "useFlatMap": "warn",
        // To enable later, as there are many warnings
        "useOptionalChain": "off"
      },
      "performance": {
        "noAccumulatingSpread": "warn"
      }
    }
  },
  "javascript": {
    "formatter": {
      "trailingCommas": "all",
      "quoteStyle": "single",
      "semicolons": "always"
    }
  },
  "json": {
    "parser": {
      "allowComments": true,
      "allowTrailingCommas": true
    },
    "formatter": {
      "indentStyle": "space",
      "trailingCommas": "none"
    }
  },
  "overrides": [
    {
      // Workaround to format files like npm does
      "includes": ["**/package.json"],
      "json": {
        "formatter": {
          "expand": "always"
        }
      }
    },
    {
      "includes": ["**/*.astro", "**/*.vue", "**/*.svelte"],
      "formatter": {
        "enabled": false
      },
      "linter": {
        "rules": {
          "correctness": {
            "noUnusedVariables": "off",
            "noUnusedImports": "off"
          }
        }
      }
    },
    {
      // We don't want to have node modules in code that should be runtime agnostic
      "includes": [
        "**/packages/astro/src/**/runtime/**/*.ts",
        "**/packages/astro/src/**/*runtime*.ts"
      ],
      "linter": {
        "rules": {
          "correctness": {
            "noNodejsModules": "error"
          }
        }
      }
    },
    {
      "includes": ["packages/astro/src/**"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["astro/_internal", "astro/_internal/**"],
                    "message": "Internal Astro entrypoints are only available to workspace tests and cannot be imported by production source code."
                  }
                ]
              }
            }
          }
        }
      }
    },
    {
      "includes": ["**/*.astro", "**/client.d.ts", "**/jsx-runtime.d.ts"],
      "linter": {
        "rules": {
          "correctness": {
            "noUnusedVariables": "off",
            "noUnusedImports": "off"
          }
        }
      }
    },
    {
      "includes": ["**/packages/integrations/**/*.ts"],
      "linter": {
        "rules": {
          "suspicious": {
            "noConsole": {
              "level": "error",
              "options": {
                "allow": ["warn", "error", "info", "debug"]
              }
            }
          }
        }
      }
    },
    {
      "includes": [
        "**/benchmark/**/*.js",
        "**/packages/astro/src/cli/**/*.ts",
        "**/packages/astro/bin/**/*.mjs"
      ],
      "linter": {
        "rules": {
          "suspicious": {
            "noConsole": "off"
          }
        }
      }
    },
    {
      "includes": ["**/astro/test/**"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["**/src/**"],
                    "message": "The test should not import the source code. Import the code from the dist/ folder instead."
                  }
                ]
              }
            }
          }
        }
      }
    }
  ]
}