Skip to content
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

chore: Improve propertySetup error handling #1023

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thilohaas
Copy link

Issue #, if available:

Description of changes:
For bigger projects, its nearly impossible to locate the error, when an empty name is provided.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@thilohaas thilohaas requested a review from a team as a code owner October 10, 2023 13:11
@jorenbroekema
Copy link
Collaborator

Could you rebase this to the v4 branch? the main/v3 branch is quite far behind at this point so I'm aiming to only backport really important bug or security fixes to it. This PR definitely seems useful, so I'll happily review and merge this to v4.

You'll also need to update this test:
https://github.com/amzn/style-dictionary/blob/v4/__tests__/transform/propertySetup.test.js#L23

@@ -29,7 +29,7 @@ function propertySetup(property, name, path) {
if (!property && !_.isPlainObject(property))
throw new Error('Property object must be an object');
if (!name || !_.isString(name))
throw new Error('Name must be a string');
throw new Error('Name must be a string at path: ' + _.isArray(path) ? path.join('.') : path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In v4 we're aiming to ditch lodash and es6 helpers, you can use native Array.isArray() instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants