mysticatea / eslint-plugin-eslint-comments

Additional ESLint rules for directive comments of ESLint.
https://mysticatea.github.io/eslint-plugin-eslint-comments/
MIT License
361 stars 46 forks source link

[no-unused-disable] incorrect reporting on single line with multi disable rules #57

Open JounQin opened 3 years ago

JounQin commented 3 years ago
export const getAvailableIPs = (subnet: Subnet) => {
  const protocol = subnet?.spec?.protocol;
  const { availableIPs, v4availableIPs, v6availableIPs } = subnet?.status || {};
  switch (protocol) {
    case 'IPv4':
    // eslint-disable-next-line default-case-last, no-fallthrough
    default: {
      return v4availableIPs ?? availableIPs;
    }
    case 'IPv6':
      return v6availableIPs ?? availableIPs;
    case 'Dual': {
      if (v4availableIPs == null) {
        return v4availableIPs ?? availableIPs;
      }

      if (v6availableIPs == null) {
        return v4availableIPs ?? availableIPs;
      }

      return Math.min(v4availableIPs, v4availableIPs);
    }
  }
};
✘  eslint-comments/no-unused-disable

     'no-fallthrough' rule is disabled but never reported

Of course, it helps me to move 'IPv4' and 'default' to the last case. 🤣

But it indeed a bug of this rule.


Additionally, this rule seems unsafe to use, because we can not disable this rule itself inline.

related #50

Delagen commented 3 years ago

The same

error: 'eslint-comments/no-unused-disable' rule is disabled but never reported (eslint-commen
ts/no-unused-disable) at src\types\services\type-registry.loader.ts:4:20:
> 4 | /* eslint-disable  eslint-comments/no-unused-disable -- автосгенерированный код */
MichaelDeBoey commented 1 year ago

Hi @JounQin!

Since this repo is unmaintained, you might want to re-open this issue in the @eslint-community fork https://github.com/eslint-community/eslint-plugin-eslint-comments

For more info about why we created this organization, you can read https://eslint.org/blog/2023/03/announcing-eslint-community-org