From b301ccdfb95aa8fb63fa86f017f20df66e5c95d1 Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Wed, 10 Jan 2024 10:00:27 +0530 Subject: [PATCH 1/5] docs: migration guide entry for no-inner-declarations --- docs/src/use/migrate-to-9.0.0.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/src/use/migrate-to-9.0.0.md b/docs/src/use/migrate-to-9.0.0.md index ba4e0ae81a3..f1dbd7f530b 100644 --- a/docs/src/use/migrate-to-9.0.0.md +++ b/docs/src/use/migrate-to-9.0.0.md @@ -31,6 +31,7 @@ The lists below are ordered roughly by the number of users each change is expect * [Case-sensitive flags in `no-invalid-regexp`](#no-invalid-regexp) * [`varsIgnorePattern` option of `no-unused-vars` no longer applies to catch arguments](#vars-ignore-pattern) * [`"eslint:recommended"` and `"eslint:all"` strings no longer accepted in flat config](#string-config) +* [`no-inner-declarations` has a new default behavior with a new option](#no-inner-declarations) ### Breaking changes for plugin developers @@ -308,6 +309,21 @@ export default [ **Related issue(s):** [#17488](https://github.com/eslint/eslint/issues/17488) +## `no-inner-declarations` has a new default behavior with a new option + +ESLint v9.0.0, Introduced a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allow block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. + +```js +/*eslint no-inner-declarations: "error"*/ +"use strict"; + +if (test) { + function foo () { } // no error +} +``` + +**Related issue(s):** [#15576](https://github.com/eslint/eslint/issues/15576) + ## Removed multiple `context` methods ESLint v9.0.0 removes multiple deprecated methods from the `context` object and moves them onto the `SourceCode` object: From 1a7586764c88c49339493ea4e4db311ee140f07f Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Wed, 10 Jan 2024 10:22:21 +0530 Subject: [PATCH 2/5] fix punctuation --- docs/src/use/migrate-to-9.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/use/migrate-to-9.0.0.md b/docs/src/use/migrate-to-9.0.0.md index f1dbd7f530b..55e0ae8d301 100644 --- a/docs/src/use/migrate-to-9.0.0.md +++ b/docs/src/use/migrate-to-9.0.0.md @@ -311,7 +311,7 @@ export default [ ## `no-inner-declarations` has a new default behavior with a new option -ESLint v9.0.0, Introduced a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allow block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. +ESLint v9.0.0 Introduces a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allow block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. ```js /*eslint no-inner-declarations: "error"*/ From 5b88e0d0c7f30eb848a346102810a14fe37096ee Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Wed, 10 Jan 2024 10:24:17 +0530 Subject: [PATCH 3/5] minor fix --- docs/src/use/migrate-to-9.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/use/migrate-to-9.0.0.md b/docs/src/use/migrate-to-9.0.0.md index 55e0ae8d301..7d5d0a8fa06 100644 --- a/docs/src/use/migrate-to-9.0.0.md +++ b/docs/src/use/migrate-to-9.0.0.md @@ -311,7 +311,7 @@ export default [ ## `no-inner-declarations` has a new default behavior with a new option -ESLint v9.0.0 Introduces a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allow block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. +ESLint v9.0.0 introduces a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allow block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. ```js /*eslint no-inner-declarations: "error"*/ From bb224dfde0553a92efde12d7c9a0e6a3dba73035 Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Wed, 10 Jan 2024 11:12:20 +0530 Subject: [PATCH 4/5] minor fix --- docs/src/use/migrate-to-9.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/use/migrate-to-9.0.0.md b/docs/src/use/migrate-to-9.0.0.md index 7d5d0a8fa06..590f2ea6af1 100644 --- a/docs/src/use/migrate-to-9.0.0.md +++ b/docs/src/use/migrate-to-9.0.0.md @@ -311,7 +311,7 @@ export default [ ## `no-inner-declarations` has a new default behavior with a new option -ESLint v9.0.0 introduces a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allow block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. +ESLint v9.0.0 introduces a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allows block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. ```js /*eslint no-inner-declarations: "error"*/ From aa7566940f1fa015b09d9a26305b006bf4822270 Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Thu, 11 Jan 2024 13:18:59 +0530 Subject: [PATCH 5/5] docs: add To adress section --- docs/src/use/migrate-to-9.0.0.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/src/use/migrate-to-9.0.0.md b/docs/src/use/migrate-to-9.0.0.md index 590f2ea6af1..3f01a54295c 100644 --- a/docs/src/use/migrate-to-9.0.0.md +++ b/docs/src/use/migrate-to-9.0.0.md @@ -311,7 +311,7 @@ export default [ ## `no-inner-declarations` has a new default behavior with a new option -ESLint v9.0.0 introduces a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allows block-level `functions` in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. +ESLint v9.0.0 introduces a new option in `no-inner-declarations` rule called `blockScopeFunctions` which by default allows block-level `function`s in strict mode when `languageOptions.ecmaVersion` is set to `2015` or above. ```js /*eslint no-inner-declarations: "error"*/ @@ -322,6 +322,8 @@ if (test) { } ``` +**To address:** If you want to report the block-level `function`s in every condition regardless of strict or non-strict mode, set the `blockScopeFunctions` option to `"disallow"`. + **Related issue(s):** [#15576](https://github.com/eslint/eslint/issues/15576) ## Removed multiple `context` methods