When I ran rome check I got the following output:
node_modules/deep-freeze/package.json:50:14 parse/spdxLicense โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Unknown license public
โน The SPDX registry is used to ensure valid and legal licenses. See https://spdx.org/licenses/ for more information.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Found 1 problem
I instinctively went to the link referenced to find an MIT license then copy/pasted the contents into a LICENSE file in the root of my repo. This didn't help. Then I went to add a license key into my package.json file, which also didn't seem to work. Some actionable steps for fixing this issue would be helpful.
The problem is in one of your dependencies: deep-freeze
node_modules/deep-freeze/package.json:50:14 parse/spdxLicense
The issue is not in your package.json
Thanks for pointing that out, I missed that. Not exactly sure the best way forward but I'd guess I should ignore my dependencies somehow.
I think this issue is still pertinent though. If it were an issue with my package, would one or both of those approaches fix it? It's tough to tell from the error message what I should actually do to fix it.
Did you ignore node_modules in your config? If so, this is could be a potential bug!
In projects with multiple sub-project configurations like monorepos, I still think there's value in improving the diagnostic message here, perhaps by adding the failing package name emboldened in the message itself. The file paths in diagnostic messages are admittedly easy to miss as noise.
@ematipico
Did you ignore node_modules in your config? If so, this is could be a potential bug!
No, this is intentional behaviour. package.json errors don't occur in the linter and are a side effect of loading in package.json files.
The diagnostic should have a code frame pointing to the problematic package.json line which would have made it a lot clearer and harder to miss the filename above it. I'm not sure why it wasn't displayed here.
I still think there needs to be more clear guidance on how to fix this. If
it is an issue with a package I'm depending on, I'd guess I should either
figure out how to remove that package or ignore just that package. But if
I'm a beginner and just playing around with this or a project that uses
rome then I'm dead in the water. Maybe rome isn't intended for beginners
though.
On Thu, Aug 13, 2020, 5:45 AM Sebastian notifications@github.com wrote:
The diagnostic should have a code frame pointing to the problematic
package.json line which would have made it a lot clearer and harder to
miss the filename above it. I'm not sure why it wasn't displayed here.โ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/romefrontend/rome/issues/1043#issuecomment-673378486,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABS4AU3FY6USZSEQDV5FDYLSAOY5PANCNFSM4P4VK5FQ
.
No, Rome is definitely for beginners. Rome is not an "expert tool" and is meant to be actionable and informative. Licensing errors are definitely something we can improve so we appreciate the feedback. #1075 is tracking adding an option to configure license exceptions, which is what we would advise here, and include as a solution in the error.
We could also potentially add these exceptions for you automatically when running rome init --apply.
I think we likely need a dedicated command perform some automatic configuration generation, since rome init --apply can only be used when you're creating a project. When you might want to run something like this to fix issues whenever you add a new package.json dependency.
Should this issue be closed?
True, going to do that
Most helpful comment
@ematipico
No, this is intentional behaviour.
package.jsonerrors don't occur in the linter and are a side effect of loading inpackage.jsonfiles.