mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-06 17:34:25 +00:00
docs(linter): fix invalid code example in rule docs (#27645)
Found by: https://github.com/oxc-project/website/pull/1337 We need valid code example to satisfy `oxc_parser`, otherwise js-in-md code block does not get formatted.
This commit is contained in:
1 parent
6941b4ed45
commit
0aa41acd40
3 files changed
+8
-4
No files matched your search
@@ -36,10 +36,10 @@ declare_oxc_lint!(
|
||||
/// Examples of **incorrect** code for this rule:
|
||||
/// ```js
|
||||
/// export let count = 2
|
||||
/// export var count = 3
|
||||
/// export var total = 3
|
||||
///
|
||||
/// let count = 4
|
||||
/// export { count }
|
||||
/// let value = 4
|
||||
/// export { value }
|
||||
/// ```
|
||||
///
|
||||
/// Examples of **correct** code for this rule:
|
||||
|
||||
@@ -117,7 +117,7 @@ declare_oxc_lint!(
|
||||
/// myPromise().then(() => 4)
|
||||
/// myPromise().then(function() { return 4 })
|
||||
///
|
||||
/// myPromise().then(() => throw "err")
|
||||
/// myPromise().then(() => { throw "err" })
|
||||
/// myPromise().then(function() { throw "err" })
|
||||
/// ```
|
||||
///
|
||||
|
||||
@@ -90,7 +90,9 @@ declare_oxc_lint!(
|
||||
/// }
|
||||
/// return doBar;
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ```js
|
||||
/// function doFoo(foo) {
|
||||
/// const doBar = bar => {
|
||||
/// return bar === 'bar';
|
||||
@@ -107,7 +109,9 @@ declare_oxc_lint!(
|
||||
/// export function doFoo(foo) {
|
||||
/// return doBar;
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ```js
|
||||
/// export function doFoo(foo) {
|
||||
/// function doBar(bar) {
|
||||
/// return bar === 'bar' && foo.doBar(bar);
|
||||
|
||||
Reference in new issue
Block a user