Skip to content

PackageJSON Plugin

Rules for linting Node.js package.json manifest files in repositories and workspaces.
This plugin comes packaged with the flint npm package.

Flint’s package.json plugin provides the following preset:

PresetRecommendedDescription
logical✅ AlwaysCommon rules for finding bugs and good practices in package.json files.

Flint recommends using the logical preset:

flint.config.ts
import {
function defineConfig(definition: ConfigDefinition): Config

Defines a new linter configuration for a Flint config file.

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

defineConfig
,
const packageJson: Plugin<RuleAbout, "all", []>
packageJson
} 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 packageJson: Plugin<RuleAbout, "all", []>
packageJson
.
Plugin<RuleAbout, "all", []>.files: Record<"all", FilesValue>

Selectors of files this plugin suggests applying its rules to.

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

files
.
all: FilesValue
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 packageJson: Plugin<RuleAbout, "all", []>
packageJson
.
Plugin<RuleAbout, "all", []>.presets: PluginPresets<RuleAbout, never>

Preset lists of rules to enable on files.

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

presets
.
any
logical
],
},
],
});

Rules that find bugs and enforce best practices and prevent common pitfalls for most-to-all package.json files.

flint.config.ts
import {
function defineConfig(definition: ConfigDefinition): Config

Defines a new linter configuration for a Flint config file.

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

defineConfig
,
const packageJson: Plugin<RuleAbout, "all", []>
packageJson
} 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 packageJson: Plugin<RuleAbout, "all", []>
packageJson
.
Plugin<RuleAbout, "all", []>.files: Record<"all", FilesValue>

Selectors of files this plugin suggests applying its rules to.

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

files
.
all: FilesValue
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 packageJson: Plugin<RuleAbout, "all", []>
packageJson
.
Plugin<RuleAbout, "all", []>.presets: PluginPresets<RuleAbout, never>

Preset lists of rules to enable on files.

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

presets
.
any
logical
,
},
],
});
Implemented: 0 of 51 (0%)
Flint RulePreset
authorValiditylogical
binValiditylogical
bundleDependenciesValiditylogical
configValiditylogical
cpuValiditylogical
dependenciesValiditylogical
dependencyUniquenesslogical
descriptionPresencelogical
descriptionValiditylogical
devDependenciesValiditylogical
directoriesValiditylogical
emptyFieldslogical
exportsValiditylogical
filesRedundancylogical
filesValiditylogical
homepageValiditylogical
keywordsValiditylogical
licenseRequiredlogical
licenseValiditylogical
mainValiditylogical
manValiditylogical
namePresencelogical
nameValiditylogical
optionalDependenciesValiditylogical
osValiditylogical
peerDependenciesValiditylogical
privateValiditylogical
propertyOrderinglogical
publishConfigValiditylogical
repositoryDirectoryValiditylogical
repositoryShorthandlogical
repositoryValiditylogical
scriptsValiditylogical
typePresencelogical
typeRequiredlogical
typeValiditylogical
versionPresencelogical
versionValiditylogical
workspacesValiditylogical
authorPresence(none)
bugsPresence(none)
bundleDependenciesPresence(none)
dependenciesPresence(none)
dependencyRanges(none)
devDependenciesPresence(none)
enginesPresence(none)
filesPresence(none)
keywordsPresence(none)
optionalDependenciesPresence(none)
peerDependenciesPresence(none)
typesPresence(none)

Flint’s package.json plugin will provide the following files selector:

  • all: **/package.json
Made with ❤️‍🔥 around the world by the Flint team and contributors.