Skip to content

Commit

Permalink
refactor: migrate from @git-validator/eslint-plugin-packagejson to …
Browse files Browse the repository at this point in the history
…`eslint-plugin-pkg-json`
  • Loading branch information
zanminkian committed Sep 19, 2024
1 parent f23f207 commit d564959
Show file tree
Hide file tree
Showing 54 changed files with 97 additions and 201 deletions.
6 changes: 6 additions & 0 deletions .changeset/friendly-poets-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"eslint-plugin-pkg-json": minor
"@git-validator/eslint-config": minor
---

refactor: migrate from `@git-validator/eslint-plugin-packagejson` to `eslint-plugin-pkg-json`
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
},
"dependencies": {
"@git-validator/eslint-plugin": "workspace:*",
"@git-validator/eslint-plugin-packagejson": "workspace:*",
"@git-validator/eslint-plugin-ts": "workspace:*",
"@typescript-eslint/eslint-plugin": "7.16.1",
"@typescript-eslint/parser": "7.16.1",
Expand All @@ -37,6 +36,7 @@
"eslint-plugin-fp": "2.3.0",
"eslint-plugin-import": "2.30.0",
"eslint-plugin-n": "17.10.3",
"eslint-plugin-pkg-json": "workspace:*",
"eslint-plugin-promise": "7.1.0",
"eslint-plugin-publint": "workspace:*",
"eslint-plugin-react": "7.36.1",
Expand Down
32 changes: 16 additions & 16 deletions packages/eslint-config/src/config/packagejson.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import * as pkg from "@git-validator/eslint-plugin-packagejson";
import * as pkg from "eslint-plugin-pkg-json";
import * as publint from "eslint-plugin-publint";

export function packagejson() {
return [
{
name: "git-validator/packagejson",
files: ["**/package.json"],
processor: "packagejson/processor",
processor: "pkg-json/processor",
plugins: {
packagejson: pkg,
"pkg-json": pkg,
publint,
},
rules: {
"packagejson/bottom-default": "error",
"packagejson/exact-dependency-version": "error",
"packagejson/no-conflict-types": "error",
"packagejson/no-lifecycle-script": "error",
"packagejson/no-nonstandard-property": "error",
"packagejson/no-types-dependency-in-workspace-root": "error",
"packagejson/top-types": "error",
"packagejson/private-workspace-root": "error",
"packagejson/required-engines": "error",
"packagejson/required-hashbang": "error",
"packagejson/required-repository": "error",
"packagejson/type-module": "error",
"packagejson/no-dependencies-in-workspace-root": "error",
"pkg-json/bottom-default": "error",
"pkg-json/exact-dependency-version": "error",
"pkg-json/no-conflict-types": "error",
"pkg-json/no-lifecycle-script": "error",
"pkg-json/no-nonstandard-property": "error",
"pkg-json/no-types-dependency-in-workspace-root": "error",
"pkg-json/top-types": "error",
"pkg-json/private-workspace-root": "error",
"pkg-json/required-engines": "error",
"pkg-json/required-hashbang": "error",
"pkg-json/required-repository": "error",
"pkg-json/type-module": "error",
"pkg-json/no-dependencies-in-workspace-root": "error",
// "publint/suggestion": "error",
"publint/warning": "error",
"publint/error": "error",
Expand Down
111 changes: 0 additions & 111 deletions packages/eslint-plugin-packagejson/CHANGELOG.md

This file was deleted.

67 changes: 0 additions & 67 deletions packages/eslint-plugin-packagejson/README.md

This file was deleted.

67 changes: 67 additions & 0 deletions packages/eslint-plugin-pkg-json/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# eslint-plugin-pkg-json

[![](https://img.shields.io/npm/l/eslint-plugin-pkg-json.svg)](https://github.com/zanminkian/git-validator/blob/main/LICENSE)
[![](https://img.shields.io/npm/v/eslint-plugin-pkg-json.svg)](https://www.npmjs.com/package/eslint-plugin-pkg-json)
[![](https://img.shields.io/npm/dm/eslint-plugin-pkg-json.svg)](https://www.npmjs.com/package/eslint-plugin-pkg-json)
[![](https://packagephobia.com/badge?p=eslint-plugin-pkg-json)](https://packagephobia.com/result?p=eslint-plugin-pkg-json)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)

ESLint plugin for linting `package.json` file.

## Features

- Lint `package.json`s.
- Simple. Tiny. Fast.
- Zero dependencies.

## Requirement

- ESLint >= 8.57.0

## Usage

Install

```sh
pnpm add -D eslint eslint-plugin-pkg-json
```

Config `eslint.config.js`

```js
import * as pkg from "eslint-plugin-pkg-json";

export default [
...
{
files: ["**/package.json"],
processor: "pkg-json/processor",
plugins: { "pkg-json": pkg },
rules: {
"pkg-json/no-lifecycle-script": "error",
...
// Visit https://github.com/zanminkian/git-validator/tree/main/packages/eslint-plugin-pkg-json/doc/rules for more other rules
},
},
...
];
```

Config `package.json`

```json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
```

## Rules

Click [here](https://github.com/zanminkian/git-validator/tree/main/packages/eslint-plugin-pkg-json/doc/rules).

## License

MIT
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@git-validator/eslint-plugin-packagejson",
"version": "0.3.2",
"description": "ESlint plugin for linting package json.",
"name": "eslint-plugin-pkg-json",
"version": "0.0.0",
"description": "ESLint plugin for linting package.json file",
"keywords": [
"eslint",
"config",
Expand All @@ -10,13 +10,14 @@
"package-json",
"packagejson",
"package",
"json"
"json",
"node"
],
"homepage": "https://github.com/zanminkian/git-validator/tree/main/packages/eslint-plugin-packagejson",
"homepage": "https://github.com/zanminkian/git-validator/tree/main/packages/eslint-plugin-pkg-json",
"repository": {
"type": "git",
"url": "git+https://github.com/zanminkian/git-validator.git",
"directory": "packages/eslint-plugin-packagejson"
"directory": "packages/eslint-plugin-pkg-json"
},
"license": "MIT",
"author": "[email protected]",
Expand Down

0 comments on commit d564959

Please sign in to comment.