-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add option to require that fence.json files existin certain directories #45
base: master
Are you sure you want to change the base?
Conversation
My thought with this was to make it a fence.json setting rather than a top level option. Then different subdirectories can apply their own policies. |
45f35c3
to
55dc7da
Compare
const missingRequiredPaths = requiredPaths.filter(p => !configPathMap[p]); | ||
|
||
if (missingRequiredPaths.length > 0) { | ||
missingRequiredPaths.forEach(p => reportError(`Missing fence.json at ${p}`)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reportError(
Missing fence.json at ${p}
) [](start = 42, length = 41)
Looks like this conflicts with my error reporting revamp. This doesn't fit the typical pattern for a validation error, but we should be able to figure out some uniform format for errors.
This is a breaking change, but should make error reporting more flexible in the future. Now, instead of just reporting an error message string, we pass an object with various properties that may be useful to the consumer. I've also revamped the error message to be a lot more detailed so that it's hopefully easier to track down errors when they happen.
3b509db
to
cea3ae3
Compare
import Config from '../types/config/Config'; | ||
import ConfigSet from '../types/ConfigSet'; | ||
|
||
interface ConfigPathPair { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfigPathPair [](start = 10, length = 14)
Config
has it's path as one of its properties, so you shouldn't need this structure.
@@ -0,0 +1,120 @@ | |||
import reportError from '../core/reportError'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run prettier on this file? (Settings are in the .vscode/settings.json, if you use the VSCode plugin.)
const missingRequiredPaths = Object.keys(requiredFenceMap).filter(rf => !configPathMap[rf]); | ||
|
||
if (missingRequiredPaths.length > 0) { | ||
missingRequiredPaths.map(p => ({key: p, values: requiredFenceMap[p]})).forEach(kvp => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map(p => ({key: p, values: requiredFenceMap[p]})) [](start = 29, length = 49)
Why not just look up values inside the forEach
? Seems overcomplicated to iterate twice and use intermediate data structures.
Related issue: #24