Require "standard" field in package.json
See original GitHub issueBringing this proposal over from a twitter thread: https://twitter.com/anandthakker/status/776252795972362241
I quite like standard
(the rules). My only problem with standard
(the tool) is that it makes it difficult to get automatic, in-editor linter errors when switching between OSS projects (most of which I don’t control) that do/don’t use standard
. There are, for the most part, three main cases:
- Project uses
standard
- Project uses
eslint
, and contains an.eslintrc
(or maybe aneslintConfig
property inpackage.json
) - Project uses neither
I’d be okay setting up vim
to inspect the current project and pick, eslint or standard accordingly. However, my (main) issue is that there isn’t a great way to distinguish between cases 1 and 3: if I just default to standard
when there’s no .eslintrc
, then I get stuck with a bunch of spurious lint errors in projects that use some other linter (or don’t use one at all).
@feross What do you think about the idea of having standard
require the standard
property in package.json
? My reasoning is that this (a) enforces a reliable way to programmatically determine whether a project uses standard
and (b) is a very low burden to comply with (standard
could even add the field on install?)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
It’s already in there:
I don’t think forcing everyone to add a
standard
property to the package.json would be a good idea at all. Will you not be able to use standard to lint standalone files anymore then? Or a subdirectory?It takes away the beauty of standard, which is that I don’t have configure anything at all. I only need to do the very bare minimum (installing a package, adding to
scripts.test
), I don’t want to be forced to do anything more.@anandthakker I sympathize. Turning on and off the
standard
linter in your text editor can get tedious.I would check for
standard
indevDependencies
. That is going to be super reliable, and doesn’t require any changes to the way we handle thepackage.json
configuration.Honestly, the
"standard"
property inpackage.json
is just a hack to make things a bit easier for larger projects transitioning tostandard
by offering things like ignoring folders, using anenv
, or defining some globals. Ideally, these aren’t needed at all.IMO, the presence of the
"standard"
field inpackage.json
is a sign that something isn’t ideal about your standard usage. The ideal is no configuration. Right now, the number one reason people configure standard is to setbabel-eslint
as their parser, but eslint is getting ES7 support very soon, so this reason will soon go away!