Skip to content

Latest commit

 

History

History
96 lines (80 loc) · 1.37 KB

pkg-user-order.md

File metadata and controls

96 lines (80 loc) · 1.37 KB

Enforces order of properties in user objects in package.json

Enforces the following order in author, maintainers and contributors objects in package.json.

  • name
  • email
  • url

Fail

{
  "name": "foo",
  "author": {
    "email": "[email protected]",
    "name": "Sam Verschueren",
    "url": "github.com/SamVerschueren"
  }
}
{
  "name": "foo",
  "maintainers": [
    {
      "name": "Sam Verschueren",
      "url": "github.com/SamVerschueren",
      "email": "[email protected]"
    }
  ]
}
{
  "name": "foo",
  "contributors": [
    {
      "url": "github.com/SamVerschueren",
      "name": "Sam Verschueren",
      "email": "[email protected]"
    }
  ]
}

Pass

{
  "name": "foo",
  "author": {
    "name": "Sam Verschueren",
    "email": "[email protected]",
    "url": "github.com/SamVerschueren"
  }
}
{
  "name": "foo",
  "maintainers": [
    {
      "name": "Sam Verschueren",
      "email": "[email protected]",
      "url": "github.com/SamVerschueren"
    }
  ]
}
{
  "name": "foo",
  "contributors": [
    {
      "name": "Sam Verschueren",
      "email": "[email protected]",
      "url": "github.com/SamVerschueren"
    }
  ]
}

Options

You can set a custom order as well.

"pkg-user-order": ["error", "email", "name", "url"]