{"id":19936319,"url":"https://github.com/toss/packlint","last_synced_at":"2025-05-03T13:30:39.411Z","repository":{"id":62931050,"uuid":"563754513","full_name":"toss/packlint","owner":"toss","description":"Lint Package.json in large JavaScript Monorepos","archived":false,"fork":false,"pushed_at":"2023-02-08T10:37:40.000Z","size":72443,"stargazers_count":13,"open_issues_count":3,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-03-30T04:22:26.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-09T09:08:54.000Z","updated_at":"2024-03-05T01:18:05.000Z","dependencies_parsed_at":"2023-02-16T17:01:08.411Z","dependency_job_id":null,"html_url":"https://github.com/toss/packlint","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toss%2Fpacklint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toss%2Fpacklint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toss%2Fpacklint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toss%2Fpacklint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toss","download_url":"https://codeload.github.com/toss/packlint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224362241,"owners_count":17298669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T23:25:12.100Z","updated_at":"2024-11-12T23:25:12.735Z","avatar_url":"https://github.com/toss.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# packlint\n\n\u003e Organize `package.json` in a large monorepo.\n\n## Install\n\n```sh\nnpm install --dev packlint\n```\n\nor with yarn\n\n```sh\nyarn add --dev packlint\n```\n\n## Usage\n\nPacklint has two main features now.\nSort package.json in custom order (or recommended order by default).\nAdd or modify fields by applying merge rule. (ex: if you want to change build script of all packages in your large monorepo)\n\n```\n  Usage\n    $ packlint\n\n  Options\n    --recursive,-R            Apply packlint to all sub-packages in repo recursively\n\n  Commands\n    (default)                 Apply all rules in config\n    merge                     Apply merge rules in config\n    sort                      Apply order rules in config\n\n  Examples\n    $ packlint\n    $ packlint -R\n    $ packlint merge\n    $ packlint merge -R\n    $ packlint sort\n    $ packlint sort -R\n```\n\n## Configuration\n\nThe Packlint configuration file is named `packlint.config.mjs`. It should be placed in the root directory of your project and `default export` configuration object. For example:\n\n```js\n// packlint.config.mjs\nexport default {\n  files: ['./packages/**/package.json'],\n  ignores: ['./package.json'],\n  rules: {\n    merge: {\n      type: 'module',\n      scripts: {\n        prepack: 'yarn build',\n        build: 'rm -rf dist \u0026\u0026 tsup ./src/index.ts --format esm --dts',\n        dev: 'yarn run build --watch',\n        typecheck: 'tsc --noEmit',\n      },\n      publishConfig: {\n        access: 'public',\n      },\n    },\n  },\n};\n```\n\n### Configuration Object\n\n- `files` - An `array` of glob patterns indicating package.json that the configuration object should apply to. If not specified, default to `'./package.json'`.\n- `ignores` - An `array` of glob patterns indicating the files that the configuration object should not apply to. If not specified, the configuration object applies to all files matched by files.\n- `extends` - A path to the other configuration file. Only the rule will be extended and will be merge with [mergeDeepRight](https://ramdajs.com/docs/#mergeDeepRight) function.\n- `rules` - An `object` containing the configured rules. When files or ignores are specified, these rule configurations are only available to the matching files.\n\n  - `order` - An `array` of strings indicating the order of package.json keys. The `sort` command uses this rule to sort package.json by keys. If not specified, the recommended order will be applied by default.\n  - `merge` - An `object` that is merged with package.json. The `merge` command uses [mergeDeepRight](https://ramdajs.com/docs/#mergeDeepRight) function, and the first object is package.json, and the second one is this object.\n\n    \u003e\n\n    \u003e Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects:\n    \u003e\n    \u003e - and both values are objects, the two values will be recursively merged\n    \u003e - otherwise the value from the second object will be used.\n\n### In Package.json\n\n- If you set `packlint: false` in package.json, it will be ignored from applying packlint.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoss%2Fpacklint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoss%2Fpacklint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoss%2Fpacklint/lists"}