Performance Plugin
Rules for specialized code designed specifically to be run in performance-critical "hot paths".
This plugin is provided in a standalone @flint.fyi/plugin-performance npm package.
npm install @flint.fyi/plugin-performancebun install @flint.fyi/plugin-performancedeno install @flint.fyi/plugin-performancepnpm install @flint.fyi/plugin-performanceyarn install @flint.fyi/plugin-performancePresets
Section titled “Presets”Flint’s performance plugin provides the following preset:
| Preset | Recommended | Description |
|---|---|---|
logical | ✅ Always | Common rules for finding bugs and good practices for high-performance code. |
Flint recommends using the logical preset:
import { import performance
performance } from "@flint.fyi/performance";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: import performance
performance.any
files.any
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: [import performance
performance.any
presets.any
logical], }, ],});logical
Section titled “logical”Rules that find bugs and enforce good performance practices and catch common pitfalls for most-to-all JavaScript and TypeScript files.
import { import performance
performance } from "@flint.fyi/performance";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: import performance
performance.any
files.any
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: import performance
performance.any
presets.any
logical, }, ],});| Flint Rule | Preset |
|---|---|
deletesReports using the delete operator. | logical |
importedNamespaceDynamicAccessesDisallow computed member access on imported namespace identifiers. | logical |
loopAwaitsReports using await expressions inside loops. | logical |
loopFunctionsReports function declarations and expressions inside loops that reference variables modified by the loop. | logical |
spreadAccumulatorsReports spread operations that accumulate values in loops, causing quadratic time complexity. | logical |