Import NextRules
no-commonjs
Prevents CommonJS require/module.exports
š¼ This rule is enabled in the following configs: recommended, typescript.
š” This rule is automatically fixable by the --fix CLI option.
Prevents CommonJS require/module.exports
Rule Details
This rule aims to prevent issues related to commonjs.
Options
[
{
"type": "object",
"properties": {
"allowRequire": {
"type": "boolean",
"default": false,
"description": "Allow require() calls."
},
"allowModuleExports": {
"type": "boolean",
"default": false,
"description": "Allow module.exports."
},
"allowExports": {
"type": "boolean",
"default": false,
"description": "Allow exports.* patterns."
},
"allowInFiles": {
"type": "array",
"items": {
"type": "string"
},
"description": "Allow CommonJS in specific files."
},
"suggestES6": {
"type": "boolean",
"default": true,
"description": "Suggest ES6 alternatives."
}
},
"additionalProperties": false
}
]Implementation
OWASP Foundation
- Category: A00:2021 - General Security