You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(linter): Add configuration option docs for import/no-commonjs rule. (#15077)
Mostly just moving around the existing docs.
Part of #14743.
Generated docs:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### allowConditionalRequire
type: `boolean`
default: `true`
When set to `true`, allows conditional `require()` calls (e.g., inside `if` statements or try-catch blocks).
This is useful for places where you need to conditionally load via commonjs requires if ESM imports are not supported.
### allowPrimitiveModules
type: `boolean`
default: `false`
If `allowPrimitiveModules` option is set to true, the following is valid:
\```js
module.exports = "foo";
module.exports = function rule(context) {
return { /* ... */ };
};
\```
but this is still reported:
\```js
module.exports = { x: "y" };
exports.z = function bark() { /* ... */ };
\```
### allowRequire
type: `boolean`
default: `false`
If set to `true`, `require` calls are valid:
\```js
var mod = require("./mod");
\```
but `module.exports` is reported as usual.
```
0 commit comments