Skip to content

Commit 51b3575

Browse files
Merge pull request #45 from jyotiprakashmfsi/docs/no-build-env-in-source-check-return-values
fix: fix docs for check-return-values
2 parents df4b0fa + 794abbb commit 51b3575

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

docs-docusaurus/docs/node.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default [
107107
maxAwaitExpressions: 3,
108108
},
109109
],
110-
'hub/check-return-values': ['warn', { requireExplicitIgnore: true }],
110+
'hub/check-return-values': ['warn'],
111111
'hub/no-build-env-in-source': [
112112
'warn',
113113
{
@@ -2617,19 +2617,12 @@ async function handleData(rawData) {
26172617
26182618
**Rationale**: Neglecting to check or use the return value of a function can lead to silent failures or missed opportunities to act on critical information. For instance, a function that updates a database might return a success/failure status; ignoring this status means the application might proceed unaware of an error. This rule encourages developers to be deliberate about function outcomes, improving code robustness and reliability.
26192619
2620-
**Options**: The rule accepts a single object with the following property:
2621-
2622-
#### `requireExplicitIgnore`
2623-
2624-
- **Type**: `boolean`
2625-
- **Description**: If true (default), any function call whose return value is not used must be explicitly marked as ignored (e.g., void func();, \_ = func();, or via a comment // return value intentionally ignored). If false, function calls whose return values are not used will not be flagged, effectively disabling the core check of this rule for explicit ignores.
2626-
- **Default**: `true`
26272620
- **Example Usage**:
26282621
26292622
```javascript
26302623
{
26312624
"rules": {
2632-
"hub/check-return-values": ["warn", { "requireExplicitIgnore": false }]
2625+
"hub/check-return-values": ["warn"]
26332626
}
26342627
}
26352628
```
@@ -2644,13 +2637,7 @@ export default [
26442637
{
26452638
plugins: { hub: hub },
26462639
rules: {
2647-
'hub/check-return-values': [
2648-
'error',
2649-
{
2650-
// Using "error" severity
2651-
requireExplicitIgnore: true,
2652-
},
2653-
],
2640+
'hub/check-return-values': ['error'],
26542641
// ... other rules
26552642
},
26562643
},
@@ -2707,25 +2694,6 @@ function doSomething() {
27072694
doSomething(); // Value not used
27082695
```
27092696
2710-
#### Scenario 2: requireExplicitIgnore: false
2711-
2712-
`"hub/check-return-values": ["warn", { "requireExplicitIgnore": false }]`
2713-
2714-
#### ✅ Valid:
2715-
2716-
```javascript
2717-
function doSomething() {
2718-
return true;
2719-
}
2720-
doSomething(); // OK, explicit ignore not required
2721-
2722-
const result = doSomething(); // Still OK (value used)
2723-
2724-
console.warn('Warning message'); // Still OK, console calls are exempt
2725-
```
2726-
2727-
**Note**: When requireExplicitIgnore is false, the rule becomes much less strict. Its primary utility is when requireExplicitIgnore is true, encouraging deliberate handling or acknowledgment of all function return values.
2728-
27292697
### 11. no-build-env-in-source
27302698
27312699
**Description**: Discourages direct conditional branching (i.e., if statements) on process.env variables that are typically set or controlled by the build process or deployment environment (e.g., NODE_ENV, DEBUG). This rule promotes centralizing environment-specific logic into dedicated configuration modules or using runtime flags, leading to cleaner, more testable, and maintainable code.

0 commit comments

Comments
 (0)