eslint-plugin-smells

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript maintenance

eslint-plugin-smells is an ESLint plugin that provides rules to detect code smells in JavaScript. Version 1.0.1 is the latest release. The plugin includes rules such as no-switch, no-complex-switch-case, no-setinterval, no-this-assign, no-complex-string-concat, and no-complex-chaining. It helps enforce cleaner coding practices by flagging common anti-patterns. The project is maintained but has not seen recent updates. It requires ESLint as a peer dependency and is used as an ESLint plugin via the plugins configuration.

error Error: Failed to load plugin 'smells': Cannot find module 'eslint-plugin-smells'
cause Plugin not installed or incorrectly referenced in ESLint config.
fix
Run npm install eslint-plugin-smells --save-dev and verify package is in node_modules.
error ESLint: Invalid severity for rule 'smells/no-switch': expected 0, 1, or 2, got true
cause Boolean value used instead of numeric severity.
fix
Set severity to 1 (warning) or 2 (error), not true.
error ESLint: Definition for rule 'smells/no-switch' was not found
cause Plugin not added to plugins array or rule name misspelled.
fix
Add 'smells' to plugins in .eslintrc and ensure rule name is exactly 'smells/no-switch'.
gotcha Rules must be prefixed with 'smells/' in the rules configuration.
fix Use 'smells/no-switch' instead of 'no-switch'.
gotcha Plugin does not export individual rules; import the whole package.
fix Install and configure via .eslintrc plugins array.
deprecated Repository has not been updated since 2017, and no new rules have been added.
fix Consider alternative plugins like eslint-plugin-sonarjs for more active development.
npm install eslint-plugin-smells
yarn add eslint-plugin-smells
pnpm add eslint-plugin-smells

Minimal ESLint configuration to enable all code smell rules from eslint-plugin-smells.

{
  "plugins": ["smells"],
  "rules": {
    "smells/no-switch": 1,
    "smells/no-complex-switch-case": 1,
    "smells/no-setinterval": 1,
    "smells/no-this-assign": 1,
    "smells/no-complex-string-concat": 1,
    "smells/no-complex-chaining": 1
  }
}