npm-package-json-lint icon indicating copy to clipboard operation
npm-package-json-lint copied to clipboard

feat: Check order of sub-properties

Open regseb opened this issue 2 years ago • 0 comments

Check order of sub-properties with prefer-property-order. Example with sub-properties of exports to check that types comes first and default comes last (I had a problem because I had positioned types after default):

{
  "rules": {
    "prefer-property-order": ["error", [
      "...",
      "files",
      "exports",
      "exports.types",
      "exports.deno",
      "exports.browser",
      "exports.react-native",
      "exports.node-addons",
      "exports.node",
      "exports.import",
      "exports.require",
      "exports.default",
      "main",
      "..."
    ]]
  }
}

Other sub-properties:

[
  "bugs.url",
  "bugs.email",

  "license.type",
  "license.url",

  "author.name",
  "author.email",
  "author.url",

  "funding.type",
  "funding.url",

  "repository.type",
  "repository.url",
  "repository.directory"
]

regseb avatar Jun 07 '23 06:06 regseb