# no-absolute-paths 📝 Disallow absolute paths in path fields. 💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/sindresorhus/eslint-package-json#configs). 💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). Path fields in `package.json` must be relative to the package. An absolute path (a POSIX root like `/Users/me/lib/index.js` or a Windows drive like `C:/lib/index.js`) only exists on the author's machine and breaks for everyone else. This rule flags absolute paths in path fields (`main`, `module`, `browser`, `types`, `typings`, `bin`, `files`, and `exports`/`imports` targets). URLs are ignored. A leading `/` in `files` is the one exception. That entry is a pattern rather than a path to resolve, and npm strips the slash and matches from the package root, so `"/dist"` publishes exactly what `"dist"` does. The slash is redundant rather than broken, so it gets its own message and a suggestion to drop it. A Windows drive in `files` is stripped by nothing and is still reported as an absolute path. ## Examples ```json // ❌ { "main": "/Users/me/project/index.js" } ``` ```json // ✅ { "main": "./index.js" } ``` ```json // ❌ — the slash is redundant; `files` patterns already start at the package root. { "files": [ "/dist" ] } ``` ```json // ✅ { "files": [ "dist" ] } ```