Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
const str = 'Test';
const string1 = 'string1';
const string2 = 'string2';
enum Invalid {
A = str, // Variable assignment
B = `Interpolates ${string1} and ${string2}`, // Template literal with interpolation
C = 2 + 2, // Expression assignment
D = C, // Assignment to another enum member
}enum Valid {
A, // No initializer; initialized with ascending integers starting from 0
B = 'TestStr', // A regular string
C = `A template literal string`, // A template literal without interpolation
D = 4, // A number
}Popular · 1 of 9
Require all enum members to be literal values
const str = 'Test';
const string1 = 'string1';
const string2 = 'string2';
enum Invalid {
A = str, // Variable assignment
B = `Interpolates ${string1} and ${string2}`, // Template literal with interpolation
C = 2 + 2, // Expression assignment
D = C, // Assignment to another enum member
}enum Valid {
A, // No initializer; initialized with ascending integers starting from 0
B = 'TestStr', // A regular string
C = `A template literal string`, // A template literal without interpolation
D = 4, // A number
}