{"id":19710,"library":"eslint-plugin-cflint","title":"eslint-plugin-cflint","description":"ESLint plugin providing two custom CloudFlare-specific linting rules: `no-substr` (prevents use of `String.prototype.substr`, considered legacy) and `no-this-assignment` (prevents assigning `this` to a variable). Current stable version is 1.0.0, initially released with no further updates. It requires ESLint as a peer dependency. Differentiators: lightweight and focused exclusively on patterns flagged internally by CloudFlare; minimal setup and no extra dependencies. Release cadence: single release, no maintenance indicated.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/cloudflare/eslint-plugin-cflint","tags":["javascript","eslint","eslintplugin"],"install":[{"cmd":"npm install eslint-plugin-cflint","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-cflint","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-cflint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for plugin to function as an ESLint rule provider.","package":"eslint","optional":false}],"imports":[{"note":"ESM import works if project supports it; CommonJS require also works since plugin exports a single object.","wrong":"const plugin = require('eslint-plugin-cflint')","symbol":"plugin","correct":"import plugin from 'eslint-plugin-cflint'"},{"note":"Named export for rules object, can be used in custom config.","wrong":"const { rules } = require('eslint-plugin-cflint')","symbol":"rules","correct":"import { rules } from 'eslint-plugin-cflint'"},{"note":"Configs export is provided as an object; not commonly used.","wrong":null,"symbol":"configs","correct":"import { configs } from 'eslint-plugin-cflint'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['cflint'],\n  rules: {\n    'cflint/no-substr': 'error',\n    'cflint/no-this-assignment': 'error'\n  }\n};\n\n// Example code that will be flagged:\nlet s = 'hello';\nconsole.log(s.substr(0, 2)); // Error: no-substr\n\nlet self = this; // Error: no-this-assignment","lang":"javascript","description":"Configuration to enable both CloudFlare rules and examples of code that triggers them."},"warnings":[{"fix":"Review the rules list; supplement with other ESLint plugins if needed.","message":"Plugin has only two rules; may not meet expectations for broader linting.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using built-in ESLint rules like 'no-restricted-properties' for substr.","message":"Rules are deprecated within CloudFlare; no longer actively maintained.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add 'cflint/no-substr' and 'cflint/no-this-assignment' manually to rules.","message":"Plugin does not provide any shared configs (e.g., 'recommended'). Must be manually configured.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install eslint-plugin-cflint --save-dev` and ensure node_modules contains the package.","cause":"Plugin not installed or ESLint cannot locate it.","error":"ESLint: Failed to load plugin 'cflint': Cannot find module 'eslint-plugin-cflint'"},{"fix":"Use 'error', 'warn', 'off' (or 2, 1, 0) as rule values.","cause":"Incorrect rule severity value in ESLint config.","error":"ESLint: Configuration for rule \"cflint/no-substr\" is invalid. Severity should be one of: 0, 1, 2, \"off\", \"warn\", \"error\"."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}