Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Allow users to configure ESLint's `rulesCustomizations` settings (#11135)
William Villeneuveca187c838606
diff --git a/crates/languages/src/typescript.rs b/crates/languages/src/typescript.rsindex 13ff23f26db..7a538dba139 100644--- a/crates/languages/src/typescript.rs+++ b/crates/languages/src/typescript.rs@@ -286,6 +286,11 @@ impl LspAdapter for EsLintLspAdapter {.cloned().unwrap_or_else(|| json!({}));+ let rules_customizations = eslint_user_settings+ .get("rulesCustomizations")+ .cloned()+ .unwrap_or_else(|| json!([]));+let node_path = eslint_user_settings.get("nodePath").unwrap_or(&Value::Null);let use_flat_config = Self::FLAT_CONFIG_FILE_NAMES.iter()@@ -294,7 +299,7 @@ impl LspAdapter for EsLintLspAdapter {Ok(json!({"": {"validate": "on",- "rulesCustomizations": [],+ "rulesCustomizations": rules_customizations,"run": "onType","nodePath": node_path,"workingDirectory": {"mode": "auto"},diff --git a/docs/src/languages/javascript.md b/docs/src/languages/javascript.mdindex 9ddd2776403..fc578335659 100644--- a/docs/src/languages/javascript.md+++ b/docs/src/languages/javascript.md@@ -121,3 +121,22 @@ For example, here's how to set `problems.shortenToSingleLine`:}}```++#### Configure ESLint's `rulesCustomizations`:++You can configure ESLint's `rulesCustomizations` setting:++```json+{+ "lsp": {+ "eslint": {+ "settings": {+ "rulesCustomizations": [+ // set all eslint errors/warnings to show as warnings+ { "rule": "*", "severity": "warn" }+ ]+ }+ }+ }+}+```