Skip to content

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.

Terminal window
npm install @flint.fyi/plugin-performance

Flint’s performance plugin provides the following preset:

PresetRecommendedDescription
logical✅ AlwaysCommon rules for finding bugs and good practices for high-performance code.

Flint recommends using the logical preset:

flint.config.ts
import {
const performance: Plugin<RuleAbout, string | undefined, [Rule<{
readonly description: "Reports using the delete operator.";
readonly id: "deletes";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDelete", AnyOptionalSchema>, Rule<{
readonly description: "Disallow computed member access on imported namespace identifiers.";
readonly id: "importedNamespaceDynamicAccesses";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDynamicAccess", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>]>
performance
} from "@flint.fyi/performance";
import {
function defineConfig(definition: ConfigDefinition): Config

Defines a new linter configuration for a Flint config file.

@seehttps://flint.fyi/configuration flint.fyi/configuration

defineConfig
} from "flint";
export default
function defineConfig(definition: ConfigDefinition): Config

Defines a new linter configuration for a Flint config file.

@seehttps://flint.fyi/configuration flint.fyi/configuration

defineConfig
({
ConfigDefinition.use: ConfigUseDefinition[]

Specifies the files to be linted alongside the rules and settings to lint with.

@seehttps://flint.fyi/configuration#use flint.fyi/configuration#use

use
: [
{
ConfigUseDefinition.files: AnyLevelDeep<FilesValue>

A list of glob patterns describing which file(s) to lint.

@seehttps://flint.fyi/configuration#files flint.fyi/configuration#files

files
:
const performance: Plugin<RuleAbout, string | undefined, [Rule<{
readonly description: "Reports using the delete operator.";
readonly id: "deletes";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDelete", AnyOptionalSchema>, Rule<{
readonly description: "Disallow computed member access on imported namespace identifiers.";
readonly id: "importedNamespaceDynamicAccesses";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDynamicAccess", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>]>
performance
.
Plugin<RuleAbout, string | undefined, [Rule<{ readonly description: "Reports using the delete operator."; readonly id: "deletes"; } & { presets?: ("logical" | "stylistic" | "stylisticStrict")[]; url: string; }, object, object, "noDelete", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>, Rule<...>]>.files: undefined

Selectors of files this plugin suggests applying its rules to.

@seehttps://flint.fyi/glossary#files flint.fyi/glossary#files

files
.
any
all
,
ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>

Any number of rules and/or presets of rules to enable for those files.

@seehttps://flint.fyi/configuration#rules flint.fyi/configuration#rules

rules
: [
const performance: Plugin<RuleAbout, string | undefined, [Rule<{
readonly description: "Reports using the delete operator.";
readonly id: "deletes";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDelete", AnyOptionalSchema>, Rule<{
readonly description: "Disallow computed member access on imported namespace identifiers.";
readonly id: "importedNamespaceDynamicAccesses";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDynamicAccess", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>]>
performance
.
Plugin<RuleAbout, string | undefined, [Rule<{ readonly description: "Reports using the delete operator."; readonly id: "deletes"; } & { presets?: ("logical" | "stylistic" | "stylisticStrict")[]; url: string; }, object, object, "noDelete", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>, Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "stylistic" | "stylisticStrict">

Preset lists of rules to enable on files.

@seehttps://flint.fyi/glossary#preset flint.fyi/glossary#preset

presets
.
logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical
],
},
],
});

Rules that find bugs and enforce good performance practices and catch common pitfalls for most-to-all JavaScript and TypeScript files.

flint.config.ts
import {
const performance: Plugin<RuleAbout, string | undefined, [Rule<{
readonly description: "Reports using the delete operator.";
readonly id: "deletes";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDelete", AnyOptionalSchema>, Rule<{
readonly description: "Disallow computed member access on imported namespace identifiers.";
readonly id: "importedNamespaceDynamicAccesses";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDynamicAccess", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>]>
performance
} from "@flint.fyi/performance";
import {
function defineConfig(definition: ConfigDefinition): Config

Defines a new linter configuration for a Flint config file.

@seehttps://flint.fyi/configuration flint.fyi/configuration

defineConfig
} from "flint";
export default
function defineConfig(definition: ConfigDefinition): Config

Defines a new linter configuration for a Flint config file.

@seehttps://flint.fyi/configuration flint.fyi/configuration

defineConfig
({
ConfigDefinition.use: ConfigUseDefinition[]

Specifies the files to be linted alongside the rules and settings to lint with.

@seehttps://flint.fyi/configuration#use flint.fyi/configuration#use

use
: [
{
ConfigUseDefinition.files: AnyLevelDeep<FilesValue>

A list of glob patterns describing which file(s) to lint.

@seehttps://flint.fyi/configuration#files flint.fyi/configuration#files

files
:
const performance: Plugin<RuleAbout, string | undefined, [Rule<{
readonly description: "Reports using the delete operator.";
readonly id: "deletes";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDelete", AnyOptionalSchema>, Rule<{
readonly description: "Disallow computed member access on imported namespace identifiers.";
readonly id: "importedNamespaceDynamicAccesses";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDynamicAccess", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>]>
performance
.
Plugin<RuleAbout, string | undefined, [Rule<{ readonly description: "Reports using the delete operator."; readonly id: "deletes"; } & { presets?: ("logical" | "stylistic" | "stylisticStrict")[]; url: string; }, object, object, "noDelete", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>, Rule<...>]>.files: undefined

Selectors of files this plugin suggests applying its rules to.

@seehttps://flint.fyi/glossary#files flint.fyi/glossary#files

files
.
any
all
,
ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>

Any number of rules and/or presets of rules to enable for those files.

@seehttps://flint.fyi/configuration#rules flint.fyi/configuration#rules

rules
:
const performance: Plugin<RuleAbout, string | undefined, [Rule<{
readonly description: "Reports using the delete operator.";
readonly id: "deletes";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDelete", AnyOptionalSchema>, Rule<{
readonly description: "Disallow computed member access on imported namespace identifiers.";
readonly id: "importedNamespaceDynamicAccesses";
} & {
presets?: ("logical" | "stylistic" | "stylisticStrict")[];
url: string;
}, object, object, "noDynamicAccess", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>]>
performance
.
Plugin<RuleAbout, string | undefined, [Rule<{ readonly description: "Reports using the delete operator."; readonly id: "deletes"; } & { presets?: ("logical" | "stylistic" | "stylisticStrict")[]; url: string; }, object, object, "noDelete", AnyOptionalSchema>, Rule<...>, Rule<...>, Rule<...>, Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "stylistic" | "stylisticStrict">

Preset lists of rules to enable on files.

@seehttps://flint.fyi/glossary#preset flint.fyi/glossary#preset

presets
.
logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical
,
},
],
});
Flint RulePreset
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 ❤️‍🔥 around the world by the Flint team and contributors.