Open benthorner opened 1 year ago
Thanks Ben for these suggestions. I agree we should support this somehow.
I'm leaning towards adding an as_packages
flag which, if it was set to false, would allow you to do this. That would fit in well with the terminology of Grimp, the underlying static analysis library: many of the methods there allow you to specify whether to treat the modules as_packages
.
Open to other ideas though.
Having had more time to mull this over, I think it would the as_packages
flag would be a good addition. Let me know if you would be interested in submitting a pull request!
I think this PR should re-introduce this functionality
Previously it was possible to write a contract like this:
...to prevent the following imports:
This stopped working in https://github.com/seddonym/import-linter/commit/2cdb36fb2c4f657a5339d36dd5797bd891e7111d - essentially, the bug was a feature.
Although this is quite a "dumb" use of import linter - it's little more than a
grep
- it makes sense to express such contracts alongside other more powerful ones for the same codebase.Would it be possible to support this again?
Suggestions
*Treating modules as packages seems to be the default / intended behaviour.