diff --git a/src/eslint/configs/jsonc.ts b/src/eslint/configs/jsonc.ts index dd7e6b10..95e706c6 100644 --- a/src/eslint/configs/jsonc.ts +++ b/src/eslint/configs/jsonc.ts @@ -1,5 +1,5 @@ import { GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from '../../constants'; -import { parserJsonc, pluginJsonc } from '../plugins'; +import { parserJsonc, pluginJsonc, pluginPackageJson } from '../plugins'; import type { Config, JsoncOptions } from '../types'; export function jsonc(options: JsoncOptions = {}): Config[] { @@ -14,6 +14,8 @@ export function jsonc(options: JsoncOptions = {}): Config[] { plugins: { // @ts-expect-error not matched jsonc: pluginJsonc, + // @ts-expect-error not matched + 'package-json': pluginPackageJson, }, rules: { // https://github.com/ota-meshi/eslint-plugin-jsonc/blob/v2.16.0/lib/configs/base.ts @@ -50,6 +52,17 @@ export function jsonc(options: JsoncOptions = {}): Config[] { 'jsonc/valid-json-number': 'error', 'jsonc/vue-custom-block/no-parsing-error': 'error', + // https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/v0.15.2/src/configs/recommended.ts + 'package-json/order-properties': 'error', + 'package-json/repository-shorthand': 'error', + 'package-json/sort-collections': 'error', + 'package-json/unique-dependencies': 'error', + 'package-json/valid-local-dependency': 'error', + 'package-json/valid-name': 'error', + 'package-json/valid-package-def': 'error', + 'package-json/valid-repository-directory': 'error', + 'package-json/valid-version': 'error', + ...rules, }, }, diff --git a/src/eslint/plugins.ts b/src/eslint/plugins.ts index d98c5b3e..5aa42b8e 100644 --- a/src/eslint/plugins.ts +++ b/src/eslint/plugins.ts @@ -6,6 +6,7 @@ import * as _pluginJsonc from 'eslint-plugin-jsonc'; /* @ts-expect-error missing types */ import * as _pluginMarkdown from 'eslint-plugin-markdown'; import * as _pluginN from 'eslint-plugin-n'; +import * as _pluginPackageJson from 'eslint-plugin-package-json'; import * as _pluginPerfectionist from 'eslint-plugin-perfectionist'; import * as _pluginRegexp from 'eslint-plugin-regexp'; import * as _pluginTypeScript from '@typescript-eslint/eslint-plugin'; @@ -49,6 +50,7 @@ export const pluginJsdoc = interopDefault(_pluginJsdoc); export const pluginJsonc = interopDefault(_pluginJsonc); export const pluginMarkdown = interopDefault(_pluginMarkdown); export const pluginN = interopDefault(_pluginN); +export const pluginPackageJson = interopDefault(_pluginPackageJson); export const pluginPerfectionist = interopDefault(_pluginPerfectionist); export const pluginRegexp = interopDefault(_pluginRegexp); export const pluginTypeScript = interopDefault(_pluginTypeScript);