Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linter): can't disable no-nested-ternary rule anymore #8600

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shulaoda
Copy link
Contributor

@shulaoda shulaoda commented Jan 19, 2025

closes #8485

Since we currently support rules with the same name but different plugins, some of the original logic is no longer applicable. As a result, I have made some adjustments.

Copy link

graphite-app bot commented Jan 19, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Jan 19, 2025
@shulaoda shulaoda marked this pull request as draft January 19, 2025 12:30
Copy link

codspeed-hq bot commented Jan 19, 2025

CodSpeed Performance Report

Merging #8600 will not alter performance

Comparing shulaoda:fix/can't-disable-rules (57f69dd) with main (d966e0a)

Summary

✅ 32 untouched benchmarks

@github-actions github-actions bot added the A-cli Area - CLI label Jan 19, 2025
@@ -465,9 +469,8 @@ mod test {
fn test_override_plugin_prefix_duplicates() {
let configs = [
// FIXME: this should be valid
// json!({ "@typescript-eslint/no-unused-vars": "error" }),
json!({ "no-unused-vars": "off", "typescript/no-unused-vars": "error" }),
json!({ "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error" }),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@typescript-eslint/no-unused-vars does not exist.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the rule: https://typescript-eslint.io/rules/no-unused-vars/

Internally we are remapping some eslint rules to typescript here:

// List of Eslint rules that have Typescript equivalents.
const TYPESCRIPT_COMPATIBLE_ESLINT_RULES: phf::Set<&'static str> = phf::phf_set! {
"class-methods-use-this",
"default-param-last",
"init-declarations",
"max-params",
"no-array-constructor",
"no-dupe-class-members",
"no-empty-function",
"no-invalid-this",
"no-loop-func",
"no-loss-of-precision",
"no-magic-numbers",
"no-redeclare",
"no-restricted-imports",
"no-shadow",
"no-unused-expressions",
"no-unused-vars",
"no-use-before-define",
"no-useless-constructor",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internally we are remapping some eslint rules to typescript here:

Got it.

@shulaoda shulaoda marked this pull request as ready for review January 19, 2025 13:41
json!({ "no-unused-vars": "off", "typescript/no-unused-vars": "error" }),
json!({ "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error" }),
// json!({ "@unicorn-eslint/no-nested-ternary": "error" }),
json!({ "no-nested-ternary": "off", "unicorn/no-nested-ternary": "error" }),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"no-nested-ternary" => "eslint/no-nested-ternary"

Currently, we do not support rules without an explicit plugin_name, which would automatically match all rules:
"no-nested-ternary" => "eslint/no-nested-ternary" and "unicorn/no-nested-ternary"

@shulaoda shulaoda marked this pull request as draft January 19, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area - CLI A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

linter: cannot disable no-nested-ternary rule anymore
2 participants