docs(noExplicitAny): add a diagnostic note and info in docs
MODIFY
crates/rome_js_analyze/src/analyzers/suspicious/no_explicit_any.rs
crates/rome_js_analyze/src/analyzers/suspicious/no_explicit_any.rs
@@ -5,7 +5,15 @@ use rome_js_syntax::TsAnyType;
use rome_rowan::AstNode;
declare_rule! {
- /// Disallow the `any` type usage
+ /// Disallow the `any` type usage.
+ ///
+ /// The `any` type in TypeScript is a dangerous "escape hatch" from the type system.
+ /// Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code.
+ ///
+ /// TypeScript's `--noImplicitAny` compiler option prevents an implied `any`,
+ /// but doesn't prevent `any` from being explicitly used the way this rule does.
+ ///
+ /// Source: https://typescript-eslint.io/rules/no-explicit-any
///
/// ## Examples
///
@@ -66,7 +74,9 @@ impl Rule for NoExplicitAny {
ctx.query().range(),
markup! {"Unexpected "<Emphasis>"any"</Emphasis>". Specify a different type."}
.to_owned(),
- );
+ ).note(markup! {
+ <Emphasis>"any"</Emphasis>" disables many type checking rules. Its use should be avoided."
+ });
Some(diagnostic)
}

MODIFY
crates/rome_service/src/configuration/linter/rules.rs
crates/rome_service/src/configuration/linter/rules.rs
@@ -1336,7 +1336,7 @@ struct SuspiciousSchema {
no_double_equals: Option<RuleConfiguration>,
#[doc = "Disallow duplicate function arguments name."]
no_duplicate_parameters: Option<RuleConfiguration>,
- #[doc = "Disallow the any type usage"]
+ #[doc = "Disallow the any type usage."]
no_explicit_any: Option<RuleConfiguration>,
#[doc = "Disallow reassigning function declarations."]
no_function_assign: Option<RuleConfiguration>,

MODIFY
editors/vscode/configuration_schema.json
editors/vscode/configuration_schema.json
]
},
"noExplicitAny": {
- "description": "Disallow the any type usage",
+ "description": "Disallow the any type usage.",
"anyOf": [
{
"$ref": "#/definitions/RuleConfiguration"

MODIFY
npm/backend-jsonrpc/src/workspace.ts
npm/backend-jsonrpc/src/workspace.ts
@@ -606,7 +606,7 @@ export interface Suspicious {
*/
noDuplicateParameters?: RuleConfiguration;
/**
- * Disallow the any type usage
+ * Disallow the any type usage.
*/
noExplicitAny?: RuleConfiguration;
/**

MODIFY
npm/rome/configuration_schema.json
npm/rome/configuration_schema.json
]
},
"noExplicitAny": {
- "description": "Disallow the any type usage",
+ "description": "Disallow the any type usage.",
"anyOf": [
{
"$ref": "#/definitions/RuleConfiguration"

MODIFY
website/src/pages/lint/rules/index.mdx
website/src/pages/lint/rules/index.mdx
@@ -414,7 +414,7 @@ Disallow duplicate function arguments name.
<a href="/lint/rules/noExplicitAny">noExplicitAny</a>
<span class="recommended">recommended</span>
</h3>
-Disallow the <code>any</code> type usage
+Disallow the <code>any</code> type usage.
</section>
<section class="rule">
<h3 data-toc-exclude id="noFunctionAssign">

docs(noExplicitAny): add a diagnostic note and info in docs (#4089)