Skip to content
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

Support overrides #96

Closed
jogold opened this issue Oct 8, 2018 · 6 comments · Fixed by #123
Closed

Support overrides #96

jogold opened this issue Oct 8, 2018 · 6 comments · Fixed by #123
Projects
Milestone

Comments

@jogold
Copy link
Contributor

@jogold jogold commented Oct 8, 2018

It would be great to have support for an overrides field in the config file, just like ESLint has. This could be especially useful for monorepos.

{
  "overrides": {
    "files": ["./package.json", "./packages/package1/package.json"],
    "rules": {
      "require-homepage": "off"
    }
  }
}

Any plans to support this? Ready to help.

@tclindner

This comment has been minimized.

Copy link
Owner

@tclindner tclindner commented Oct 13, 2018

Hey @jogold! Thank you for using the project. We have a version of this right now. If you are using a monorepo you can place different config for each project in the repo. npm-package-json-lint will check the config for each project and lint them according to those rules. It is also possible to cascade the config too. For example, if you place the main config in the root of the repo then separate config in a sub-directory the config from the sub-directory will be merged with the config from the root. Do you think that will meet your needs? If not, I would love to add override functionality and would welcome your help 😄

@jogold

This comment has been minimized.

Copy link
Contributor Author

@jogold jogold commented Oct 15, 2018

Hi @tclindner,

Thanks for the detailed answer. I'm currently using this "merge" functionality but it doesn't cover all cases.

Let's say I'm using an extends in the root package.json with all the rules that should be applied to the majority of my packages in packages/. If I want to disable a rule in one of my packages I can go to the package.json of this package and add a npmPackageJsonLintConfig in there. But if I want to disable a rule for the root package.json, I don't see any practical way of doing it.

@tclindner

This comment has been minimized.

Copy link
Owner

@tclindner tclindner commented Oct 22, 2018

Ah, yes. I'm supportive of adding overrides to the project.

@tclindner tclindner added this to the v4.0.0 milestone Jun 16, 2019
@tclindner tclindner added this to To do in v4 via automation Jun 16, 2019
@tclindner

This comment has been minimized.

Copy link
Owner

@tclindner tclindner commented Jun 22, 2019

Hey @jogold would you be willing to help with this for v4?

@jogold

This comment has been minimized.

Copy link
Contributor Author

@jogold jogold commented Jun 27, 2019

Hey @tclindner, thanks for reaching out!

I don't have a lot of time right now... keep you posted.

@tclindner

This comment has been minimized.

Copy link
Owner

@tclindner tclindner commented Jun 27, 2019

No worries, @jogold! Good luck with your projects 🥇

tclindner added a commit that referenced this issue Jul 27, 2019
@tclindner tclindner mentioned this issue Jul 27, 2019
1 of 1 task complete
v4 automation moved this from To do to Done Jul 27, 2019
tclindner added a commit that referenced this issue Jul 27, 2019
* Add logic to apply overrides

Closes #96

* Update eslint-config-tc

* Add cosmicconfig and switch to globby

* Add new utils for ignore and file list

* Add error handling to config

* Add typedef to LintIssue

* Add new linter and results helper

* Add tests for utils

* Tests for new linter

* Add test for absolute paths

* Add tests for overrides and extends

* Add ignore support to cli reporter

* Update api now that CLIEngine is no longer exported

* Update Reporter.js

* Add initial version of transformer

* Add config tests

* Update CHANGELOG.md

Closes #82

* Update cosmicConfigTransformer.js

* Ignore lint temporarily for beta

* Fix file paths

* Update ConfigValidator.test.js

* Update ConfigValidator.test.js

* Update NpmPackageJsonLint.test.js

* Update getFileList.js

* Update getFileList.js

* Add default for base config directory

* Add additional tests for overrides and local build script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v4
  
Done
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.