Closed greatislander closed 3 years ago
This is a byproduct of using fluid's array merging. Our two options are either to migrate to using maps, or to explicitly avoid merging these by adding a merge policy. I'm leaning towards the latter, but will chat with @amb26 for a bit.
In rereading I see that you want to add your excludes to the existing ones. We need to discuss how someone could "opt out" of a default exclude in that scenario.
@the-t-in-rtf Yes, I think the issue here is that the default excludes for lintspaces.newlines
is not something most people, if anyone will want to opt out of— it should always be additive for that check specifically (because the default excludes prevent the check from trying to validate files which don't have newlines). But I take your point that there's a larger question of how to handle situations where people want an array of default excludes to be replaced instead of merged.
Maybe something like an options key for a check like this:
"stylelint": {
"excludeStrategy": "merge" /* Alternatively: replace */
"excludes": [],
}
The default behaviour would be merge, but using replace
would replace the default excludes
with user-supplied ones.
I came up with a new strategy to allow both adding and removing ("negating") individual entries. See #33 for details.
Describe the bug
For this project, a number of Markdown files are managed via Netlify CMS which means we can't enforce
lintspaces.newlines
ormarkdownlint
checks on them. To address this, I added a block to.fluidlintallrc.json
file as shown below:However, when running the lint script, I noticed that I was getting
lintspaces.newlines
errors for a number of image files which should be excluded by the default excludes for this check (#6). Running the lint script with--showMergedConfig
revealed that the merging of excludes appears to be overwriting some default excludes with those supplied by the.fluidlintallrc.json
file:It appears that the first eight lines from the default excludes array in
lint-all.js
are being replaced with my configuration, leaving only.webm
and.webp
: https://github.com/the-t-in-rtf/fluid-lint-all/blob/3cb114599f583843921299d18e37e6f4eceb950a/src/js/lint-all.js#L159-L167To reproduce
Steps to reproduce the behavior:
.fluidlintallrc.json
file with these contents.npx fluid-lint-all --showMergedConfig
(ornpm run lint -- --showMergedConfig
if an npm lint script is present in the test project).lintspaces.newlines
.Expected behavior
The default excludes should be present in the merged configuration.
Screenshots
Not applicable.
Technical details
Desktop
Additional context or notes
Not applicable.