An ESLint plugin that disallows comment blocks in source code to prevent shipping notes, old code, or sensitive information to production. Current stable version is 1.2.1, released with support for ESLint 9 and 10 via flat config format. Requires Node.js >= 20.19.0. Key differentiator: automatically ignores comments starting with 'global' or 'eslint' to preserve ESLint directives, and allows a customizable allow list. Unlike general comment-stripping tools, it integrates directly with ESLint's rule system.
npm install eslint-plugin-no-commentsVerified import paths — ran on the pinned version, not inferred.
Configures the plugin to error on all comments except those starting with 'global', 'eslint', 'TODO', or 'FIXME'. Uses the flat config format required since v1.2.0.
Migrate to eslint.config.js using the flat config pattern shown in the quickstart. See https://eslint.org/docs/latest/use/configure/configuration-files-new
Update Node.js to v20.19.0 or higher. Run: nvm install 20.19.0 (or use your version manager).
Upgrade to v1.2.0+ and migrate to flat config. The old versions are no longer maintained.
Always include 'eslint' and 'global' in the `allow` array if you want those comments to be allowed. See the README example with 'global', 'eslint', 'TODO', 'FIXME'.
Ensure all allowed comments start with one of the strings in the `allow` array (or the defaults). For example, '// TODO' works but '//TODO' without space may not be recognized if the pattern is strict.
Switch to import syntax and flat config: import noComments from 'eslint-plugin-no-comments'; in eslint.config.js.
In eslint.config.js, export an array with an object containing plugins: { 'no-comments': noComments }.Use array syntax: 'no-comments/disallowComments': ['error', { allow: [...] }]