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.
stylistic✅ AlwaysCommon rules for consistent styling and best stylistic practices.

Flint recommends using the logical and stylistic presets:

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
,
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
stylistic
],
},
],
});

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
,
},
],
});

Rules that enforce consistent styling and best stylistic practices 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
stylistic
,
},
],
});
Implemented: 0 of 77 (0%)
Flint RulePreset
attributionlogical
authorValiditylogical
binValiditylogical
bundleDependenciesValiditylogical
configValiditylogical
contributorsValiditylogical
cpuValiditylogical
dependenciesValiditylogical
dependencyUniquenesslogical
descriptionPresencelogical
descriptionValiditylogical
devDependenciesValiditylogical
directoriesValiditylogical
emptyFieldslogical
enginesValiditylogical
exportsPresencelogical
exportsValiditylogical
filesRedundancylogical
filesValiditylogical
homepageValiditylogical
keywordsValiditylogical
licensePresencelogical
licenseValiditylogical
manValiditylogical
moduleValiditylogical
namePresencelogical
nameValiditylogical
optionalDependenciesValiditylogical
osValiditylogical
peerDependenciesInstallationlogical
peerDependenciesValiditylogical
privateValiditylogical
propertyOrderinglogical
publishConfigRedundancylogical
publishConfigValiditylogical
repositoryDirectoryValiditylogical
repositoryPresencelogical
repositoryShorthandlogical
repositoryValiditylogical
scriptsValiditylogical
sideEffectsPresencelogical
sideEffectsValiditylogical
typePresencelogical
typeValiditylogical
versionPresencelogical
versionValiditylogical
workspacesValiditylogical
binNameCasingstylistic
exportsSubpathsStylestylistic
scriptsNameCasingstylistic
authorPresence(none)
binPresence(none)
bugsPresence(none)
bundleDependenciesPresence(none)
configPresence(none)
contributorsPresence(none)
cpuPresence(none)
dependenciesPresence(none)
dependencyRanges(none)
devDependenciesPresence(none)
directoriesPresence(none)
enginesPresence(none)
filesPresence(none)
fundingPresence(none)
keywordsPresence(none)
mainPresence(none)
manPresence(none)
modulePresence(none)
optionalDependenciesPresence(none)
osPresence(none)
packageManagerPresence(none)
peerDependenciesPresence(none)
privatePackageProperties(none)
privatePresence(none)
publishConfigPresence(none)
scriptsPresence(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.