From 44b5c29d60beedbca66365775e2736b6ff234677 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Mon, 3 Jun 2024 22:12:57 +0200 Subject: [PATCH] refactor(noEvolvingAny): rename into noEvolvingTypes (#2959) --- CHANGELOG.md | 4 +- ...orts_diagnostics_github_check_command.snap | 16 -- ...reports_diagnostics_github_ci_command.snap | 16 -- ...ports_diagnostics_github_lint_command.snap | 16 -- ...ports_diagnostics_junit_check_command.snap | 22 +-- .../reports_diagnostics_junit_ci_command.snap | 22 +-- ...eports_diagnostics_junit_lint_command.snap | 22 +-- ...rts_diagnostics_summary_check_command.snap | 4 +- ...eports_diagnostics_summary_ci_command.snap | 4 +- ...orts_diagnostics_summary_lint_command.snap | 4 +- .../biome_configuration/src/linter/rules.rs | 14 +- .../src/categories.rs | 2 +- crates/biome_js_analyze/src/lint/nursery.rs | 4 +- ...o_evolving_any.rs => no_evolving_types.rs} | 19 +- crates/biome_js_analyze/src/options.rs | 4 +- .../nursery/noEvolvingAny/invalid.ts.snap | 176 ------------------ .../invalid.ts | 0 .../nursery/noEvolvingTypes/invalid.ts.snap | 176 ++++++++++++++++++ .../valid.ts | 0 .../valid.ts.snap | 0 .../@biomejs/backend-jsonrpc/src/workspace.ts | 4 +- .../@biomejs/biome/configuration_schema.json | 2 +- 22 files changed, 214 insertions(+), 317 deletions(-) rename crates/biome_js_analyze/src/lint/nursery/{no_evolving_any.rs => no_evolving_types.rs} (83%) delete mode 100644 crates/biome_js_analyze/tests/specs/nursery/noEvolvingAny/invalid.ts.snap rename crates/biome_js_analyze/tests/specs/nursery/{noEvolvingAny => noEvolvingTypes}/invalid.ts (100%) create mode 100644 crates/biome_js_analyze/tests/specs/nursery/noEvolvingTypes/invalid.ts.snap rename crates/biome_js_analyze/tests/specs/nursery/{noEvolvingAny => noEvolvingTypes}/valid.ts (100%) rename crates/biome_js_analyze/tests/specs/nursery/{noEvolvingAny => noEvolvingTypes}/valid.ts.snap (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d446ca97445..d0f083b9f5d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -363,6 +363,8 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b - Make [useExhaustiveDependencies](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/) report duplicate dependencies. Contributed by @tunamaguro +- Rename `noEvolvingAny` into `noEvolvingTypes` ([#48](https://github.com/biomejs/website/issues/48)). Contributed by @Conaclos + #### Bug fixes - [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) and [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) now correctly handle import namespaces ([#2796](https://github.com/biomejs/biome/issues/2796)). @@ -1260,7 +1262,7 @@ The following rules are promoted: #### New features -- Add rule [noEvolvingAny](https://biomejs.dev/linter/rules/no-evolving-any) to disallow variables from evolving into `any` type through reassignments. Contributed by @fujiyamaorange +- Add rule [noEvolvingTypes](https://biomejs.dev/linter/rules/no-evolving-any) to disallow variables from evolving into `any` type through reassignments. Contributed by @fujiyamaorange #### Enhancements diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_check_command.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_check_command.snap index f0ebf744b49a..e6ccecbd233f 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_check_command.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_check_command.snap @@ -51,18 +51,10 @@ check ━━━━━━━━━━━━━━━━━━━━━━━━ ::error title=lint/suspicious/noDebugger,file=main.ts,line=6,endLine=6,col=1,endColumn=9::This is an unexpected use of the debugger statement. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=main.ts,line=8,endLine=8,col=5,endColumn=6::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=main.ts,line=8,endLine=8,col=5,endColumn=6::This variable implicitly has the any type. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=main.ts,line=9,endLine=9,col=7,endColumn=8::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=main.ts,line=9,endLine=9,col=7,endColumn=8::This variable implicitly has the any type. ``` @@ -91,18 +83,10 @@ check ━━━━━━━━━━━━━━━━━━━━━━━━ ::error title=lint/suspicious/noDebugger,file=index.ts,line=6,endLine=6,col=1,endColumn=9::This is an unexpected use of the debugger statement. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=index.ts,line=8,endLine=8,col=5,endColumn=6::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=index.ts,line=8,endLine=8,col=5,endColumn=6::This variable implicitly has the any type. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=index.ts,line=9,endLine=9,col=7,endColumn=8::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=index.ts,line=9,endLine=9,col=7,endColumn=8::This variable implicitly has the any type. ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_ci_command.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_ci_command.snap index 09e9c8ee97e1..c52aab638916 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_ci_command.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_ci_command.snap @@ -51,18 +51,10 @@ ci ━━━━━━━━━━━━━━━━━━━━━━━━━ ::error title=lint/suspicious/noDebugger,file=main.ts,line=6,endLine=6,col=1,endColumn=9::This is an unexpected use of the debugger statement. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=main.ts,line=8,endLine=8,col=5,endColumn=6::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=main.ts,line=8,endLine=8,col=5,endColumn=6::This variable implicitly has the any type. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=main.ts,line=9,endLine=9,col=7,endColumn=8::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=main.ts,line=9,endLine=9,col=7,endColumn=8::This variable implicitly has the any type. ``` @@ -91,18 +83,10 @@ ci ━━━━━━━━━━━━━━━━━━━━━━━━━ ::error title=lint/suspicious/noDebugger,file=index.ts,line=6,endLine=6,col=1,endColumn=9::This is an unexpected use of the debugger statement. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=index.ts,line=8,endLine=8,col=5,endColumn=6::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=index.ts,line=8,endLine=8,col=5,endColumn=6::This variable implicitly has the any type. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=index.ts,line=9,endLine=9,col=7,endColumn=8::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=index.ts,line=9,endLine=9,col=7,endColumn=8::This variable implicitly has the any type. ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_lint_command.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_lint_command.snap index 8024848e050b..49f06c5538a0 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_lint_command.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_github/reports_diagnostics_github_lint_command.snap @@ -51,18 +51,10 @@ lint ━━━━━━━━━━━━━━━━━━━━━━━━━ ::error title=lint/suspicious/noDebugger,file=main.ts,line=6,endLine=6,col=1,endColumn=9::This is an unexpected use of the debugger statement. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=main.ts,line=8,endLine=8,col=5,endColumn=6::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=main.ts,line=8,endLine=8,col=5,endColumn=6::This variable implicitly has the any type. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=main.ts,line=9,endLine=9,col=7,endColumn=8::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=main.ts,line=9,endLine=9,col=7,endColumn=8::This variable implicitly has the any type. ``` @@ -83,18 +75,10 @@ lint ━━━━━━━━━━━━━━━━━━━━━━━━━ ::error title=lint/suspicious/noDebugger,file=index.ts,line=6,endLine=6,col=1,endColumn=9::This is an unexpected use of the debugger statement. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=index.ts,line=8,endLine=8,col=5,endColumn=6::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=index.ts,line=8,endLine=8,col=5,endColumn=6::This variable implicitly has the any type. ``` -```block -::error title=lint/nursery/noEvolvingAny,file=index.ts,line=9,endLine=9,col=7,endColumn=8::This variable's type is not allowed to evolve implicitly, leading to potential any types. -``` - ```block ::error title=lint/suspicious/noImplicitAnyLet,file=index.ts,line=9,endLine=9,col=7,endColumn=8::This variable implicitly has the any type. ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_check_command.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_check_command.snap index e2c12d0248ba..bab9e418f72c 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_check_command.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_check_command.snap @@ -45,7 +45,7 @@ check ━━━━━━━━━━━━━━━━━━━━━━━━ ```block - + line 5, col 0, This is an unexpected use of the debugger statement. - - - line 7, col 4, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 7, col 4, This variable implicitly has the any type. - - - line 8, col 6, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 8, col 6, This variable implicitly has the any type. @@ -100,21 +90,11 @@ check ━━━━━━━━━━━━━━━━━━━━━━━━ line 5, col 0, This is an unexpected use of the debugger statement. - - - line 7, col 4, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 7, col 4, This variable implicitly has the any type. - - - line 8, col 6, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 8, col 6, This variable implicitly has the any type. diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_ci_command.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_ci_command.snap index 90e252d8701b..51490c3a1f84 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_ci_command.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_ci_command.snap @@ -45,7 +45,7 @@ ci ━━━━━━━━━━━━━━━━━━━━━━━━━ ```block - + line 5, col 0, This is an unexpected use of the debugger statement. - - - line 7, col 4, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 7, col 4, This variable implicitly has the any type. - - - line 8, col 6, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 8, col 6, This variable implicitly has the any type. @@ -100,21 +90,11 @@ ci ━━━━━━━━━━━━━━━━━━━━━━━━━ line 5, col 0, This is an unexpected use of the debugger statement. - - - line 7, col 4, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 7, col 4, This variable implicitly has the any type. - - - line 8, col 6, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 8, col 6, This variable implicitly has the any type. diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_lint_command.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_lint_command.snap index 3bd6754c9e8a..ee2dafc2b953 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_lint_command.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_junit/reports_diagnostics_junit_lint_command.snap @@ -45,7 +45,7 @@ lint ━━━━━━━━━━━━━━━━━━━━━━━━━ ```block - + line 5, col 0, This is an unexpected use of the debugger statement. - - - line 7, col 4, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 7, col 4, This variable implicitly has the any type. - - - line 8, col 6, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 8, col 6, This variable implicitly has the any type. @@ -100,21 +90,11 @@ lint ━━━━━━━━━━━━━━━━━━━━━━━━━ line 5, col 0, This is an unexpected use of the debugger statement. - - - line 7, col 4, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 7, col 4, This variable implicitly has the any type. - - - line 8, col 6, This variable's type is not allowed to evolve implicitly, leading to potential any types. - - line 8, col 6, This variable implicitly has the any type. diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_summary/reports_diagnostics_summary_check_command.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_summary/reports_diagnostics_summary_check_command.snap index 05e10c389306..5685f1f63935 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_reporter_summary/reports_diagnostics_summary_check_command.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_summary/reports_diagnostics_summary_check_command.snap @@ -81,12 +81,12 @@ Rule Name Diagnostics lint/suspicious/noImplicitAnyLet 12 (12 error(s), 0 warning(s), 0 info(s)) lint/suspicious/noDoubleEquals 8 (8 error(s), 0 warning(s), 0 info(s)) lint/suspicious/noRedeclare 12 (12 error(s), 0 warning(s), 0 info(s)) -lint/suspicious/noDebugger 20 (20 error(s), 0 warning(s), 0 info(s)) +lint/suspicious/noDebugger 8 (8 error(s), 0 warning(s), 0 info(s)) ``` ```block Checked 2 files in