-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add @stylelint/npm-package-json-lint-config
#6
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Enforcing conventions with tooling is always a win.
I've requested some changes. Some of which will need to be addressed upstream in the shared config.
There's an extra 2859084 change in this PR, I moved https://github.com/stylelint/stylelint/blob/master/package.json#L180 This is no longer required, and is in line with this same new package: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes.
I've made one minor suggestion and a query below.
There's an extra 2859084 change in this PR, I moved prettier from devDependencies to dependencies,
Will we need to publish a new version of this package whenever Prettier publishes? If there aren't any downsides, should we be recommending that stylelint shared config authors do the same, and should we do the same for our ESLint shared config? I guess it could get messy if you extend two configs which have different versions of stylelint/ESLint/PackageJsonLint as dependencies.
I think I prefer not including the tools within the configs.
Agree. |
We will have around ~10 repos using Prettier, the @stylelint/prettier-config package is intended for use by the stylelint organization, primarily it is an internal tool used to benefit stylelint and not has a broad shared configuration for non-stylelint projects to be used When a new release of Prettier is released, depending on if it is a major, minor, or patch release we can update this PR once, versus the alternative of having to update each of the ~10 repos with the Prettier update. Likewise, ESLint, the same for ESLint, update ~10 repos or 1 repo Further, as has been taking place, aligning the naming of the scripts being used across the repos for consistent script renaming, e.g My plan is that once most of the repos using these packages are up to date is to remove them all from the these repos completely, these packages would then ship as part of the The ideology behind this comes from the kcd-scripts package to which we developed the WordPress scripts to follow suit:
Each of ESLint, Prettier, Husky, Lint Staged are all included in this same manner, the maintenance level of dependabot PRs each month will drop by a significant magnitude IMHO The end result is a set of common scripts for use in each repo with the configuration and parent tool (ESLint, Prettier etc) included in the distribution: {
"scripts": {
"build": "stylelint-scripts build",
"check-engines": "stylelint-scripts check-engines",
"check-licenses": "stylelint-scripts check-licenses",
"format:js": "stylelint-scripts format-js",
"lint:css": "stylelint-scripts lint-style",
"lint:js": "stylelint-scripts lint-js",
"lint:md:docs": "stylelint-scripts lint-md-docs",
"lint:md:js": "stylelint-scripts lint-md-js",
"lint:pkg-json": "stylelint-scripts lint-pkg-json",
"packages-update": "stylelint-scripts packages-update",
"start": "stylelint-scripts start",
"test:e2e": "stylelint-scripts test-e2e",
"test:unit": "stylelint-scripts test-unit-js"
}
} |
Co-Authored-By: Richard Hallows <[email protected]>
We'll have to update all repositories anyway. If we bump Prettier version in this repository, then we'll have to release new config versions. And update all ~10 repositories with new config.
This idea is good. More about it https://kentcdodds.com/blog/concerning-toolkits |
That's an excellent idea! As both Prettier and this config will be bundled together in a shared scripts package, I don't think we need to couple them here. I think I'd prefer to have configs behave consistently regardless of their intended use. |
This PR adds the https://npmpackagejsonlint.org/ package
It enforces a set of
package.json
properties that should be included in each stylelint org repopackage.json
e.g.:
In the near future it will also include the
funding
property, it works in tandem with the Prettier formatting but ensures that proreties contain both the correct org values and that they haven't been omitted from a repo either.It also adds Jest and a basic test.