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

Switch to nested (not flattened) configs with stricter checks #4792

Merged
merged 11 commits into from
Mar 8, 2024

Commits on Mar 7, 2024

  1. Configuration menu
    Copy the full SHA
    64f72f8 View commit details
    Browse the repository at this point in the history
  2. Add config schema to all components

    This configured allowed types for config fields so we can check them in future
    colinrotherham committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    31efb1b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    53024e8 View commit details
    Browse the repository at this point in the history
  4. Move normaliseString() + tests to separate files

    This prevents circular dependency issues
    colinrotherham committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    9bb03c3 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Filter normaliseDataset() to discard unknown data attributes

    Since we only pass in `DOMStringMap` values, this removes all tests for `normaliseDataset()` that don’t pass in strings
    
    We also prevent unnecessary data attributes (e.g. `data-module="govuk-accordion"’) from being merged into the config
    
    See: #4230
    colinrotherham committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    ff1729e View commit details
    Browse the repository at this point in the history
  2. Update normaliseDataset() to output “unflattened” nested configs

    We can reduce the code we use by expanding dot-separated data-attributes at the point we read them
    
    This lets us remove `flattenConfigs()` since we can use nested configs everywhere
    colinrotherham committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    a748e74 View commit details
    Browse the repository at this point in the history
  3. Update normaliseString() to use schema property types

    Do you want a `data-example="2024"` to stay as a string?
    
    Data attributes now understand component config schema types
    
    Extra checks added to guard against objects, arrays and non-finite numbers (NaN, Infinity)
    colinrotherham committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    7458577 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5f7d55e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c847853 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9358b72 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    8ce1dc4 View commit details
    Browse the repository at this point in the history