# no-path-concat

Rule `eslint/no-path-concat`. Disallow string concatenation with `__dirname` and `__filename`

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Deprecated: yes
- Reach: 11.2M weekly downloads of presets that enable it
- Trend: +2.6% last quarter
- Rank: #866 by reach, #1552 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-path-concat` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-path-concat) |

## Code examples

### Incorrect: the rule reports this

```js
var fullPath = __dirname + "/foo.js";

var fullPath = __filename + "/foo.js";
```

### Correct: the rule accepts this

```js
var fullPath = dirname + "/foo.js";
```

Examples from the ESLint documentation.

## Enable it

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

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [React Native](https://lintradar.dev/presets/react-native.md) | ESLint | `@react-native/eslint-config` | 79 | 1.2M | +5.8% |

## Related rules

- [node/no-path-concat](https://lintradar.dev/rules/node/no-path-concat.md): Disallow string concatenation with `__dirname`, `__filename`, and `import.meta` paths
- [eslint/no-console](https://lintradar.dev/rules/eslint/no-console.md): Disallow the use of `console`
- [eslint/no-shadow](https://lintradar.dev/rules/eslint/no-shadow.md): Disallow variable declarations from shadowing variables declared in the outer scope
- [eslint/no-empty-function](https://lintradar.dev/rules/eslint/no-empty-function.md): Disallow empty functions
- [eslint/no-nested-ternary](https://lintradar.dev/rules/eslint/no-nested-ternary.md): Disallow nested ternary expressions
- [eslint/max-classes-per-file](https://lintradar.dev/rules/eslint/max-classes-per-file.md): Enforce a maximum number of classes per file

---

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