# no-sync

Rule `node/no-sync`. Disallow synchronous methods

- Source: node
- Technologies: Node.js
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1674 by reach

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
fs.existsSync(somePath);

function foo() {
  var contents = fs.readFileSync(somePath).toString();
}
```

```js
function foo() {
  var contents = fs.readFileSync(somePath).toString();
}

var bar = baz => fs.readFileSync(qux);
```

```js
fs.readdirSync(somePath);
```

### Correct: the rule accepts this

```js
obj.sync();

async(function() {
    // ...
});
```

```js
fs.readFileSync(somePath).toString();
```

```js
fs.readFileSync(somePath);
```

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-sync": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

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

### Biome: `biome.json`

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

## Related rules

- [eslint/no-sync](https://lintradar.dev/rules/eslint/no-sync.md): Disallow synchronous methods
- [node/no-process-env](https://lintradar.dev/rules/node/no-process-env.md): Disallow the use of `process.env`
- [node/prefer-process-get-builtin-module](https://lintradar.dev/rules/node/prefer-process-get-builtin-module.md): Enforce using `process.getBuiltinModule()` to load Node.js built-in modules
- [node/no-unpublished-bin](https://lintradar.dev/rules/node/no-unpublished-bin.md): Disallow `bin` files that npm ignores
- [node/file-extension-in-import](https://lintradar.dev/rules/node/file-extension-in-import.md): Enforce the style of file extensions in `import` declarations
- [node/no-top-level-await](https://lintradar.dev/rules/node/no-top-level-await.md): Disallow top-level `await` in published modules

---

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