Back to all reviewers

Use absolute paths

microsoft/typescript
Based on 2 comments
Other

When specifying file paths in configuration files (like ESLint or TypeScript configs), use absolute paths rather than relative paths to avoid path resolution issues. Tools may interpret relative paths differently based on their internal working directory, leading to unexpected behavior.

Configurations Other

Reviewer Prompt

When specifying file paths in configuration files (like ESLint or TypeScript configs), use absolute paths rather than relative paths to avoid path resolution issues. Tools may interpret relative paths differently based on their internal working directory, leading to unexpected behavior.

Example:

// Problematic - using relative paths
parserOptions: {
  projectService: true,
  defaultProject: "./scripts/tsconfig.json",
}

// Better - using absolute paths
parserOptions: {
  tsconfigRootDir: __dirname,
  projectService: {
    defaultProject: path.join(__dirname, "scripts", "tsconfig.json"),
  }
}

This practice prevents issues like the one observed where a tool internally calls getParsedCommandLineOfConfigFile with a relative path, but then sets the current working directory incorrectly, causing the wrong file to be loaded.

2
Comments Analyzed
Other
Primary Language
Configurations
Category

Source Discussions