Skip to content

linter: false positive of eslint(no-unreachable-loop) if loop contains a switch #24251

Description

@crystalfp

What version of Oxlint are you using?

1.73.0

What command did you run?

oxlint -c ./oxlint.json --tsconfig=tsconfig.json

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "categories": {
    "correctness": "warn",
    "suspicious": "warn",
    "perf": "warn",
    "pedantic": "warn",
    "nursery": "warn"
  },
  "plugins": [
    "vue",
    "import",
    "eslint",
    "typescript",
    "promise",
    "node",
    "unicorn",
    "oxc"
  ],
  "jsPlugins": [
    "eslint-plugin-sonarjs",
    "@stylistic/eslint-plugin",
    "@eslint-community/eslint-plugin-eslint-comments",
    "eslint-plugin-security",
    "eslint-plugin-regexp",
    "eslint-plugin-depend",
    "eslint-plugin-tsdoc"
  ],
  "ignorePatterns": [
    "src/vite-env.d.ts",
    "src/assets",
    "src/cpp",
    "src/electron/fingerprint/rolldown.config.mjs",
    "src/electron/fingerprint/KDtree.js",
    "src/electron/fingerprint/.rollup.cache/**",
    "save/**",
    "proto-test/**",
    "docgen.config.js",
    "eslint.config.mjs",
    "eslint.vue.config.mjs",
    ".dependency-cruiser.js",
    "work/**",
    "public/doc/scripts.js",
    "tests/**"
  ],
  "options":{
    "typeAware": true,
    "typeCheck": true
  },
  "env": {
    "es2026": true,
    "builtin": true
  },
  "rules": {
    "constructor-super": "error",
    "for-direction": "error",
    "getter-return": "error",
    "no-async-promise-executor": "error",
    "no-case-declarations": "error",
    "no-class-assign": "error",
    "no-compare-neg-zero": "error",
    "no-cond-assign": "error",
    "no-const-assign": "error",
    "no-constant-binary-expression": "error",
    "no-constant-condition": "error",
    "no-control-regex": "error",
    "no-debugger": "error",
    "no-delete-var": "error",
    "no-dupe-class-members": "error",
    "no-dupe-else-if": "error",
    "no-dupe-keys": "error",
    "no-duplicate-case": "error",
    "no-empty": "error",
    "no-empty-character-class": "off",
    "no-empty-pattern": "error",
    "no-empty-static-block": "error",
    "no-ex-assign": "error",
    "no-extra-boolean-cast": "error",
    "no-fallthrough": "error",
    "no-func-assign": "error",
    "no-global-assign": "error",
    "no-import-assign": "error",
    "no-invalid-regexp": "off",
    "no-irregular-whitespace": "error",
    "no-loss-of-precision": "error",
    "no-misleading-character-class": "error",
    "no-new-native-nonconstructor": "error",
    "no-nonoctal-decimal-escape": "error",
    "no-obj-calls": "error",
    "no-prototype-builtins": "error",
    "no-redeclare": ["error", {"builtinGlobals": true}],
    "no-regex-spaces": "error",
    "no-self-assign": "error",
    "no-setter-return": "error",
    "no-shadow-restricted-names": "error",
    "no-sparse-arrays": "error",
    "no-this-before-super": "error",
    "no-undef": "error",
    "no-unexpected-multiline": "error",
    "no-unreachable": "error",
    "no-unsafe-finally": "error",
    "no-unsafe-negation": "error",
    "no-unsafe-optional-chaining": "error",
    "no-unused-labels": "error",
    "no-unused-private-class-members": "error",
    "no-unused-vars": [
      "error",
      {
        "vars": "all",
        "args": "all",
        "argsIgnorePattern": "^_",
        "caughtErrors": "all",
        "caughtErrorsIgnorePattern": "^_",
        "destructuredArrayIgnorePattern": "^_",
        "varsIgnorePattern": "^_",
        "ignoreRestSiblings": true
      }
    ],
    "no-useless-backreference": "off",
    "no-useless-catch": "error",
    "no-useless-escape": "error",
    "no-underscore-dangle": "off",
    "no-with": "error",
    "require-yield": "error",
    "use-isnan": "error",
    "valid-typeof": "error",
    "promise/always-return": "off",
    "promise/no-return-wrap": "error",
    "promise/param-names": "error",
    "promise/catch-or-return": [
      "warn",
      {
        "allowFinally": true
      }
    ],
    "promise/no-nesting": "warn",
    "promise/no-promise-in-callback": "warn",
    "promise/no-callback-in-promise": "warn",
    "promise/avoid-new": "off",
    "promise/no-new-statics": "error",
    "promise/no-return-in-finally": "warn",
    "promise/valid-params": "warn",
    "import/named": "off",
    "import/namespace": "error",
    "import/default": "off",
    "import/export": "error",
    "import/no-named-as-default": "warn",
    "import/no-named-as-default-member": "warn",
    "import/no-duplicates": "warn",
    "no-negated-condition": "warn",
    "no-nested-ternary": "off",
    "unicorn/catch-error-name": "error",
    "unicorn/consistent-assert": "error",
    "unicorn/consistent-date-clone": "error",
    "unicorn/consistent-empty-array-spread": "error",
    "unicorn/consistent-existence-index-check": "error",
    "unicorn/consistent-function-scoping": "error",
    "unicorn/empty-brace-spaces": "error",
    "unicorn/error-message": "error",
    "unicorn/escape-case": "error",
    "unicorn/explicit-length-check": "error",
    "unicorn/filename-case": [
      "off",
      {
        "case": "camelCase"
      }
    ],
    "unicorn/no-length-as-slice-end": "error",
    "unicorn/new-for-builtins": "off",
    "unicorn/no-abusive-eslint-disable": "error",
    "unicorn/no-accessor-recursion": "error",
    "unicorn/no-anonymous-default-export": "error",
    "unicorn/no-array-callback-reference": "error",
    "unicorn/no-array-for-each": "error",
    "unicorn/no-array-method-this-argument": "error",
    "unicorn/no-array-reduce": "error",
    "unicorn/no-array-reverse": "error",
    "unicorn/no-array-sort": "error",
    "unicorn/no-await-expression-member": "error",
    "unicorn/no-await-in-promise-methods": "error",
    "unicorn/no-console-spaces": "error",
    "unicorn/no-document-cookie": "error",
    "unicorn/no-empty-file": "error",
    "unicorn/no-hex-escape": "error",
    "unicorn/no-instanceof-builtins": "error",
    "unicorn/no-invalid-fetch-options": "error",
    "unicorn/no-invalid-remove-event-listener": "error",
    "unicorn/no-lonely-if": "error",
    "unicorn/no-magic-array-flat-depth": "error",
    "unicorn/no-negated-condition": "error",
    "unicorn/no-negation-in-equality-check": "error",
    "unicorn/no-nested-ternary": "error",
    "unicorn/no-new-array": "error",
    "unicorn/no-new-buffer": "error",
    "unicorn/no-null": "error",
    "unicorn/no-object-as-default-parameter": "error",
    "unicorn/no-process-exit": "error",
    "unicorn/no-single-promise-in-promise-methods": "error",
    "unicorn/no-static-only-class": "error",
    "unicorn/no-thenable": "error",
    "unicorn/no-this-assignment": "error",
    "unicorn/no-typeof-undefined": "error",
    "unicorn/no-unnecessary-array-flat-depth": "error",
    "unicorn/no-unnecessary-array-splice-count": "error",
    "unicorn/no-unnecessary-await": "error",
    "unicorn/no-unnecessary-slice-end": "error",
    "unicorn/no-unreadable-array-destructuring": "error",
    "unicorn/no-unreadable-iife": "error",
    "unicorn/no-useless-collection-argument": "error",
    "unicorn/no-useless-error-capture-stack-trace": "error",
    "unicorn/no-useless-fallback-in-spread": "error",
    "unicorn/no-useless-length-check": "error",
    "unicorn/no-useless-promise-resolve-reject": "error",
    "unicorn/no-useless-spread": "error",
    "unicorn/no-useless-switch-case": "error",
    "unicorn/no-useless-undefined": "error",
    "unicorn/no-zero-fractions": "off",
    "unicorn/number-literal-case": "error",
    "unicorn/numeric-separators-style": [
      "off",
      {
        "number": {
          "onlyIfContainsSeparator": true,
          "minimumDigits": 3
        }
      }
    ],
    "unicorn/prefer-add-event-listener": "error",
    "unicorn/prefer-array-find": "error",
    "unicorn/prefer-array-flat": "error",
    "unicorn/prefer-array-flat-map": "error",
    "unicorn/prefer-array-index-of": "error",
    "unicorn/prefer-array-some": "error",
    "unicorn/prefer-at": "error",
    "unicorn/prefer-bigint-literals": "error",
    "unicorn/prefer-blob-reading-methods": "error",
    "unicorn/prefer-class-fields": "warn",
    "unicorn/prefer-classlist-toggle": "error",
    "unicorn/prefer-code-point": "error",
    "unicorn/prefer-date-now": "error",
    "unicorn/prefer-dom-node-append": "error",
    "unicorn/prefer-dom-node-dataset": "error",
    "unicorn/prefer-dom-node-remove": "error",
    "unicorn/prefer-dom-node-text-content": "error",
    "unicorn/prefer-event-target": "error",
    "unicorn/prefer-global-this": "error",
    "unicorn/prefer-includes": "error",
    "unicorn/prefer-logical-operator-over-ternary": "error",
    "unicorn/prefer-math-min-max": "error",
    "unicorn/prefer-math-trunc": "error",
    "unicorn/prefer-modern-dom-apis": "error",
    "unicorn/prefer-modern-math-apis": "error",
    "unicorn/prefer-native-coercion-functions": "error",
    "unicorn/prefer-negative-index": "error",
    "unicorn/prefer-node-protocol": "error",
    "unicorn/prefer-number-properties": "error",
    "unicorn/prefer-object-from-entries": "error",
    "unicorn/prefer-optional-catch-binding": "error",
    "unicorn/prefer-prototype-methods": "error",
    "unicorn/prefer-query-selector": "error",
    "unicorn/prefer-reflect-apply": "error",
    "unicorn/prefer-regexp-test": "error",
    "unicorn/prefer-response-static-json": "error",
    "unicorn/prefer-set-has": "error",
    "unicorn/prefer-set-size": "error",
    "unicorn/prefer-spread": "error",
    "unicorn/prefer-string-raw": "error",
    "unicorn/prefer-string-replace-all": "error",
    "unicorn/prefer-string-slice": "error",
    "unicorn/prefer-string-starts-ends-with": "error",
    "unicorn/prefer-string-trim-start-end": "error",
    "unicorn/prefer-structured-clone": "error",
    "unicorn/prefer-top-level-await": "off",
    "unicorn/prefer-type-error": "error",
    "unicorn/require-array-join-separator": "error",
    "unicorn/require-module-specifiers": "error",
    "unicorn/require-number-to-fixed-digits-argument": "error",
    "unicorn/require-post-message-target-origin": "error",
    "unicorn/switch-case-braces": "off",
    "unicorn/text-encoding-identifier-case": "error",
    "unicorn/throw-new-error": "off",
    "unicorn/prefer-number-coercion": "off",
    "@typescript-eslint/ban-ts-comment": [
      "error", {"minimumDescriptionLength": 10}
    ],
    "no-array-constructor": "error",
    "@typescript-eslint/no-duplicate-enum-values": "error",
    "@typescript-eslint/no-empty-object-type": "error",
    "@typescript-eslint/no-explicit-any": "error",
    "@typescript-eslint/no-extra-non-null-assertion": "error",
    "@typescript-eslint/no-misused-new": "error",
    "@typescript-eslint/no-namespace": "error",
    "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
    "@typescript-eslint/no-require-imports": "error",
    "@typescript-eslint/no-this-alias": "error",
    "@typescript-eslint/no-unnecessary-type-constraint": "error",
    "@typescript-eslint/no-unsafe-declaration-merging": "error",
    "@typescript-eslint/no-unsafe-function-type": "error",
    "no-unused-expressions": "error",
    "@typescript-eslint/no-wrapper-object-types": "error",
    "@typescript-eslint/prefer-as-const": "error",
    "@typescript-eslint/prefer-optional-chain": "error",
    "@typescript-eslint/prefer-namespace-keyword": "error",
    "@typescript-eslint/triple-slash-reference": "error",
    "@typescript-eslint/await-thenable": "error",
    "@typescript-eslint/no-array-delete": "error",
    "@typescript-eslint/no-base-to-string": "error",
    "@typescript-eslint/no-duplicate-type-constituents": "error",
    "@typescript-eslint/no-floating-promises": "error",
    "@typescript-eslint/no-for-in-array": "error",
    "@typescript-eslint/no-implied-eval": "error",
    "@typescript-eslint/no-misused-promises": "error",
    "@typescript-eslint/no-redundant-type-constituents": "error",
    "@typescript-eslint/no-unnecessary-type-assertion": "error",
    "@typescript-eslint/no-unsafe-argument": "error",
    "@typescript-eslint/no-unsafe-assignment": "error",
    "@typescript-eslint/no-unsafe-call": "error",
    "@typescript-eslint/no-unsafe-enum-comparison": "error",
    "@typescript-eslint/no-unsafe-member-access": "error",
    "@typescript-eslint/no-unsafe-return": "error",
    "@typescript-eslint/no-unsafe-unary-minus": "error",
    "no-throw-literal": "off",
    "@typescript-eslint/only-throw-error": "error",
    "prefer-promise-reject-errors": "off",
    "@typescript-eslint/prefer-promise-reject-errors": "error",
    "require-await": "off",
    "@typescript-eslint/require-await": "error",
    "@typescript-eslint/restrict-plus-operands": "error",
    "@typescript-eslint/restrict-template-expressions": [
      "warn", {"allowNumber": true}
    ],
    "@typescript-eslint/unbound-method": "error",
    "@typescript-eslint/adjacent-overload-signatures": "error",
    "@typescript-eslint/array-type": [
      "warn",
      {
        "default": "array",
        "readonly": "array"
      }
    ],
    "@typescript-eslint/ban-tslint-comment": "error",
    "@typescript-eslint/consistent-generic-constructors": "error",
    "@typescript-eslint/consistent-indexed-object-style": "error",
    "@typescript-eslint/consistent-type-definitions": "error",
    "@typescript-eslint/no-confusing-non-null-assertion": "error",
    "no-empty-function": "error",
    "@typescript-eslint/no-inferrable-types": "error",
    "@typescript-eslint/non-nullable-type-assertion-style": "error",
    "@typescript-eslint/prefer-for-of": "error",
    "@typescript-eslint/prefer-function-type": "error",
    "@typescript-eslint/prefer-includes": "warn",
    "@typescript-eslint/no-confusing-void-expression": [
      "error",
      {
        "ignoreArrowShorthand": true
      }
    ],
    "@typescript-eslint/no-deprecated": "error",
    "@typescript-eslint/no-dynamic-delete": "error",
    "@typescript-eslint/no-extraneous-class": "error",
    "@typescript-eslint/no-meaningless-void-operator": "error",
    "@typescript-eslint/no-misused-spread": "error",
    "@typescript-eslint/no-mixed-enums": "error",
    "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
    "@typescript-eslint/no-non-null-assertion": "off",
    "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
    "@typescript-eslint/no-unnecessary-template-expression": "error",
    "@typescript-eslint/no-unnecessary-type-arguments": "error",
    "no-useless-constructor": "error",
    "@typescript-eslint/prefer-literal-enum-member": "error",
    "@typescript-eslint/prefer-reduce-type-parameter": "error",
    "@typescript-eslint/prefer-return-this-type": "error",
    "@typescript-eslint/related-getter-setter-pairs": "error",
    "@typescript-eslint/return-await": "error",
    "@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
    "no-unassigned-vars": "warn",
    "eqeqeq": [
      "error",
      "always"
    ],
    "no-else-return": "error",
    "@typescript-eslint/explicit-function-return-type": [
      "warn",
      {
        "allowExpressions": true
      }
    ],
    "default-param-last": "warn",
    "no-duplicate-imports": [
      "error",
      {
        "allowSeparateTypeImports": true
      }
    ],
    "@typescript-eslint/no-unsafe-type-assertion": "off",
    "@typescript-eslint/promise-function-async": "error",
    "@typescript-eslint/require-array-sort-compare": "error",
    "@typescript-eslint/switch-exhaustiveness-check": "error",
    "@typescript-eslint/no-unnecessary-condition": "off",
    "@typescript-eslint/prefer-readonly-parameter-types": "off",

    "eslint/max-depth": "off",
    "eslint/no-await-in-loop": "off",
    "import/max-dependencies": "off",
    "import/no-unassigned-import": "off",
    "eslint/max-lines": "off",
    "@typescript-eslint/strict-boolean-expressions": "off",
    "eslint/max-lines-per-function": "off",
    "eslint/sort-vars": "off",
    "eslint/max-classes-per-file": "off",
    "oxc/approx-constant": "off",

    // "vue/v-bind-style": ["warn", "shorthand", {"sameNameShorthand": "always"}],
    // "vue/attributes-order": "warn",
    // "vue/no-undef-components": ["error", {"ignorePatterns": ["^v-", "^router-"]}],

    "@stylistic/array-bracket-newline": ["warn", "consistent"],
    "@stylistic/array-bracket-spacing": ["warn", "never"],
    "@stylistic/arrow-parens": ["warn", "always", { "requireForBlockBody": true }],
    "@stylistic/arrow-spacing": [ "error", { "after": true, "before": true } ],
    "@stylistic/block-spacing": [ "error", "never" ],
    "@stylistic/brace-style": ["warn", "stroustrup", {"allowSingleLine": true}],
    "@stylistic/comma-dangle": [ "off", "always-multiline" ],
    "@stylistic/comma-spacing": ["error", {"before": false, "after": true}],
    "@stylistic/comma-style": [ "error", "last" ],
    "@stylistic/computed-property-spacing": [ "error", "never", { "enforceForClassMembers": true } ],
    "@stylistic/dot-location": [ "error", "property" ],
    "@stylistic/eol-last": ["error", "always"],
    "@stylistic/generator-star-spacing": ["error", {"after": true, "before": false}],
    "@stylistic/indent": "off",
    "@stylistic/indent-binary-ops": "off",
    "@stylistic/key-spacing": ["error", {
        "afterColon": true,
        "beforeColon": false,
        "mode": "minimum"
      }
    ],
    "@stylistic/keyword-spacing": ["warn", {"before": true, "after": true, "overrides": {
        "if": {"after": false},
        "switch": {"after": false},
        "catch": {"after": false},
        "while": {"after": false},
        "for": {"after": false},
    }}],
    "@stylistic/lines-between-class-members": ["warn", "always", { "exceptAfterSingleLine": true }],
    "@stylistic/max-statements-per-line": ["warn", {"max": 2}],
    "@stylistic/member-delimiter-style": [
      "warn",
      {
        "multiline": {
          "delimiter": "semi",
          "requireLast": true
        },
        "multilineDetection": "brackets",
        "overrides": {
          "interface": {
            "multiline": {
              "delimiter": "semi",
              "requireLast": true
            }
          }
        },
        "singleline": {
          "delimiter": "semi"
        }
      }
    ],
    "@stylistic/new-parens": "error",
    "@stylistic/no-extra-parens": ["warn", "functions"],
    "@stylistic/no-floating-decimal": "error",
    "@stylistic/no-mixed-operators": [
      "error",
      {
        "allowSamePrecedence": true,
        "groups": [
          [
            "==",
            "!=",
            "===",
            "!==",
            ">",
            ">=",
            "<",
            "<="
          ],
          [
            "&&",
            "||"
          ],
          [
            "in",
            "instanceof"
          ]
        ]
      }
    ],
    "@stylistic/no-mixed-spaces-and-tabs": "off",
    // "@stylistic/no-multiple-empty-lines": ["warn", {"max": 2, "maxEOF": 1, "maxBOF": 0}],
    "@stylistic/no-multi-spaces": "off",
    "@stylistic/no-tabs": "off",
    "@stylistic/no-trailing-spaces": "error",
    "@stylistic/no-whitespace-before-property": "error",
    "@stylistic/quote-props": ["warn", "as-needed"],
    "@stylistic/padded-blocks": "off",
    "@stylistic/quotes": ["warn", "double", {"allowTemplateLiterals": "always", "avoidEscape": true}],
    "@stylistic/semi-spacing": "error",
    "@stylistic/no-extra-semi": "error",
    "@stylistic/semi": ["error", "always"],
    "@stylistic/rest-spread-spacing": [ "error", "never" ],
    "@stylistic/space-before-function-paren": [
        "error", {"anonymous": "never", "named": "never", "asyncArrow": "always", "catch": "never"}
    ],
    "@stylistic/space-in-parens": [ "error", "never" ],
    "@stylistic/space-unary-ops": [ "error", { "nonwords": false, "words": true } ],
    "@stylistic/spaced-comment": [
      "warn",
      "always",
      {
        "block": {
          "balanced": true,
          "exceptions": [
            "*"
          ],
          "markers": [
            "!"
          ]
        },
        "line": {
          "exceptions": [
            "/",
            "#"
          ],
          "markers": [
            "/"
          ]
        }
      }
    ],
    "@stylistic/template-curly-spacing": "error",
    "@stylistic/template-tag-spacing": [ "error", "never" ],
    "@stylistic/type-annotation-spacing": [ "error", {
        "before": false,
        "after": true,
        "overrides": {"arrow": "ignore"}
      }
    ],
    "@stylistic/type-generic-spacing": "error",
    "@stylistic/type-named-tuple-spacing": "error",
    "@stylistic/wrap-iife": [ "error", "any", { "functionPrototypeMethods": true } ],
    "@stylistic/yield-star-spacing": ["error", {"after": true, "before": false}],

    "sonarjs/no-commented-code": "warn",
    "eslint/no-inline-comments": "off",
    "sonarjs/cognitive-complexity": ["off", 40],
    "sonarjs/void-use": "off",
    "sonarjs/different-types-comparison": "off",
    "sonarjs/no-unenclosed-multiline-block": "off",
    "sonarjs/fixme-tag": "off",
    "sonarjs/no-labels": "off",
    "sonarjs/todo-tag": "off",
    "sonarjs/pseudo-random": "off",
    "sonarjs/no-selector-parameter": "off",

    // "sonarjs/no-duplicate-string": ["off", 6],
    // "sonarjs/elseif-without-else": "off",
    // "sonarjs/no-nested-switch": "off",
    // "sonarjs/sonar-no-fallthrough": "off",
    "sonarjs/no-gratuitous-expressions": "warn",
    "sonarjs/no-empty-collection": "warn",
    "sonarjs/no-unused-collection": "warn",
    "sonarjs/no-use-of-empty-return-value": "warn",
    "sonarjs/no-extra-arguments": "warn",
    "sonarjs/no-redundant-jump": "warn",

    "tsdoc/syntax": "warn",

    "typescript/ban-ts-comment": [
      "error",
      {
        "minimumDescriptionLength": 10
      }
    ],
    "typescript/no-duplicate-enum-values": "error",
    "typescript/no-empty-object-type": "error",
    "typescript/no-explicit-any": "error",
    "typescript/no-extra-non-null-assertion": "error",
    "typescript/no-misused-new": "error",
    "typescript/no-namespace": "error",
    "typescript/no-non-null-asserted-optional-chain": "error",
    "typescript/no-require-imports": "error",
    "typescript/no-this-alias": "error",
    "typescript/no-unnecessary-type-constraint": "error",
    "typescript/no-unsafe-declaration-merging": "error",
    "typescript/no-unsafe-function-type": "error",
    "typescript/no-wrapper-object-types": "error",
    "typescript/prefer-as-const": "error",
    "typescript/prefer-namespace-keyword": "error",
    "typescript/triple-slash-reference": "error",
    "typescript/await-thenable": "error",
    "typescript/no-array-delete": "error",
    "typescript/no-base-to-string": "error",
    "typescript/no-duplicate-type-constituents": "error",
    "typescript/no-floating-promises": "error",
    "typescript/no-for-in-array": "error",
    "typescript/no-implied-eval": "error",
    "typescript/no-misused-promises": "error",
    "typescript/no-redundant-type-constituents": "error",
    "typescript/no-unnecessary-type-assertion": "error",
    "typescript/no-unsafe-argument": "error",
    "typescript/no-unsafe-assignment": "error",
    "typescript/no-unsafe-call": "error",
    "typescript/no-unsafe-enum-comparison": "error",
    "typescript/no-unsafe-member-access": "error",
    "typescript/no-unsafe-return": "error",
    "typescript/no-unsafe-unary-minus": "error",
    "typescript/only-throw-error": "error",
    "typescript/prefer-promise-reject-errors": "error",
    "typescript/require-await": "error",
    "typescript/restrict-plus-operands": "error",
    "typescript/restrict-template-expressions": [
      "warn",
      {
        "allowNumber": true
      }
    ],
    "typescript/unbound-method": "error",
    "typescript/adjacent-overload-signatures": "error",
    "typescript/array-type": [
      "warn",
      {
        "default": "array",
        "readonly": "array"
      }
    ],
    "typescript/ban-tslint-comment": "error",
    "typescript/class-literal-property-style": "error",
    "typescript/consistent-generic-constructors": "warn",
    "typescript/consistent-indexed-object-style": "error",
    "typescript/consistent-type-assertions": [
      "warn",
      {
        "assertionStyle": "as"
      }
    ],
    "typescript/consistent-type-definitions": "error",
    "typescript/dot-notation": "error",
    "typescript/no-confusing-non-null-assertion": "error",
    "typescript/no-inferrable-types": "error",
    "typescript/non-nullable-type-assertion-style": "error",
    "typescript/prefer-find": "error",
    "typescript/prefer-for-of": "error",
    "typescript/prefer-function-type": "error",
    "typescript/prefer-includes": "warn",
    "typescript/prefer-nullish-coalescing": "warn",
    "typescript/prefer-optional-chain": "warn",
    "typescript/prefer-regexp-exec": "error",
    "typescript/prefer-string-starts-ends-with": "error",
    "typescript/no-confusing-void-expression": [
      "error",
      {
        "ignoreArrowShorthand": true
      }
    ],
    "typescript/no-deprecated": "warn",
    "typescript/no-dynamic-delete": "error",
    "typescript/no-extraneous-class": "error",
    "typescript/no-invalid-void-type": "error",
    "typescript/no-meaningless-void-operator": "error",
    "typescript/no-misused-spread": "error",
    "typescript/no-mixed-enums": "error",
    "typescript/no-non-null-asserted-nullish-coalescing": "error",
    "typescript/no-non-null-assertion": "off",
    "typescript/no-unnecessary-boolean-literal-compare": "error",
    "typescript/no-unnecessary-condition": "off",
    "typescript/no-unnecessary-template-expression": "error",
    "typescript/no-unnecessary-type-arguments": "error",
    "typescript/no-unnecessary-type-conversion": "error",
    "typescript/no-unnecessary-type-parameters": "error",
    "typescript/no-useless-default-assignment": "warn",
    "typescript/prefer-literal-enum-member": "error",
    "typescript/prefer-reduce-type-parameter": "error",
    "typescript/prefer-return-this-type": "error",
    "typescript/related-getter-setter-pairs": "error",
    "typescript/return-await": "error",
    "typescript/unified-signatures": "error",
    "typescript/use-unknown-in-catch-callback-variable": "off",
    "typescript/explicit-function-return-type": [
      "warn",
      {
        "allowExpressions": true
      }
    ],
    "typescript/no-unsafe-type-assertion": "off",
    "typescript/promise-function-async": "error",
    "typescript/require-array-sort-compare": "error",
    "typescript/switch-exhaustiveness-check": "error",

    "@eslint-community/eslint-comments/no-unused-disable": "warn",
        "no-useless-assignment": "error",
        "preserve-caught-error": "error",
        "@eslint-community/eslint-comments/disable-enable-pair": "off",
        "@eslint-community/eslint-comments/no-aggregating-enable": "error",
        "@eslint-community/eslint-comments/no-duplicate-disable": "error",
        "@eslint-community/eslint-comments/no-unlimited-disable": "error",
        "@eslint-community/eslint-comments/no-unused-enable": "warn",
        "unicorn/consistent-template-literal-escape": "error",
        "unicorn/custom-error-definition": "error",
        "unicorn/no-immediate-mutation": "error",
        "unicorn/no-useless-iterator-to-array": "error",
        "unicorn/prefer-default-parameters": "error",
        "unicorn/prefer-import-meta-properties": "off",
        "unicorn/prefer-keyboard-event-key": "error",
        "unicorn/prefer-module": "error",
        "unicorn/prefer-ternary": "error",
        "unicorn/relative-url-style": "error",
        "unicorn/require-module-attributes": "error",
        "unicorn/switch-case-break-position": "error",
        "security/detect-buffer-noassert": "warn",
        "security/detect-child-process": "warn",
        "security/detect-disable-mustache-escape": "warn",
        "security/detect-eval-with-expression": "warn",
        "security/detect-new-buffer": "warn",
        "security/detect-no-csrf-before-method-override": "error",
        "security/detect-non-literal-fs-filename": "off",
        "security/detect-non-literal-regexp": "warn",
        "security/detect-non-literal-require": "warn",
        "security/detect-object-injection": "off",
        "security/detect-possible-timing-attacks": "warn",
        "security/detect-pseudoRandomBytes": "warn",
        "security/detect-unsafe-regex": "error",
        "security/detect-bidi-characters": "warn",
        "sonarjs/function-name": "off",
        "sonarjs/class-name": "error",
        "sonarjs/max-lines": "off",
        "sonarjs/no-tab": "off",
        "sonarjs/variable-name": "off",
        "sonarjs/comment-regex": "off",
        "sonarjs/elseif-without-else": "off",
        "sonarjs/no-fallthrough": "error",
        "sonarjs/nested-control-flow": "off",
        "sonarjs/too-many-break-or-continue-in-loop": "off",
        "sonarjs/max-lines-per-function": "off",
        "sonarjs/no-nested-incdec": "off",
        "sonarjs/no-equals-in-for-termination": "error",
        "sonarjs/no-collapsible-if": "warn",
        "sonarjs/expression-complexity": "off",
        "sonarjs/no-redundant-parentheses": "off",
        "sonarjs/no-nested-assignment": "error",
        "sonarjs/no-redundant-boolean": "error",
        "sonarjs/prefer-single-boolean-return": "error",
        // "sonarjs/unused-import": "error",
        "sonarjs/useless-string-operation": "off",
        "sonarjs/no-unused-function-argument": "warn",
        "sonarjs/no-duplicate-string": "off",
        "sonarjs/no-case-label-in-switch": "error",
        "sonarjs/no-parameter-reassignment": "error",
        "sonarjs/prefer-while": "error",
        "sonarjs/no-sonar-comments": "off",
        "sonarjs/no-small-switch": "error",
        "sonarjs/no-hardcoded-ip": "error",
        "sonarjs/label-position": "error",
        "sonarjs/public-static-readonly": "error",
        "sonarjs/file-header": "off",
        "sonarjs/call-argument-line": "error",
        "sonarjs/max-switch-cases": "error",
        "sonarjs/no-unused-vars": "off",
        "sonarjs/prefer-immediate-return": "warn",
        "sonarjs/function-inside-loop": "error",
        "sonarjs/code-eval": "error",
        "sonarjs/no-variable-usage-before-declaration": "off",
        "sonarjs/future-reserved-words": "error",
        "sonarjs/array-constructor": "error",
        "sonarjs/bitwise-operators": "error",
        "sonarjs/no-function-declaration-in-block": "off",
        "sonarjs/no-primitive-wrappers": "error",
        "sonarjs/for-in": "off",
        "sonarjs/cyclomatic-complexity": "off",
        "sonarjs/no-skipped-tests": "error",
        "sonarjs/no-identical-expressions": "error",
        "sonarjs/no-nested-switch": "off",
        "sonarjs/constructor-for-side-effects": "error",
        "sonarjs/no-dead-store": "error",
        "sonarjs/no-identical-conditions": "error",
        "sonarjs/no-duplicated-branches": "error",
        "sonarjs/deprecation": "error",
        "sonarjs/no-inverted-boolean-check": "error",
        "sonarjs/misplaced-loop-counter": "error",
        "sonarjs/no-nested-functions": "error",
        "sonarjs/no-hardcoded-passwords": "error",
        "sonarjs/sql-queries": "error",
        "sonarjs/insecure-cookie": "error",
        "sonarjs/no-useless-increment": "error",
        "sonarjs/no-globals-shadowing": "error",
        "sonarjs/no-undefined-assignment": "off",
        "sonarjs/no-empty-test-file": "error",
        "sonarjs/no-ignored-return": "error",
        "sonarjs/no-wildcard-import": "off",
        "sonarjs/arguments-order": "error",
        "sonarjs/for-loop-increment-sign": "error",
        "sonarjs/null-dereference": "error",
        "sonarjs/updated-loop-counter": "error",
        "sonarjs/block-scoped-var": "error",
        "sonarjs/no-built-in-override": "off",
        "sonarjs/prefer-object-literal": "warn",
        "sonarjs/no-ignored-exceptions": "error",
        "sonarjs/file-uploads": "error",
        "sonarjs/file-permissions": "error",
        "sonarjs/no-empty-character-class": "error",
        "sonarjs/index-of-compare-to-positive-number": "error",
        "sonarjs/assertions-in-tests": "error",
        "sonarjs/no-implicit-global": "error",
        "sonarjs/no-useless-catch": "error",
        "sonarjs/xml-parser-xxe": "error",
        "sonarjs/non-existent-operator": "error",
        "sonarjs/web-sql-database": "off",
        "sonarjs/post-message": "error",
        "sonarjs/no-array-delete": "error",
        "sonarjs/no-alphabetical-sort": "error",
        "sonarjs/no-incomplete-assertions": "error",
        "sonarjs/no-global-this": "error",
        "sonarjs/new-operator-misuse": "error",
        "sonarjs/no-delete-var": "error",
        "sonarjs/strings-comparison": "off",
        "sonarjs/file-name-differ-from-class": "off",
        "sonarjs/cookie-no-httponly": "error",
        "sonarjs/no-nested-conditional": "error",
        "sonarjs/no-incorrect-string-concat": "off",
        "sonarjs/inverted-assertion-arguments": "error",
        "sonarjs/shorthand-property-grouping": "off",
        "sonarjs/updated-const-var": "error",
        "sonarjs/arguments-usage": "off",
        "sonarjs/destructuring-assignment-syntax": "warn",
        "sonarjs/no-invariant-returns": "error",
        "sonarjs/arrow-function-convention": "off",
        "sonarjs/class-prototype": "off",
        "sonarjs/generator-without-yield": "error",
        "sonarjs/no-require-or-define": "off",
        "sonarjs/no-associative-arrays": "error",
        "sonarjs/comma-or-logical-or-case": "error",
        "sonarjs/inconsistent-function-call": "error",
        "sonarjs/operation-returning-nan": "off",
        "sonarjs/values-not-convertible-to-numbers": "off",
        "sonarjs/non-number-in-arithmetic-expression": "off",
        "sonarjs/argument-type": "error",
        "sonarjs/in-operator-type-error": "error",
        "sonarjs/array-callback-without-return": "error",
        "sonarjs/declarations-in-global-scope": "off",
        "sonarjs/function-return-type": "error",
        "sonarjs/no-inconsistent-returns": "off",
        "sonarjs/no-reference-error": "off",
        "sonarjs/no-all-duplicated-branches": "error",
        "sonarjs/no-same-line-conditional": "error",
        "sonarjs/conditional-indentation": "off",
        "sonarjs/no-collection-size-mischeck": "warn",
        "sonarjs/no-unthrown-error": "error",
        "sonarjs/no-os-command-from-path": "error",
        "sonarjs/no-misleading-array-reverse": "error",
        "sonarjs/no-for-in-iterable": "off",
        "sonarjs/no-element-overwrite": "error",
        "sonarjs/no-identical-functions": "error",
        "sonarjs/no-redundant-assignments": "error",
        "sonarjs/prefer-type-guard": "error",
        "sonarjs/use-type-alias": "error",
        "sonarjs/no-return-type-any": "off",
        "sonarjs/no-implicit-dependencies": "off",
        "sonarjs/no-useless-intersection": "error",
        "sonarjs/weak-ssl": "error",
        "sonarjs/no-weak-keys": "error",
        "sonarjs/csrf": "error",
        "sonarjs/production-debug": "error",
        "sonarjs/prefer-default-last": "error",
        "sonarjs/no-in-misuse": "error",
        "sonarjs/no-duplicate-in-composite": "error",
        "sonarjs/max-union-size": "off",
        "sonarjs/no-undefined-argument": "error",
        "sonarjs/no-nested-template-literals": "error",
        "sonarjs/prefer-promise-shorthand": "error",
        "sonarjs/os-command": "error",
        "sonarjs/no-redundant-optional": "error",
        "sonarjs/hashing": "error",
        "sonarjs/bool-param-default": "off",
        "sonarjs/no-try-promise": "error",
        "sonarjs/unverified-certificate": "error",
        "sonarjs/no-unsafe-unzip": "off",
        "sonarjs/cors": "error",
        "sonarjs/link-with-target-blank": "error",
        "sonarjs/disabled-auto-escaping": "error",
        "sonarjs/table-header": "error",
        "sonarjs/no-table-as-layout": "error",
        "sonarjs/table-header-reference": "error",
        "sonarjs/object-alt-content": "error",
        "sonarjs/no-clear-text-protocols": "error",
        "sonarjs/publicly-writable-directories": "error",
        "sonarjs/unverified-hostname": "error",
        "sonarjs/encryption-secure-mode": "error",
        "sonarjs/no-weak-cipher": "error",
        "sonarjs/no-intrusive-permissions": "error",
        "sonarjs/insecure-jwt-token": "error",
        "sonarjs/x-powered-by": "error",
        "sonarjs/hidden-files": "error",
        "sonarjs/content-length": "error",
        "sonarjs/disabled-resource-integrity": "error",
        "sonarjs/content-security-policy": "error",
        "sonarjs/no-mixed-content": "error",
        "sonarjs/frame-ancestors": "error",
        "sonarjs/no-mime-sniff": "error",
        "sonarjs/no-referrer-policy": "error",
        "sonarjs/strict-transport-security": "error",
        "sonarjs/confidential-information-logging": "error",
        "sonarjs/no-ip-forward": "error",
        "sonarjs/empty-string-repetition": "error",
        "sonarjs/regex-complexity": "error",
        "sonarjs/anchor-precedence": "error",
        "sonarjs/slow-regex": "error",
        "sonarjs/no-invalid-regexp": "error",
        "sonarjs/unused-named-groups": "error",
        "sonarjs/no-same-argument-assert": "error",
        "sonarjs/unicode-aware-regex": "off",
        "sonarjs/no-misleading-character-class": "error",
        "sonarjs/duplicates-in-character-class": "error",
        "sonarjs/session-regeneration": "error",
        "sonarjs/test-check-exception": "error",
        "sonarjs/stable-tests": "error",
        "sonarjs/no-empty-after-reluctant": "error",
        "sonarjs/single-character-alternation": "error",
        "sonarjs/no-code-after-done": "error",
        "sonarjs/disabled-timeout": "error",
        "sonarjs/chai-determinate-assertion": "error",
        "sonarjs/aws-s3-bucket-insecure-http": "error",
        "sonarjs/aws-s3-bucket-versioning": "error",
        "sonarjs/aws-s3-bucket-granted-access": "error",
        "sonarjs/no-angular-bypass-sanitization": "error",
        "sonarjs/aws-iam-public-access": "error",
        "sonarjs/aws-ec2-unencrypted-ebs-volume": "error",
        "sonarjs/aws-s3-bucket-public-access": "error",
        "sonarjs/aws-iam-all-privileges": "error",
        "sonarjs/aws-rds-unencrypted-databases": "error",
        "sonarjs/aws-iam-all-resources-accessible": "off",
        "sonarjs/aws-opensearchservice-domain": "error",
        "sonarjs/aws-iam-privilege-escalation": "error",
        "sonarjs/aws-sagemaker-unencrypted-notebook": "error",
        "sonarjs/aws-restricted-ip-admin-access": "error",
        "sonarjs/no-empty-alternatives": "error",
        "sonarjs/no-control-regex": "error",
        "sonarjs/no-regex-spaces": "error",
        "sonarjs/aws-sns-unencrypted-topics": "error",
        "sonarjs/existing-groups": "error",
        "sonarjs/aws-ec2-rds-dms-public": "error",
        "sonarjs/aws-sqs-unencrypted-queue": "error",
        "sonarjs/no-empty-group": "error",
        "sonarjs/aws-efs-unencrypted": "error",
        "sonarjs/aws-apigateway-public-api": "error",
        "sonarjs/stateful-regex": "error",
        "sonarjs/concise-regex": "error",
        "sonarjs/single-char-in-character-classes": "error",
        "sonarjs/no-hardcoded-secrets": "error",
        "sonarjs/no-exclusive-tests": "error",
        "sonarjs/hardcoded-secret-signatures": "error",
        "sonarjs/jsx-no-leaked-render": "error",
        "sonarjs/no-hook-setter-in-body": "error",
        "sonarjs/no-useless-react-setstate": "error",
        "sonarjs/no-uniq-key": "error",
        "sonarjs/redundant-type-aliases": "error",
        "sonarjs/prefer-regexp-exec": "error",
        "sonarjs/no-internal-api-use": "error",
        "sonarjs/prefer-read-only-props": "error",
        "sonarjs/no-literal-call": "error",
        "sonarjs/reduce-initial-value": "error",
        "sonarjs/no-async-constructor": "error",
        "sonarjs/review-blockchain-mnemonic": "error",
        "sonarjs/dynamically-constructed-templates": "error",
        "sonarjs/no-session-cookies-on-static-assets": "error",
        "sonarjs/dompurify-unsafe-config": "error",
        "regexp/confusing-quantifier": "warn",
        "regexp/control-character-escape": "error",
        "regexp/match-any": "error",
        "regexp/negation": "error",
        "regexp/no-contradiction-with-assertion": "error",
        "regexp/no-dupe-characters-character-class": "error",
        "regexp/no-dupe-disjunctions": "error",
        "regexp/no-empty-alternative": "warn",
        "regexp/no-empty-capturing-group": "error",
        "regexp/no-empty-character-class": "error",
        "regexp/no-empty-group": "error",
        "regexp/no-empty-lookarounds-assertion": "error",
        "regexp/no-empty-string-literal": "error",
        "regexp/no-escape-backspace": "error",
        "regexp/no-extra-lookaround-assertions": "error",
        "regexp/no-invalid-regexp": "error",
        "regexp/no-invisible-character": "error",
        "regexp/no-lazy-ends": "warn",
        "regexp/no-legacy-features": "error",
        "regexp/no-misleading-capturing-group": "error",
        "regexp/no-misleading-unicode-character": "error",
        "regexp/no-missing-g-flag": "error",
        "regexp/no-non-standard-flag": "error",
        "regexp/no-obscure-range": "error",
        "regexp/no-optional-assertion": "error",
        "regexp/no-potentially-useless-backreference": "warn",
        "regexp/no-super-linear-backtracking": "error",
        "regexp/no-trivially-nested-assertion": "error",
        "regexp/no-trivially-nested-quantifier": "error",
        "regexp/no-unused-capturing-group": "error",
        "regexp/no-useless-assertions": "error",
        "regexp/no-useless-backreference": "error",
        "regexp/no-useless-character-class": "error",
        "regexp/no-useless-dollar-replacements": "error",
        "regexp/no-useless-escape": "error",
        "regexp/no-useless-flag": "warn",
        "regexp/no-useless-lazy": "error",
        "regexp/no-useless-non-capturing-group": "error",
        "regexp/no-useless-quantifier": "error",
        "regexp/no-useless-range": "error",
        "regexp/no-useless-set-operand": "error",
        "regexp/no-useless-string-literal": "error",
        "regexp/no-useless-two-nums-quantifier": "error",
        "regexp/no-zero-quantifier": "error",
        "regexp/optimal-lookaround-quantifier": "warn",
        "regexp/optimal-quantifier-concatenation": "error",
        "regexp/prefer-character-class": "error",
        "regexp/prefer-d": "error",
        "regexp/prefer-plus-quantifier": "error",
        "regexp/prefer-predefined-assertion": "error",
        "regexp/prefer-question-quantifier": "error",
        "regexp/prefer-range": "error",
        "regexp/prefer-set-operation": "error",
        "regexp/prefer-star-quantifier": "error",
        "regexp/prefer-unicode-codepoint-escapes": "error",
        "regexp/prefer-w": "error",
        "regexp/simplify-set-operations": "error",
        "regexp/sort-flags": "error",
        "regexp/strict": "error",
        "regexp/use-ignore-case": "error",
        "depend/ban-dependencies": [
          "warn",
          {
            "presets": [
              "native",
              "microutilities",
              "preferred"
            ]
          }
        ],
        "no-loop-func": "warn",
        "no-shadow": [
          "error",
          {
            "hoist": "functions-and-types"
          }
        ],
        "prefer-const": "warn",
  },
  "globals": {
    "document": "readonly",
    "window": "readonly",
    "NodeJS": "readonly",
    "test": "readonly",
    "afterAll": "readonly",
    "beforeAll": "readonly",
    "describe": "readonly",
    "process": "readonly",
    "setTimeout": "readonly",
    "setInterval": "readonly",
    "clearInterval": "readonly",
    "clearTimeout": "readonly",
    "console": "readonly",
    "Buffer": "readonly",
    "structuredClone": "readonly",
    "addEventListener": "readonly",
    "defineProps": "readonly",
    "defineEmits": "readonly",
    "defineModel": "readonly",
    "withDefaults": "readonly",
    "ResizeObserver": "readonly",
	  "Mesh": "readonly",
    "WebGL2RenderingContext": "readonly",
    "navigator": "readonly"
  }
}

