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-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 { performance } from "@flint.fyi/performance";import { defineConfig } from "flint";
export default defineConfig({ use: [ { files: performance.files.all, rules: [performance.presets.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 { performance } from "@flint.fyi/performance";import { defineConfig } from "flint";
export default defineConfig({ use: [ { files: performance.files.all, rules: performance.presets.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 |
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.