Skip to content

Commit 2195150

Browse files
committed
docs(linter): Update docs for no-optional-chaining rule to clarify its safety today (#16727)
The rule is safe to use nowadays, as all major browsers have supported it for over 5 years.
1 parent 853c20d commit 2195150

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

crates/oxc_linter/src/rules/oxc/no_optional_chaining.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,20 @@ impl std::ops::Deref for NoOptionalChaining {
4343
declare_oxc_lint!(
4444
/// ### What it does
4545
///
46-
/// Disallow [optional chaining](https://github.com/tc39/proposal-optional-chaining).
46+
/// Disallow [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining).
4747
///
4848
/// ### Why is this bad?
4949
///
50-
/// Optional chaining is a relatively new JavaScript feature that may not be
51-
/// supported in older environments. In some cases, transpiling optional
52-
/// chaining can result in verbose helper code that impacts bundle size or
53-
/// performance. This rule is useful when you need to maintain compatibility
54-
/// with older JavaScript targets or want to avoid the overhead of transpiled
55-
/// optional chaining.
50+
/// You may want to use this rule if you need to maintain compatibility with older environments.
51+
/// However, optional chaining has been supported in all major browsers since 2020 and is
52+
/// generally safe to use today.
53+
///
54+
/// In some cases, transpiling optional chaining can result in verbose helper code
55+
/// that impacts bundle size and performance. This rule is useful when you need to
56+
/// avoid the overhead of transpiled optional chaining. This is only relevant if you
57+
/// are polyfilling to support browsers from pre-2020.
58+
///
59+
/// In most codebases at this point, you should not use this rule.
5660
///
5761
/// ### Examples
5862
///

0 commit comments

Comments
 (0)