Skip to content

Commit

Permalink
Clarify README regarding no-console rule in CLI preset (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahtallen committed Mar 22, 2024
1 parent aa9df6a commit e953aa5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -100,14 +100,20 @@ module.exports = {
};
```

If your project is not a CLI tool but calls `console` or `process` methods occasionally, you probably don't need this config. Instead, disable those rules only where necessary and include an explanation:
If your project is not a CLI tool but calls `process` methods occasionally, you probably don't need this config. Instead, disable those rules only where necessary and include an explanation:

```js
// Intentionally exiting because we have observed an unrecoverable error.
// eslint-disable-next-line no-process-exit
process.exit( 1 );
```

Note that `console.log` is still forbidden ([see here for an explanation](https://github.com/Automattic/eslint-config-wpvip/pull/198#issuecomment-2015322062)). If you're writing one-off Node scripts, you can disable the rule per file:

```js
/* eslint-disable no-console */
```

## JSDoc

JSDoc is considered optional, especially compared to better alternatives like TypeScript and OpenAPI documentation. If you want to enforce the use of JSDoc, use the `jsdoc` config:
Expand Down

0 comments on commit e953aa5

Please sign in to comment.