-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor code #21
base: main
Are you sure you want to change the base?
Refactor code #21
Conversation
|
||
const clone = obj => JSON.parse(JSON.stringify(obj)); | ||
|
||
describe('diff', () => { |
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.
We probably should test each of the utilities in its own test file, but for the time being, I made one test for everything in case we want to try another approach (see PR description).
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.
I'm on board with this! Feels a lot more legible and should better fit our needs.
expect(actual).toEqual(expected); | ||
}); | ||
|
||
// TODO add before and after |
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.
Is this still relevant?
}); | ||
|
||
describe('diffs sources', () => { | ||
// TODO add source object |
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.
Is this still relevant?
const diffLayerProps = (a, b) => { | ||
let diff = {}; | ||
|
||
// This function runs inside the style expressions to find single matches and populate the warnings array |
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.
This comment feels slightly like it's referring to the linter instead right?
Leaving a note here since I've let this sit a bit. Just want to come back and confirm there's nothing to handle in the TODO comments here before merging. I think some of it has to do with consistifying structure of the output more, which we might want to handle just once here in a major version update since this makes some changes already. |
Closes #19
This PR removes the old code which was pulled from the style spec and updated as needed with our own diffing code.
This slightly changes the output, so this would be a breaking change, but we could adjust back to the output we had before if that's more desirable. I think we could probably be a little more thoughtful about the final output here, but I updated the README to reflect the current state (mostly I wonder if we should remove
before
values or alternatively usebefore
andafter
for all types of changes including removals and additions (which would usenull
for one of these).@ebrelsford I'm curious if you think this is the right approach. Alternatively, I can quickly put together a branch where we just edit the output of the
diff
function in the style spec (rather than copypasta) to see if that feels better to maintain.