pattern-lab / patternlab-php-core

This repository provides the core functionality for Pattern Lab. It is meant to be used from within an Edition with a PatternEngine and StarterKit.
http://patternlab.io/
MIT License
43 stars 62 forks source link

Clean up / Normalize Parsing JSON / Yaml Data #146

Open sghoweri opened 6 years ago

sghoweri commented 6 years ago

I was putting together a PR for more helpful JSON error messages when I noticed that we seem to have a bunch of virtually identical but still different ways of reading JSON or YAML data + checking for errors.

For example:

patterninforule_php_ _untitled__workspace_ data_php_ _untitled__workspace_ pseudopatternrule_php pseudopatternrule_php_ _untitled__workspace_

@EvanLovely thoughts on trying to stick to some consistant variable names here -- maybe even just pull this chunk out into it's own function (pass the file to read in -- return the decoded data)? Could even lead to supporting other data formats if this single function got updated...