TypeScript (and JavaScript) Plugin
Rules for linting JavaScript and TypeScript code, including the latest and greatest powerful typed linting rules.
This plugin comes packaged with the flint npm package.
Presets
Section titled “Presets”Flint’s TypeScript plugin provides the following presets:
| Preset | Recommended | Description |
|---|---|---|
logical | ✅ Always | Common rules for finding bugs and enforcing good logical practices. |
logicalStrict | ☑️ When Ready | Additional rules for finding bugs and enforcing good logical practices. |
stylistic | ✅ Always | Common rules for consistent styling and best stylistic practices. |
stylisticStrict | ☑️ When Ready | Additional rules for consistent styling and best stylistic practices. |
untyped | Extra rules for files that aren’t type-checked by TypeScript. |
If you are just getting started with linting, Flint recommends using the logical and stylistic presets:
import { defineConfig, ts } from "flint";
export default defineConfig({ use: [ { files: ts.files.all, rules: [ts.presets.logical, ts.presets.stylistic], }, ],});If you are experienced with both JavaScript/TypeScript and linting, Flint recommends using the logicalStrict and stylisticStrict presets:
import { defineConfig, ts } from "flint";
export default defineConfig({ use: [ { files: ts.files.all, rules: [ts.presets.logicalStrict, ts.presets.stylisticStrict], }, ],});logical
Section titled “logical”Rules that find bugs and enforce good logical practices for most-to-all JavaScript and TypeScript files.
import { defineConfig, ts } from "flint";
export default defineConfig({ use: [ { files: ts.files.all, rules: ts.presets.logical, }, ],});logicalStrict
Section titled “logicalStrict”Additional logical rules that enforce best practices which are not always straightforward to implement. These rules are recommended for projects where a majority of developers are experienced with both JavaScript/TypeScript and using a linter.
import { defineConfig, ts } from "flint";
export default defineConfig({ use: [ { files: ts.files.all, rules: ts.presets.logicalStrict, }, ],});This preset’s rules are a superset of those in logical.
stylistic
Section titled “stylistic”Rules that enforce consistent styling and best stylistic practices for most-to-all JavaScript and TypeScript files.
import { defineConfig, ts } from "flint";
export default defineConfig({ use: [ { files: ts.files.all, rules: ts.presets.stylistic, }, ],});stylisticStrict
Section titled “stylisticStrict”Additional stylistic rules that enforce best practices which are not always straightforward to implement. These rules are recommended for projects where a majority of developers are experienced with both JavaScript/TypeScript and using a linter.
import { defineConfig, ts } from "flint";
export default defineConfig({ use: [ { files: ts.files.all, rules: ts.presets.stylisticStrict, }, ],});This preset’s rules are a superset of those in stylistic.
untyped
Section titled “untyped”Rules that fill in rudimentary safety practices that would normally be caught by TypeScript.
import { defineConfig, ts } from "flint";
export default defineConfig({ use: [ { files: ts.files.all, rules: ts.presets.untyped, }, ],});The untyped preset is broadly applicable for JavaScript files that aren’t type-checked by TypeScript.
For long-lived projects, Flint recommends using this only as a stopgap measure pending converting files fully to TypeScript.
Implemented: 244 of 404 (60.3%)
| Flint Rule | Preset |
|---|---|
accessorPairTypesReports mismatched types between getter and setter accessor pairs. | logical |
anyArgumentsReports calling a function with a value typed as any as an argument. | logical |
anyAssignmentsReports assigning a value with type any to variables and properties. | logical |
anyCallsReports calling a value with type any. | logical |
anyMemberAccessReports member access on a value with type any. | logical |
anyReturnsReports returning a value with type any from a function. | logical |
argumentsReports using the arguments object instead of rest parameters. | logical |
arrayConstructorsReports using the Array constructor to create arrays instead of array literal syntax. | logical |
arrayElementDeletionsReports using the delete operator on array values. | logical |
arrayEmptyCallbackSlotsReports array methods with callbacks that will never be invoked on arrays with empty slots. | logical |
arrayMapIdentitiesReports using .flatMap() with an identity function that returns its argument unchanged. | logical |
arrayUnnecessaryLengthChecksReports unnecessary array length checks before .some() or .every() calls. | logical |
asyncFunctionAwaits | logical |
asyncPromiseExecutorsReports using async functions as Promise executor functions. | logical |
asyncUnnecessaryPromiseWrappersReports unnecessary Promise.resolve() or Promise.reject() in async contexts. | logical |
awaitThenable | logical |
caseDuplicatesReports switch statements with duplicate case clause test expressions. | logical |
caseFallthroughsReports switch case clauses that fall through unexpectedly. | logical |
catchCallbackTypesReports Promise catch callback parameters that are not typed as unknown. | logical |
charAtComparisonsReports comparing charAt() results with strings longer than one character. | logical |
constVariables | logical |
dateConstructorClonesPrefer passing a Date directly to the Date constructor when cloning, rather than calling getTime(). | logical |
debuggerStatementsReports using debugger statements. | logical |
defaultCaseLastReports switch statements where the default clause is not last. | logical |
deprecatedDisallow using code marked as @deprecated. | logical |
dynamicDeletesDisallow using the delete operator on computed key expressions. | logical |
elseIfDuplicatesReports duplicate conditions in if-else-if chains that make code unreachable. | logical |
emptyDestructuresReports using empty destructuring patterns that destructure no values. | logical |
emptyEnumsReports empty enum declarations with no members. | logical |
emptyExportsReports empty export statements that don't make a file a module. | logical |
emptyObjectTypesReports empty object type literals and empty interfaces that are often used incorrectly. | logical |
enumMixedValues | logical |
enumValueConsistencyReports enums that contain both string and number members. | logical |
enumValueDuplicatesReports enum members with duplicate values. | logical |
equalityOperators | logical |
errorUnnecessaryCaptureStackTracesReports unnecessary Error.captureStackTrace() calls in Error subclass constructors. | logical |
evalsReports uses of the eval function. | logical |
exceptionAssignmentsReports reassigning exception parameters in catch clauses. | logical |
explicitAnysReports explicit uses of the any type. | logical |
exportMutablesReports exporting mutable bindings (let or var). | logical |
fetchMethodBodiesDisallow providing a body with GET or HEAD fetch requests. | logical |
finallyStatementSafetyReports control flow statements in finally blocks that can override control flow in try/catch blocks. | logical |
floatingPromises | logical |
forInArraysReports iterating over an array with a for-in loop. | logical |
functionCurryingRedundancyReports using .apply() or .call() or when the context (this value) provides no benefit. | logical |
functionNewCallsReports using the Function constructor to create functions from strings. | logical |
generatorFunctionYieldsReports generator functions that do not yield values. | logical |
impliedEvalsReports using string arguments in setTimeout, setInterval, setImmediate, execScript, or the Function constructor. | logical |
importEmptyBlocksReports empty named import blocks. | logical |
importSelf | logical |
importTypeSideEffectsReports imports that use inline type qualifiers on all specifiers when a top-level type qualifier should be used instead. | logical |
instanceOfArraysReports using instanceof Array instead of Array.isArray(). | logical |
irregularWhitespacesReports irregular whitespace characters that can cause issues with code parsing and display. | logical |
isNaNComparisonsReports comparisons with NaN, which should use Number.isNaN() instead. | logical |
meaninglessVoidOperatorsReports using the void operator on expressions that are already void or undefined. | logical |
misleadingVoidExpressionsRequire expressions of type void to appear in statement position. | logical |
misusedPromises | logical |
moduleSpecifierListsRequire non-empty specifier lists in import and export statements. | logical |
namespaceDeclarationsReports using legacy namespace declarations. | logical |
negativeZeroComparisonsReports comparisons with -0 that may not behave as expected. | logical |
newDefinitionsReports misleading constructor and new definitions in interfaces and classes. | logical |
newExpressionsReports standalone new expressions that don't use the constructed object. | logical |
nonNullAssertedOptionalChainsReports non-null assertions on optional chain expressions. | logical |
nonOctalDecimalEscapesReports non-octal decimal escape sequences (\8 and \9) in string literals. | logical |
numberMethodRangesReports when number method arguments are outside their valid range. | logical |
numericErasingOperationsReports operations that always result in zero, such as multiplication by zero. | logical |
numericPrecisionReports numeric literals that lose precision when converted to JavaScript numbers. | logical |
objectCallsPrefer {} object literal notation or Object.create instead of calling or constructing Object. | logical |
objectPrototypeBuiltInsReports direct calls to Object.prototype methods on object instances. | logical |
objectSpreadUnnecessaryFallbacksReports empty object fallbacks in object spread expressions that have no effect. | logical |
parameterPropertyAssignment | logical |
parameterReassignmentsDisallow reassignment of function parameters. | logical |
parseIntRadixesReports parseInt calls that are missing or have an invalid radix parameter. | logical |
plusOperands | logical |
promiseExecutorReturns | logical |
promiseFinallyReturns | logical |
promiseMethodSingleArrayArguments | logical |
promiseRejectErrors | logical |
recursionOnlyArgumentsReports function parameters that are only used in recursive calls. | logical |
redundantTypeConstituentsReports union and intersection type constituents that are redundant or override other types. | logical |
regexAllGlobalFlagsReports matchAll() and replaceAll() calls with regex arguments missing the global flag. | logical |
regexAmbiguousInvalidityReports regex patterns that use ambiguous or invalid syntax from Annex B. | logical |
regexContradictoryAssertionsReports elements in regular expressions that contradict assertions. | logical |
regexControlCharacterEscapesReports control characters that are not escaped using standard escape sequences. | logical |
regexControlCharactersReports control characters in regular expressions. | logical |
regexDuplicateCharacterClassCharactersReports duplicate characters in regular expression character classes. | logical |
regexDuplicateDisjunctions | logical |
regexEmptyAlternativesReports empty alternatives in regular expressions that may indicate a mistake. | logical |
regexEmptyCapturingGroupsReports capturing groups that only capture empty strings. | logical |
regexEmptyCharacterClassesReports character classes that match no characters. | logical |
regexEmptyGroupsReports empty groups in regular expressions. | logical |
regexEmptyLazyQuantifiersReports lazy quantifiers at the end of regular expressions. | logical |
regexEmptyLookaroundsAssertionsReports empty lookahead and lookbehind assertions in regular expressions. | logical |
regexEmptyStringLiteralsReports empty string literals in character classes. | logical |
regexIgnoreCaseFlagsReports regex patterns that can be simplified by using the i (ignore case) flag. | logical |
regexInvisibleCharactersReports invisible characters in regex patterns that should use escape sequences instead. | logical |
regexLiteralsUse a regular expression literal when the pattern is static. | logical |
regexLookaroundQuantifierOptimizationsReports non-constant quantifiers in lookaround assertions that could be simplified. | logical |
regexMisleadingCapturingGroupsReports capturing groups that capture less text than their pattern suggests. | logical |
regexMisleadingQuantifiersReports quantifiers whose minimum implies they must match but whose element can match empty. | logical |
regexMisleadingUnicodeCharactersReports characters in regex character classes that appear as single visual characters but are made of multiple code points. | logical |
regexNonStandardFlagsReports non-standard regular expression flags. | logical |
regexObscureRangesReports obscure character ranges in regular expressions. | logical |
regexOctalEscapesReports octal escape sequences in regular expressions. | logical |
regexQuantifierOptimizations | logical |
regexSetOperationOptimizationsReports set operations in regular expressions that can be simplified. | logical |
regexStandaloneBackslashesReports standalone backslashes in regex patterns that look like incomplete escape sequences. | logical |
regexSuperLinearBacktrackingReports regular expressions with exponential or polynomial backtracking. | logical |
regexSuperLinearMovesReports quantifiers that can cause quadratic regex matching time. | logical |
regexUnnecessaryAssertions | logical |
regexUnnecessaryBackreferences | logical |
regexUnnecessaryCharacterClassesReports character classes that wrap a single element that does not require brackets. | logical |
regexUnnecessaryCharacterRangesReports character class ranges that span only one or two characters. | logical |
regexUnnecessaryDisjunctionsReports single-character alternatives in string disjunctions. | logical |
regexUnnecessaryDollarReplacementsReports replacement string references to capturing groups that do not exist in the pattern. | logical |
regexUnnecessaryLookaroundAssertions | logical |
regexUnnecessaryNestedAssertions | logical |
regexUnnecessaryNestedQuantifiers | logical |
regexUnnecessaryNumericQuantifiers | logical |
regexUnnecessaryOptionalAssertions | logical |
regexUnnecessaryReferentialBackreferences | logical |
regexUnnecessarySetOperands | logical |
regexUnusedCapturingGroups | logical |
regexUnusedFlags | logical |
regexUnusedLazyQuantifiers | logical |
regexUnusedQuantifiers | logical |
regexValidity | logical |
regexZeroQuantifiers | logical |
requireImports | logical |
returnAwaitPromises | logical |
selfAssignmentsReports self-assignments which have no effect and are likely errors. | logical |
singleVariableDeclarations | logical |
sparseArraysReports array literals with holes (sparse arrays). | logical |
strictBooleanExpressions | logical |
stringCaseMismatches | logical |
templateExpressionValues | logical |
thisAliases | logical |
throwErrors | logical |
tripleSlashReferences | logical |
tripleSlashReferenceValidity | logical |
tsComments | logical |
typeConstituentDuplicates | logical |
unboundMethods | logical |
unnecessaryBind | logical |
unnecessaryCatchesReports catch clauses that only rethrow the caught error without modification. | logical |
unnecessaryComparisons | logical |
unnecessaryConditions | logical |
unnecessaryContinues | logical |
unnecessaryLogicalComparisons | logical |
unnecessaryMathClamps | logical |
unnecessaryNumericFractions | logical |
unnecessarySpreads | logical |
unnecessaryTemplateExpressions | logical |
unnecessaryTypeArguments | logical |
unnecessaryTypeAssertions | logical |
unnecessaryTypeConstraints | logical |
unnecessaryTypeConversions | logical |
unnecessaryTypeParameters | logical |
unnecessaryUndefinedDefaults | logical |
unnecessaryUseStricts | logical |
unsafeDeclarationmerging | logical |
unsafeEnumComparisons | logical |
unsafeFunctionTypes | logical |
unsafeToString | logical |
unsafeTypeAssertions | logical |
unsafeUnaryNegations | logical |
unusedExpressions | logical |
unusedPrivateClassMembers | logical |
unusedSwitchStatements | logical |
unusedValues | logical |
unusedVariables | logical |
uselessDefaultAssignments | logical |
wrapperObjectsFlags using new with Boolean, Number, or String, which creates wrapper objects instead of primitives. | logical |
wrapperObjectTypes | logical |
accessorThisRecursionReports recursive access to this within getters and setters. | logical (strict) |
arrayReduceTypeArgumentsReports Array#reduce calls using type assertions on initial values instead of type arguments. | logical (strict) |
awaitInsidePromiseMethods | logical (strict) |
caughtErrorCauses | logical (strict) |
dateNowTimestampsPrefer the shorter Date.now() to get the number of milliseconds since the Unix Epoch. | logical (strict) |
directivePairs | logical (strict) |
enumMemberLiteralsRequires all enum members to be literal values. | logical (strict) |
errorMessagesRequires a message value when creating a built-in error. | logical (strict) |
errorSubclassPropertiesReports incorrect Error subclass definitions that don't follow best practices. | logical (strict) |
invalidVoidTypes | logical (strict) |
nonNullAssertedNullishCoalescesReports non-null assertions on the left side of nullish coalescing operators. | logical (strict) |
nonNullAssertions | logical (strict) |
numberStaticMethodsReports using legacy global functions instead of Number static methods. | logical (strict) |
returnThisTypes | logical (strict) |
selfComparisonsReports comparing a value to itself. | logical (strict) |
stringCodePoints | logical (strict) |
unifiedSignatures | logical (strict) |
extraneousClassesReports classes used as static namespaces. | logicalStrict |
importExtraneousDependencies | none |
accessorPairGroupsReports getter and setter accessors for the same property that are not adjacent. | stylistic |
arrayDeleteUnnecessaryCountsReports using .length or Infinity as the deleteCount or skipCount argument of Array#splice() or Array#toSpliced(). | stylistic |
arrayExistenceChecksConsistencyReports inconsistent styles for checking element existence using index methods. | stylistic |
arrayFindsReports using .filter()[0] instead of .find() when looking for a single element. | stylistic |
arrayFlatUnnecessaryDepthsReports using 1 as the depth argument of .flat() since it is the default. | stylistic |
arrayIncludesReports using .indexOf() comparisons that can be replaced with .includes(). | stylistic |
arrayLoopsReports using .forEach() when a for-of loop can be used. | stylistic |
arrayMutableReversesReports .reverse() calls on arrays that mutate the original array. | stylistic |
arrayMutableSortsReports .sort() calls on arrays that mutate the original array. | stylistic |
arraySliceUnnecessaryEndReports unnecessary end argument in .slice() calls when it equals the length or is Infinity. | stylistic |
arrayTernarySpreadingConsistencyReports inconsistent types when spreading a ternary in an array literal. | stylistic |
arrayTypesReports array type syntax that doesn't match the configured style. | stylistic |
asConstAssertionsReports using explicit literal types when as const can be used. | stylistic |
assignmentOperatorShorthandsPrefer logical assignment operator shorthand expressions. | stylistic |
builtinConstructorNewsEnforces using new for constructors that require it, and disallows new for primitive coercion functions. | stylistic |
chainedAssignmentsReports using chained assignment expressions (e.g., a = b = c). | stylistic |
classLiteralPropertiesReports getters that return literal values instead of using readonly class fields. | stylistic |
consecutiveNonNullAssertionsReports unnecessary extra non-null assertions. | stylistic |
constructorGenericCallsReports inconsistent placement of type arguments in constructor calls. | stylistic |
emptyBlocksReports empty block statements that should contain code. | stylistic |
emptyModuleAttributesReports empty import/export attributes that serve no purpose. | stylistic |
emptyStaticBlocksReports empty static initialization blocks within class declarations. | stylistic |
emptyTypeParameterListsReports empty type parameter lists in type aliases and interfaces. | stylistic |
exponentiationOperatorsPrefers the ** operator over Math.pow(). | stylistic |
exportFromImportsReports imports that are re-exported and could use export...from syntax instead. | stylistic |
forDirectionsReports for loops with counter variables that move in the wrong direction. | stylistic |
functionApplySpreadsPrefer the spread operator over .apply() calls. | stylistic |
functionTypeDeclarations | stylistic |
importCycles | stylistic |
importDuplicates | stylistic |
importUnnecessaryPathSegments | stylistic |
indexedObjectTypesReports indexed object types that don't match the configured style. | stylistic |
jsdocAccessTags | stylistic |
jsdocEmptyBlocks | stylistic |
jsdocEmptyTags | stylistic |
jsdocImplementsTags | stylistic |
jsdocParameterNames | stylistic |
jsdocPropertyNames | stylistic |
jsdocRedundantTypes | stylistic |
jsdocTemplateNames | stylistic |
jsdocTypesSyntax | stylistic |
jsdocUnnecessaryReturns | stylistic |
jsdocUnnecessaryYields | stylistic |
jsdocValidTypes | stylistic |
jsdocValues | stylistic |
jsdocYields | stylistic |
literalConstructorWrappersPrefers literal syntax over constructor function calls for primitive values. | stylistic |
methodSignatureStyles | stylistic |
multilineAmbiguitiesReports ambiguous multiline expressions that could be misinterpreted. | stylistic |
namespaceKeywordsReports using module keyword instead of namespace for TypeScript namespaces. | stylistic |
nestedStandaloneIfsReports if statements that are the only statement inside an else block or inside another if without an else. | stylistic |
nonNullableTypeAssertionsReports type assertions that can be replaced with non-null assertions. | stylistic |
nullishCoalescingOperatorsPrefer nullish coalescing operator (??) over logical OR (||) for nullish values. | stylistic |
numericLiteralParsingReports parseInt calls with binary, hexadecimal, or octal strings that can be replaced with numeric literals. | stylistic |
objectAssignSpreadsPrefer object spread syntax over Object.assign() when the first argument is an object literal. | stylistic |
objectHasOwnsPrefer Object.hasOwn() over Object.prototype.hasOwnProperty.call() for checking own properties. | stylistic |
objectShorthandObject property and method definitions can use shorthand syntax when the key matches the value identifier or when a function expression is assigned. | stylistic |
objectTypeDefinitionsPrefer interface declarations over type aliases for object types. | stylistic |
operatorAssignmentShorthandPrefer assignment operator shorthand where possible. | stylistic |
optionalChainOperators | stylistic |
overloadSignaturesAdjacentRequire that function overload signatures be consecutive. | stylistic |
promiseFunctionAsync | stylistic |
propertyAccessNotationReports bracket notation property access when dot notation can be used. | stylistic |
regexCharacterClassRangesReports character class elements that can be simplified to ranges. | stylistic |
regexCharacterClassSetOperationsReports lookarounds that can be replaced with character class set operations. | stylistic |
regexConciseCharacterClassNegationsReports negated character classes that can use shorthand escapes. | stylistic |
regexDollarEscapesReports replacement strings with unescaped $ that should use $$. | stylistic |
regexEscapeBackspacesReports escape backspace ([\b]) in character classes. | stylistic |
regexPredefinedAssertions | stylistic |
regexRepeatQuantifiersReports consecutive identical elements in regular expressions that should use quantifiers. | stylistic |
regexTestMethodsReports match() and exec() calls that should use RegExp.prototype.test() for boolean checks. | stylistic |
regexUnicodeProperties | stylistic |
regexUnnecessaryEscapes | stylistic |
responseMethods | stylistic |
returnAssignmentsReports using assignment expressions in return statements. | stylistic |
shadows | stylistic |
stringStartsEndsWith | stylistic |
symbolDescriptionsReports Symbol() calls without description arguments. | stylistic |
tslintComments | stylistic |
typeAssertions | stylistic |
typeExports | stylistic |
typeImports | stylistic |
undefinedInitialValues | stylistic |
unicodeBOMsReports files with Unicode Byte Order Marks (BOMs). | stylistic |
unnecessaryBlocksReports standalone block statements that don't create a meaningful scope. | stylistic |
unnecessaryBooleanCasts | stylistic |
unnecessaryComputedKeys | stylistic |
unnecessaryConcatenationReports string concatenation using the + operator when both operands are string literals. | stylistic |
unnecessaryConstructors | stylistic |
unnecessaryEscapes | stylistic |
unnecessaryQualifiers | stylistic |
unnecessaryRenames | stylistic |
unnecessaryReturns | stylistic |
unnecessaryTypeAnnotations | stylistic |
unusedLabels | stylistic |
varDeclarations | stylistic |
voidOperatorReports using the void operator. | stylistic |
arrayFilteredFindsReports using .filter() when only the first or last matching element is needed. | stylistic (strict) |
arrayFlatMapMethodsReports using .map().flat() when .flatMap() can be used. | stylistic (strict) |
arrayFlatMethodsReports legacy techniques to flatten arrays instead of using .flat(). | stylistic (strict) |
arrayIncludesMethodsReports using Array#some() with simple equality checks that can be replaced with .includes(). | stylistic (strict) |
arrayIndexOfMethodsReports using .findIndex() or .findLastIndex() with simple equality checks that can be replaced with .indexOf() or .lastIndexOf(). | stylistic (strict) |
arraySomeMethodsReports patterns that can be replaced with .some() for checking array element existence. | stylistic (strict) |
atAccessesPrefer using .at() for accessing elements at negative indices. | stylistic (strict) |
builtinCoercionsReports functions that wrap native coercion functions like String, Number, BigInt, Boolean, or Symbol. | stylistic (strict) |
caughtVariableNamesEnforces a consistent naming convention for catch clause error variables. | stylistic (strict) |
classMethodsThisReports class methods that do not use this. | stylistic (strict) |
combinedPushesReports consecutive array.push() calls that could be combined into a single call. | stylistic (strict) |
destructuringConsistencyUse destructured variables over properties for consistency. | stylistic (strict) |
directiveRequireDescriptions | stylistic (strict) |
elseReturnsReports unnecessary else blocks following if statements that always return or throw. | stylistic (strict) |
emptyFilesReports files that contain no meaningful code. | stylistic (strict) |
emptyFunctionsReports empty functions that should contain code or a comment. | stylistic (strict) |
escapeSequenceCasingReports escape sequences with lowercase hexadecimal characters. | stylistic (strict) |
functionDefinitionScopeConsistency | stylistic (strict) |
globalThisAliasesReports using window, self, or global instead of globalThis. | stylistic (strict) |
jsdocAsterisks | stylistic (strict) |
jsdocInformativeDocs | stylistic (strict) |
jsdocMisleadingBlocks | stylistic (strict) |
jsdocMultilineBlocks | stylistic (strict) |
jsdocParameterDescriptionHyphens | stylistic (strict) |
jsdocTagNames | stylistic (strict) |
mathMethodsPrefer modern Math methods over legacy patterns. | stylistic (strict) |
namedDefaultExportsReports anonymous functions and classes as the default export. | stylistic (strict) |
namespaceImplicitAmbientImportsReports declared namespaces that implicitly export all members. | stylistic (strict) |
negativeIndexLengthMethodsPrefer negative index over .length - index for at, slice, splice, and similar methods. | stylistic (strict) |
nonNullAssertionPlacementReports confusing placement of non-null assertions next to comparison or assignment operators. | stylistic (strict) |
numericSeparatorGroupsReports numeric literals with inconsistent separator grouping. | stylistic (strict) |
objectEntriesMethodsPrefer Object.fromEntries() over reduce patterns that build objects from key-value pairs. | stylistic (strict) |
regexCharacterClassesReports regex alternations that can be simplified to character classes. | stylistic (strict) |
regexDigitMatchersReports character classes with multiple adjacent characters that could use a range instead. | stylistic (strict) |
regexExecutorsReports String.prototype.match calls that can be replaced with RegExp.prototype.exec. | stylistic (strict) |
regexGraphemeStringLiteralsReports string literals inside character classes with the v flag that contain multiple graphemes. | stylistic (strict) |
regexHexadecimalEscapesReports regex character escapes that can be expressed more consistently using hexadecimal escapes. | stylistic (strict) |
regexLetterCasingReports inconsistent letter casing in regex sequences. | stylistic (strict) |
regexLookaroundAssertionsReports capturing groups at pattern boundaries that can be replaced with lookaround assertions. | stylistic (strict) |
regexMatchNotationReports inconsistent notations for matching any character in regular expressions. | stylistic (strict) |
regexNamedBackreferencesReports backreferences that do not use the name of their referenced capturing group. | stylistic (strict) |
regexNamedReplacementsReports indexed references in replacement strings that should use named references. | stylistic (strict) |
regexPlusQuantifiersReports quantifiers {1,} in regular expressions that should use + instead. | stylistic (strict) |
regexQuestionQuantifiersReports quantifiers {0,1} in regular expressions that should use ? instead. | stylistic (strict) |
regexResultArrayGroupsReports indexed access on regex result arrays when named capturing groups should be used. | stylistic (strict) |
regexStarQuantifiersReports quantifiers {0,} in regular expressions that should use * instead. | stylistic (strict) |
regexUnicodeCodepointEscapesReports surrogate pair escapes in regular expressions that can be replaced with Unicode codepoint escapes. | stylistic (strict) |
regexUnnecessaryNonCapturingGroups | stylistic (strict) |
regexWordMatchers | stylistic (strict) |
setHasExistenceChecks | stylistic (strict) |
setSizeLengthChecks | stylistic (strict) |
sizeComparisonOperators | stylistic (strict) |
staticMemberOnlyClasses | stylistic (strict) |
stringSliceMethods | stylistic (strict) |
stringTrimMethods | stylistic (strict) |
structuredCloneMethods | stylistic (strict) |
topLevelAwaits | stylistic (strict) |
undefinedTypeofChecks | stylistic (strict) |
unnecessaryTernaries | stylistic (strict) |
arrayCallbackReturnsReports missing return statements in callbacks of array methods. | untyped |
caseDeclarationsReports lexical declarations in case clauses without wrapping them in blocks. | untyped |
classAssignmentsReports reassigning class declarations. | untyped |
classFieldDeclarationsReports assigning literal values to this in constructors instead of using class field declarations. | untyped |
classMemberDuplicatesReports duplicate class member names that will be overwritten. | untyped |
constantAssignmentsReports attempting to reassign variables declared with const. | untyped |
constructorReturnsReports returning values from constructor functions. | untyped |
constructorSupersReports constructors of derived classes that do not call super(), and constructors of non-derived classes that call super(). | untyped |
defaultParameterLastEnforce default parameters to be last. | untyped |
duplicateArgumentsReports functions with duplicate parameter names in their signatures. | untyped |
exportUniqueNamesReports duplicate export names in a module. | untyped |
functionAssignmentsReports reassigning variables declared with function declarations. | untyped |
getterReturnsReports getter functions that do not return values. | untyped |
globalAssignmentsReports attempting to assign to read-only global variables such as undefined, NaN, Infinity, Object, etc. | untyped |
globalObjectCallsReports calling global objects like Math, JSON, or Reflect as functions. | untyped |
importAssignments | untyped |
invalidThis | untyped |
nativeObjectExtensionsReports extending the prototype of native JavaScript objects. | untyped |
newNativeNonConstructorsDisallows using new with global non-constructor functions like Symbol and BigInt. | untyped |
objectKeyDuplicatesReports unnecessary duplicate keys that override previous values. | untyped |
objectProtoReports using the deprecated proto property to access or modify an object's prototype. | untyped |
octalEscapesReports using octal escape sequences in string literals. | untyped |
octalNumbersReports using legacy octal numeric literals. | untyped |
sequencesReports using the comma operator in expressions. | untyped |
setterReturns | untyped |
shadowedRestrictedNamesReports variable declarations that shadow JavaScript's restricted names. | untyped |
thisBeforeSuper | untyped |
typeofComparisonsReports typeof expressions that compare impossible string literals. | untyped |
unassignedVariablesReports variables that are declared but never assigned a value. | untyped |
undefinedVariablesReports using variables that are not defined. | untyped |
unreachableStatements | untyped |
unsafeNegationsReports negating the left operand of in or instanceof relations. | untyped |
unsafeOptionalChains | untyped |
usageBeforeDefinition | untyped |
useStrictDirectives | untyped |
variableBlockScopeUsage | untyped |
variableDeletionsReports attempting to delete variables with the delete operator. | untyped |
variableRedeclarations | untyped |
withStatementsReports using with statements | untyped |
consoleCallsReports calls to console methods. | (none) |
enumInitializersReports enum members without explicit initial values. | (none) |
equalityOperatorNegationsReports negated expressions on the left side of equality checks. | (none) |
forInGuardsReports for-in loops without an if statement to filter inherited properties. | (none) |
functionDeclarationStylesReports functions that don't match the configured style (declaration vs expression). | (none) |
functionNameMatchesReports function names that don't match the variable or property they're assigned to. | (none) |
regexNamedCaptureGroupsReports capturing groups in regular expressions that do not have a name. | (none) |
regexUnicodeEscapesEnforces consistent Unicode escape style in regex patterns by preferring codepoint escapes. | (none) |
regexUnicodeFlagRequire regex patterns to have the unicode ('u') or unicodeSets ('v') flag for proper Unicode character handling. | (none) |
restrictedGlobals | (none) |
restrictedIdentifiers | (none) |
restrictedImports | (none) |
restrictedProperties | (none) |
restrictedSyntax | (none) |
restrictedTypes | (none) |
evolvingVariableTypesReports variables declared without type annotation or initializer. | (none) |
Selectors
Section titled “Selectors”Flint’s TypeScript plugin provides the following file selector:
all:**/*.{cjs,js,jsx,mjs,ts,tsx}