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": "sam.verschueren@gmail.com",
    "name": "Sam Verschueren",
    "url": "github.com/SamVerschueren"
  }
}
{
  "name": "foo",
  "maintainers": [
    {
      "name": "Sam Verschueren",
      "url": "github.com/SamVerschueren",
      "email": "sam.verschueren@gmail.com"
    }
  ]
}
{
  "name": "foo",
  "contributors": [
    {
      "url": "github.com/SamVerschueren",
      "name": "Sam Verschueren",
      "email": "sam.verschueren@gmail.com"
    }
  ]
}

Pass

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

Options

You can set a custom order as well.

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