# no-path-concat

Rule `node/no-path-concat`. Disallow string concatenation with `__dirname`, `__filename`, and `import.meta` paths

- Source: node
- Technologies: Node.js
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 35.3M weekly downloads of presets that enable it
- Trend: +89.6% last quarter
- Rank: #455 by reach, #292 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `n/no-path-concat` | no | no | package `eslint-plugin-n` | [docs](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-path-concat.md) |
| Oxlint | `node/no-path-concat` | no | no | plugin `node`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/node/no-path-concat.html) |
| Biome | `nursery/noPathConcat` | yes | no | group nursery, since 2.6.3 | [docs](https://biomejs.dev/linter/rules/no-path-concat/) |

## Code examples

### Incorrect: the rule reports this

```js
const fullPath1 = __dirname + "/foo.js";
const fullPath2 = __filename + "/foo.js";
const fullPath3 = `${__dirname}/foo.js`;
const fullPath4 = `${__filename}/foo.js`;
const fullPath5 = import.meta.dirname + "/foo.js";
const fullPath6 = import.meta.filename + "/foo.js";
const fullUrl = import.meta.url + "/foo.js";
```

### Correct: the rule accepts this

```js
const fullPath1 = path.join(__dirname, "foo.js");
const fullPath2 = path.join(__filename, "foo.js");
const fullPath3 = __dirname + ".js";
const fullPath4 = __filename + ".map";
const fullPath5 = `${__dirname}_foo.js`;
const fullPath6 = `${__filename}.test.js`;
const fullPath7 = path.join(import.meta.dirname, "foo.js");
const fullPath8 = path.join(import.meta.filename, "foo.js");
const fullUrl = new URL("./foo.js", import.meta.url);
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import n from "eslint-plugin-n";

export default [
  {
    plugins: { n },
    rules: {
      "n/no-path-concat": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "node"
  ],
  "rules": {
    "node/no-path-concat": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noPathConcat": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [neostandard](https://lintradar.dev/presets/neostandard.md) | ESLint | `neostandard` | 95 | 317.6K | +50.2% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [eslint/no-path-concat](https://lintradar.dev/rules/eslint/no-path-concat.md): Disallow string concatenation with `__dirname` and `__filename`
- [node/no-exports-assign](https://lintradar.dev/rules/node/no-exports-assign.md): Disallow the assignment to `exports`
- [node/no-deprecated-api](https://lintradar.dev/rules/node/no-deprecated-api.md): Disallow deprecated APIs
- [node/process-exit-as-throw](https://lintradar.dev/rules/node/process-exit-as-throw.md): Require that `process.exit()` expressions use the same code path as `throw`
- [node/no-extraneous-import](https://lintradar.dev/rules/node/no-extraneous-import.md): Disallow `import` declarations which import extraneous modules
- [node/no-process-exit](https://lintradar.dev/rules/node/no-process-exit.md): Disallow the use of `process.exit()`

---

Web page: https://lintradar.dev/rules/node/no-path-concat. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
