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

Feature request: `no-main` Rule

Open haysclark opened this issue 3 years ago • 0 comments

When reporting a bug, please include:

It would be handy for projects that are not libraries to enforce that main is not set in package manager.

Use case

When using GatsbyJS, if the projects 'package.json' includes main then it will throw a Compilation error.

package.json snippet

{
  "main": "n/a",
}

GatsbyJS CLI output

ERROR #11901  COMPILATION
  Failed to compile Gatsby files (@parcel/core):

  Unexpected output file type  in target "main". File extension must be .js, .mjs, or .cjs

  Hints:
  - The "main" field is meant for libraries. If you meant to output a  file, either remove the "main" field or choose a different target name.

haysclark avatar Jul 13 '22 21:07 haysclark