Node.js Plugin
Rules for code that runs in Node.js and other server runtimes that include Node.js-like APIs.
This plugin is provided in a standalone @flint.fyi/plugin-node npm package.
npm install @flint.fyi/plugin-nodebun install @flint.fyi/plugin-nodedeno install @flint.fyi/plugin-nodepnpm install @flint.fyi/plugin-nodeyarn install @flint.fyi/plugin-nodePresets
Section titled “Presets”Flint’s Node.js plugin provides the following presets:
| Preset | Recommended | Description |
|---|---|---|
logical | ✅ Always | Common rules for finding bugs and enforcing good logical practices in code that uses Node APIs. |
stylistic | ✅ Always | Common rules for consistent styling and best stylistic practices in code that uses Node APIs. |
stylisticStrict | ☑️ When Ready | Additional rules for consistent styling and best stylistic practices in code that uses Node APIs. |
If you are just getting started with linting, Flint recommends using the logical and stylistic presets:
import { const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node } from "@flint.fyi/node";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts } 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: const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts.Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly [...]; } & { ...; }, "notGrouped", undefined>, ... 299 more ..., Rule<...>]>.files: Record<"javascript" | "typescript" | "all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: [const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.presets: PluginPresets<[Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
Preset lists of rules to enable on files.
presets.logical: (Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined> | Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined> | ... 8 more ... | Rule<...>)[]
logical, const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.presets: PluginPresets<[Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
Preset lists of rules to enable on files.
presets.stylistic: (Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined> | Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined> | ... 8 more ... | Rule<...>)[]
stylistic], }, ],});If you are experienced with both Node.js and linting, Flint recommends additionally using the stylisticStrict preset:
import { const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node } from "@flint.fyi/node";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts } 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: const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts.Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly [...]; } & { ...; }, "notGrouped", undefined>, ... 299 more ..., Rule<...>]>.files: Record<"javascript" | "typescript" | "all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: [const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.presets: PluginPresets<[Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
Preset lists of rules to enable on files.
presets.logical: (Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined> | Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined> | ... 8 more ... | Rule<...>)[]
logical, const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.presets: PluginPresets<[Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
Preset lists of rules to enable on files.
presets.stylisticStrict: (Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined> | Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined> | ... 8 more ... | Rule<...>)[]
stylisticStrict], }, ],});logical
Section titled “logical”Rules that find bugs and enforce good Node.js and general server-side best practices for most-to-all JavaScript and TypeScript files.
import { const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node } from "@flint.fyi/node";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: const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.files: undefined
Selectors of files this plugin suggests applying its rules to.
files.any
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.presets: PluginPresets<[Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
Preset lists of rules to enable on files.
presets.logical: (Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined> | Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined> | ... 8 more ... | Rule<...>)[]
logical, }, ],});stylistic
Section titled “stylistic”Rules that enforce consistent styling and best stylistic practices for most-to-all JavaScript and TypeScript files dealing with Node.js APIs.
import { const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node } from "@flint.fyi/node";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts } 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: const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts.Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly [...]; } & { ...; }, "notGrouped", undefined>, ... 299 more ..., Rule<...>]>.files: Record<"javascript" | "typescript" | "all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.presets: PluginPresets<[Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
Preset lists of rules to enable on files.
presets.stylistic: (Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined> | Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined> | ... 8 more ... | Rule<...>)[]
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 Node.js and using a linter.
import { const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node } from "@flint.fyi/node";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts } 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: const ts: Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "notGrouped", undefined>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: readonly ["logical", "logicalStrict"];} & { readonly pluginId: string; readonly url: string;}, "mismatchedTypes", undefined>, ... 298 more ..., Rule<...>]>
ts.Plugin<RuleAbout<string>, "javascript" | "typescript" | "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: readonly [...]; } & { ...; }, "notGrouped", undefined>, ... 299 more ..., Rule<...>]>.files: Record<"javascript" | "typescript" | "all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const node: Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
node.Plugin<RuleAbout<string>, string | undefined, [Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly [...]; } & { ...; }, "preferStrictAssert", undefined>, ... 9 more ..., Rule<...>]>.presets: PluginPresets<[Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined>, Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined>, ... 8 more ..., Rule<...>]>
Preset lists of rules to enable on files.
presets.stylisticStrict: (Rule<{ readonly description: "Prefer strict assertion mode from Node.js for better error messages and behavior."; readonly id: "assertStrict"; readonly presets: readonly ["logical"];} & { readonly pluginId: string; readonly url: string;}, "preferStrictAssert", undefined> | Rule<{ readonly description: "Prefer `assert.ok()` over `assert()` for explicit intent and better readability."; readonly id: "assertStyles"; readonly presets: readonly ["stylistic", "stylisticStrict"];} & { readonly pluginId: string; readonly url: string;}, "preferAssertOk", undefined> | ... 8 more ... | Rule<...>)[]
stylisticStrict, }, ],});This preset’s rules are a superset of those in stylistic.
Implemented: 11 of 22 (50%)
| Flint Rule | Preset |
|---|---|
assertStrictPrefer strict assertion mode from Node.js for better error messages and behavior. | logical |
bufferAllocatorsPrefer modern Buffer allocation methods over the deprecated Buffer constructor. | logical |
exportsAssignmentsPrevent assignment to the exports variable in CommonJS modules. | logical |
hashbangs | logical |
nodeProtocolsPrefer the node: protocol prefix for Node.js built-in modules for clarity and consistency. | logical |
processExitsPrevent direct use of process.exit() for better error handling and testing. | logical |
unpublishedBins | logical |
unpublishedImports | logical |
unsupportedNodeAPIs | logical |
eventClassesPrefer EventTarget over EventEmitter for cross-platform compatibility. | logical (strict) |
assertStylesPrefer assert.ok() over assert() for explicit intent and better readability. | stylistic |
blobReadingMethodsPrefer direct Blob reading methods over wrapping in Response for simpler code. | stylistic |
consoleSpacesDisallow leading or trailing spaces in console method string arguments. | stylistic (strict) |
filePathsFromImportMetaPrefer import.meta.dirname and import.meta.filename over legacy file path techniques. | stylistic (strict) |
fileReadJSONBuffersPrefer reading JSON files as buffers when using JSON.parse for better performance. | stylistic (strict) |
coreModuleHiding | (none) |
globalCrypto | (none) |
globalTimers | (none) |
importFileExtensions | (none) |
restrictedImports | (none) |
shebangs | (none) |
topLevelAwaits | (none) |