Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 980 Bytes

prefer-repository-shorthand.md

File metadata and controls

31 lines (22 loc) · 980 Bytes

Enforce shorthand declaration for GitHub repository (package-json/prefer-repository-shorthand)

💼 This rule is enabled in the ✅ recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

Rule Details

This rule enforces that repository entries in a package.json use shorthand notation to refer to GitHub repositories when possible. Instead of specifying a full URL like "https://github.com/JoshuaKGoldberg/eslint-plugin-package-json", the shorthand "JoshuaKGoldberg/eslint-plugin-package-json" is equivalent and more succinct.

Examples of incorrect code for this rule:

{
	"repository": {
		"type": "git",
		"url": "https://github.com/JoshuaKGoldberg/create-typescript-app"
	}
}

Examples of correct code for this rule:

{
	"repository": "JoshuaKGoldberg/create-typescript-app"
}