What happened?

I have for loops that contains a switch statement. Each switch case ends with its break. This break is interpreted as a for loop break so it seems this loop has only one iteration. Here is one of them:

  eslint(no-unreachable-loop): Invalid loop. Its body allows only one iteration.
     ╭─[src/renderers/DrawStructureRenderer.ts:337:4]
 336                  // Render atoms
 337  ╭─▶             for(const atom of renderInfo.atoms) {
 338  
 339                     const {position, rCov, rVdW} = atom;
 340                     let radius;
 341                     switch(drawKind) {
 342                         case "ball-and-stick":
 343                             radius = rCov*R_COV_SCALE*spheresRadiusMultiplier;
 344                             break;
 345                         case "van-der-waals":
 346                             radius = rVdW;
 347                             break;
 348                         case "licorice":
 349                             radius = BOND_RADIUS*bondsRadiusMultiplier;
 350                             break;
 351                         default:
 352                             radius = R_COV_SCALE;
 353                             break;
 354                     }
 355  
 356                     const sphereColor = this.computeAtomColor(atomColoring, atom, monochromeColor);
 357                     spheresCache.addSphere(position, radius, sphereColor);
 358  ╰─▶             }
 359                  spheresCache.renderSpheres(this.atomsGroup);
     ╰────
  help: Remove the loop or make at least one path continue to the next iteration.

This problem has been introduced in 1.73.0. Previous version (1.72.0) was working perfectly.

Metadata

Metadata

Assignees

Labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions