Skip to content

restrictedIdentifiers

Disallows specific identifier names in binding positions.

✅ This rule is included in the ts stylisticStrict presets.

Some projects like to ban specific identifiers, or names, in code. This rule provides a deny option that can be used to disallow specific identifier names.

Type: string[]

Identifier names to globally disallow.

json.rules({
restrictedIdentifiers: {
deny: ["cb", "val"],
},
});
const val = fetchUsers();
function cb() {}
function process(val, cb) {}
import val from "lib";

This rule is only relevant for projects that have established conventions of names that should not be used. If you’re not particular about banning specific identifier names, you likely don’t need this rule.

Made with ❤️‍🔥 around the world by the Flint team and contributors.