![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
eslint-plugin-package-json
Advanced tools
Rules for consistent, readable, and valid package.json files. ๐๏ธ
Rules for consistent, readable, and valid package.json files. ๐๏ธ
This package requires ESLint >=8:
npm install eslint eslint-plugin-package-json --save-dev
This plugin's recommended configuration enables its rules on **/package.json
files, parsing them with jsonc-eslint-parser
.
In your ESLint configuration file:
import packageJson from "eslint-plugin-package-json/configs/recommended";
export default [
// your other ESLint configurations
packageJson,
];
If you want to override the recommended rules:
import packageJson from "eslint-plugin-package-json/configs/recommended";
export default [
// your other ESLint configurations
{
...packageJson,
rules: {
...packageJson.rules,
"package-json/valid-package-definition": "off",
},
},
];
See ESLint's Configuration Files guide for details on how to customize your rules and other config settings.
Usage with ESLint's legacy ("eslintrc") format requires also installing jsonc-eslint-parser
:
npm install jsonc-eslint-parser --save-dev
Add an override to your ESLint configuration file that specifies jsonc-eslint-parser
, this plugin, and its recommended rules for your package.json
file:
module.exports = {
overrides: [
{
extends: ["plugin:package-json/recommended"],
files: ["package.json"],
parser: "jsonc-eslint-parser",
plugins: ["package-json"],
},
],
};
You may also want to individually configure rules. See ESLint's Configure Rules guide for details on how to customize your rules.
module.exports = {
overrides: [
{
extends: ["plugin:package-json/recommended"],
files: ["package.json"],
parser: "jsonc-eslint-parser",
plugins: ["package-json"],
rules: {
"package-json/valid-package-definition": "error",
},
},
],
};
prettier-plugin-packagejson
is a Prettier plugin that enforces the same package.json
keys ordering as the order-properties
and sort-collections rules with default options.
We recommend using both the Prettier plugin and eslint-plugin-package-json
's recommended configuration.
The default settings don't conflict, and Prettier plugins can quickly fix up ordering in your editor on save and/or as a Git hook.
๐ผ Configurations enabled in.
โ
Set in the recommended
configuration.
๐ง Automatically fixable by the --fix
CLI option.
๐ก Manually fixable by editor suggestions.
โ Deprecated.
Nameย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย | Description | ๐ผ | ๐ง | ๐ก | โ |
---|---|---|---|---|---|
no-empty-fields | Reports on unnecessary empty arrays and objects. | โ | ๐ก | ||
no-redundant-files | Prevents adding unnecessary / redundant files. | ๐ก | |||
order-properties | Package properties must be declared in standard order | โ | ๐ง | ||
repository-shorthand | Enforce either object or shorthand declaration for repository. | โ | ๐ง | ||
require-author | Requires the author property to be present. | ||||
require-name | Requires the name property to be present. | โ | |||
require-version | Requires the version property to be present. | โ | |||
sort-collections | Dependencies, scripts, and configuration values must be declared in alphabetical order. | โ | ๐ง | ||
unique-dependencies | Checks a dependency isn't specified more than once (i.e. in dependencies and devDependencies ) | โ | ๐ก | ||
valid-local-dependency | Checks existence of local dependencies in the package.json | โ | |||
valid-name | Enforce that package names are valid npm package names | โ | |||
valid-package-def | Enforce that package.json has all properties required by the npm spec | โ | |||
valid-package-definition | Enforce that package.json has all properties required by the npm spec | โ | |||
valid-repository-directory | Enforce that if repository directory is specified, it matches the path to the package.json file | โ | ๐ก | ||
valid-version | Enforce that package versions are valid semver specifiers | โ |
These rules only run on package.json
files; they will ignore all other files being linted.
They can lint package.json
files at project root and in any subfolder of the project, making this plugin great for monorepos.
See .github/CONTRIBUTING.md
, then .github/DEVELOPMENT.md
.
Thanks! ๐
Many thanks to @zetlen for creating the initial version and core infrastructure of this package! ๐
๐ This package was templated with create-typescript-app.
FAQs
Rules for consistent, readable, and valid package.json files. ๐๏ธ
The npm package eslint-plugin-package-json receives a total of 31,564 weekly downloads. As such, eslint-plugin-package-json popularity was classified as popular.
We found that eslint-plugin-package-json demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenanceโdevelopers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.