mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
docs(linter/consistent-function-scoping): improve rule documentation (#5015)
This commit is contained in:
parent
79c2493223
commit
cd9f1cd278
2 changed files with 521 additions and 662 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,54 +1,9 @@
|
|||
---
|
||||
source: crates/oxc_linter/src/tester.rs
|
||||
---
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:4:34]
|
||||
3 │ {
|
||||
4 │ function doBar(bar) {
|
||||
· ─────
|
||||
5 │ return bar;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function doFoo(FooComponent) {
|
||||
3 │ function Bar() {
|
||||
· ───
|
||||
4 │ return <FooComponent />;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function Foo() {
|
||||
3 │ function Bar () {
|
||||
· ───
|
||||
4 │ return <div />
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function foo() {
|
||||
3 │ function bar() {
|
||||
· ───
|
||||
4 │ return <JSX/>;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:27]
|
||||
2 │ function doFoo(Foo) {
|
||||
3 │ const doBar = () => arguments;
|
||||
· ─────
|
||||
4 │ return doBar();
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function doFoo(foo) {
|
||||
2 │ {
|
||||
3 │ function doBar(bar) {
|
||||
· ─────
|
||||
4 │ return bar;
|
||||
|
|
@ -56,11 +11,52 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:4:30]
|
||||
3 │ const foo = 'foo';
|
||||
4 │ function doBar(bar) {
|
||||
· ─────
|
||||
5 │ return bar;
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ function doFoo(FooComponent) {
|
||||
2 │ function Bar() {
|
||||
· ───
|
||||
3 │ return <FooComponent />;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ function Foo() {
|
||||
2 │ function Bar () {
|
||||
· ───
|
||||
3 │ return <div />
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:1:27]
|
||||
1 │ function foo() { function bar() { return <JSX/>; } }
|
||||
· ───
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:1:29]
|
||||
1 │ function doFoo(Foo) { const doBar = () => arguments; return doBar(); };
|
||||
· ─────
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ function doFoo(foo) {
|
||||
2 │ function doBar(bar) {
|
||||
· ─────
|
||||
3 │ return bar;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:26]
|
||||
2 │ const foo = 'foo';
|
||||
3 │ function doBar(bar) {
|
||||
· ─────
|
||||
4 │ return bar;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
|
|
@ -79,11 +75,11 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:35]
|
||||
2 │ const doFoo = function() {
|
||||
3 │ const doBar = function(bar) {
|
||||
· ────────
|
||||
4 │ return bar;
|
||||
╭─[consistent_function_scoping.tsx:2:31]
|
||||
1 │ const doFoo = function() {
|
||||
2 │ const doBar = function(bar) {
|
||||
· ────────
|
||||
3 │ return bar;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
|
|
@ -109,11 +105,9 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function doFoo(Foo) {
|
||||
3 │ function doBar() {
|
||||
· ─────
|
||||
4 │ return this;
|
||||
╭─[consistent_function_scoping.tsx:1:32]
|
||||
1 │ function doFoo(Foo) { function doBar() { return this; } return doBar(); };
|
||||
· ─────
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
|
|
@ -125,47 +119,47 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:27]
|
||||
2 │ function doFoo(Foo) {
|
||||
3 │ const doBar = () => (function() {return () => this})();
|
||||
· ─────
|
||||
4 │ return doBar();
|
||||
╭─[consistent_function_scoping.tsx:2:23]
|
||||
1 │ function doFoo(Foo) {
|
||||
2 │ const doBar = () => (function() {return () => this})();
|
||||
· ─────
|
||||
3 │ return doBar();
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function doFoo(Foo) {
|
||||
3 │ function doBar() {
|
||||
· ─────
|
||||
4 │ return arguments;
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ function doFoo(Foo) {
|
||||
2 │ function doBar() {
|
||||
· ─────
|
||||
3 │ return arguments;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:27]
|
||||
2 │ function doFoo(Foo) {
|
||||
3 │ const doBar = () => (function() {return arguments})();
|
||||
· ─────
|
||||
4 │ return doBar();
|
||||
╭─[consistent_function_scoping.tsx:2:23]
|
||||
1 │ function doFoo(Foo) {
|
||||
2 │ const doBar = () => (function() {return arguments})();
|
||||
· ─────
|
||||
3 │ return doBar();
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function doFoo(foo) {
|
||||
3 │ function doBar(bar) {
|
||||
· ─────
|
||||
4 │ return doBar(bar);
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ function doFoo(foo) {
|
||||
2 │ function doBar(bar) {
|
||||
· ─────
|
||||
3 │ return doBar(bar);
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function doFoo(foo) {
|
||||
3 │ function doBar(bar) {
|
||||
· ─────
|
||||
4 │ return bar;
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ function doFoo(foo) {
|
||||
2 │ function doBar(bar) {
|
||||
· ─────
|
||||
3 │ return bar;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
|
|
@ -177,20 +171,16 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:5:38]
|
||||
4 │ {
|
||||
5 │ function doBar(bar) {
|
||||
· ─────
|
||||
6 │ return bar;
|
||||
╭─[consistent_function_scoping.tsx:1:36]
|
||||
1 │ function doFoo(foo) { { { function doBar(bar) { return bar; } } } return foo; }
|
||||
· ─────
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:4:34]
|
||||
3 │ {
|
||||
4 │ function doBar(bar) {
|
||||
· ─────
|
||||
5 │ return bar;
|
||||
╭─[consistent_function_scoping.tsx:1:14]
|
||||
1 │ { { function doBar(bar) { return bar; } } }
|
||||
· ─────
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
|
|
@ -251,101 +241,101 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:4:34]
|
||||
3 │ function foo() {
|
||||
4 │ function bar() {
|
||||
· ───
|
||||
5 │ }
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:4:34]
|
||||
3 │ function foo() {
|
||||
4 │ function bar() {
|
||||
· ───
|
||||
5 │ }
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function foo() {
|
||||
3 │ function bar() {
|
||||
· ───
|
||||
4 │ }
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ process.nextTick(() => {
|
||||
3 │ function returnsZero() {
|
||||
· ───────────
|
||||
4 │ return true;
|
||||
2 │ function foo() {
|
||||
3 │ function bar() {
|
||||
· ───
|
||||
4 │ }
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:5:34]
|
||||
4 │ function() {
|
||||
5 │ function bar() {
|
||||
· ───
|
||||
6 │ }
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ process.nextTick(() => {
|
||||
2 │ function returnsZero() {
|
||||
· ───────────
|
||||
3 │ return true;
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:9:34]
|
||||
8 │ function() {
|
||||
9 │ function baz() {
|
||||
· ───
|
||||
10 │ }
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:4:30]
|
||||
3 │ const Bar = <div />
|
||||
4 │ function doBaz() {
|
||||
· ─────
|
||||
5 │ return 42
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:30]
|
||||
2 │ function Foo() {
|
||||
3 │ function Bar () {
|
||||
3 │ function() {
|
||||
4 │ function bar() {
|
||||
· ───
|
||||
4 │ return <div />
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:6:30]
|
||||
5 │ }
|
||||
6 │ function doBaz() {
|
||||
· ─────
|
||||
7 │ return 42
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:6:30]
|
||||
5 │ }
|
||||
6 │ function b() {}
|
||||
· ─
|
||||
7 │ function c() {}
|
||||
╭─[consistent_function_scoping.tsx:8:30]
|
||||
7 │ function() {
|
||||
8 │ function baz() {
|
||||
· ───
|
||||
9 │ }
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:7:30]
|
||||
6 │ function b() {}
|
||||
7 │ function c() {}
|
||||
· ─
|
||||
8 │ }
|
||||
╭─[consistent_function_scoping.tsx:3:26]
|
||||
2 │ const Bar = <div />
|
||||
3 │ function doBaz() {
|
||||
· ─────
|
||||
4 │ return 42
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:10:30]
|
||||
9 │ function fn2() {
|
||||
10 │ function foo() {}
|
||||
· ───
|
||||
11 │ }
|
||||
╭─[consistent_function_scoping.tsx:2:26]
|
||||
1 │ function Foo() {
|
||||
2 │ function Bar () {
|
||||
· ───
|
||||
3 │ return <div />
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:5:26]
|
||||
4 │ }
|
||||
5 │ function doBaz() {
|
||||
· ─────
|
||||
6 │ return 42
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:5:26]
|
||||
4 │ }
|
||||
5 │ function b() {}
|
||||
· ─
|
||||
6 │ function c() {}
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:6:26]
|
||||
5 │ function b() {}
|
||||
6 │ function c() {}
|
||||
· ─
|
||||
7 │ }
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:9:26]
|
||||
8 │ function fn2() {
|
||||
9 │ function foo() {}
|
||||
· ───
|
||||
10 │ }
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
||||
|
|
@ -399,10 +389,8 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Move this function to the outer scope.
|
||||
|
||||
⚠ eslint-plugin-unicorn(consistent-function-scoping): Function does not capture any variables from the outer scope.
|
||||
╭─[consistent_function_scoping.tsx:3:35]
|
||||
2 │ function doFoo() {
|
||||
3 │ const doBar = function(bar) {
|
||||
· ────────
|
||||
4 │ return bar;
|
||||
╭─[consistent_function_scoping.tsx:1:34]
|
||||
1 │ function doFoo() { const doBar = function(bar) { return bar; }; }
|
||||
· ────────
|
||||
╰────
|
||||
help: Move this function to the outer scope.
|
||||
|
|
|
|||
Loading…
Reference in a new issue