Machine-specific path
Machine-specific path. A path from one person's machine (/Users/sam/). It breaks for everyone else.
This is how the comment reads inline, under the flagged line.
Why it matters
Absolute home paths work on the author's laptop and nowhere else, and they leak usernames into the repo.
What to do
Use a path relative to the repo, a config value, or os.homedir() / Path.home().
Examples
const data = "/Users/sam/project/data.json";
const data = path.join(root, "data.json");
What it catches
It reads a pattern on each line, aware of strings and comments. Languages: Any file. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
const p = "/Users/sam/code/a.json";
p = "/home/dev/data"
Left alone
const p = path.join(root, "a.json");
Research
Absolute home-directory paths (`/home/<user>/...`). They work on one machine only, and they leak usernames.
- no outside source yet
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"user-path"
],
"severity": {
"user-path": "low"
}
}
}