Closed flaviostutz closed 1 year ago
As we already have "module-folder-structure" how about changing this module name to "module-required-files" to avoid mixing up both?
Also, what does "strict" means in this case? Means that it requires exactly the listed files and if there are other files than those it would be a violation?
Good one! Strict means that only those files are allowed to be in the module.
Cool! Please, can you assign this issue to me? I can tackle that.
@tiagostutz I was wondering if, on top of the simpler way of describing required files, we could have a more advanced configuration like:
{
"rules": {
"module-required-files": {
"strict": false,
"files": [ "README.md", "Makefile" ]
"if-files": {
"package.json": ["tsconfig.json", "jest.config.js", ".eslintrc.js"],
"go.mod": ["go.sum"]
}
}
}
In this example,
go.sum only for modules that have file go.mod
This way we can deliver have good defaults for common languages. We could use the same conditional structure for https://github.com/flaviostutz/monolint/issues/2 too then
Sounds good! We could create another issue for that and keep this one with the simple configuration, as it will already bring value. And I have this small suggestion of change on top of what you proposed for the format. We could have the simple format (tackled in this ticket):
{
"rules": {
"module-required-files": {
"strict": false,
"files": ["README.md", "Makefile"]
}
}
And the advanced config:
{
"rules":{
"module-required-files":{
"files":[
{
"all":[
"README.md",
"Makefile"
],
"strict": false
},
{
"package.json":[
"tsconfig.json",
"jest.config.js",
".eslintrc.js"
],
"strict": false
},
{
"go.mod":[
"go.sum"
],
"strict": true
}
]
}
}
}
wdyt?
Perfect! This proposal was moved to #20
Check if modules have the specified files. Can be strict or not.
.monolinter.json: