Tirraa / dashboard_rtm

dashboard_rtm
MIT License
5 stars 1 forks source link

[Refactor][Static Analyzer] Abandon most of the static analyzer's operation with code generation #59

Closed gustaveWPM closed 9 months ago

gustaveWPM commented 9 months ago

I've given it a lot of thought, and in the end I think the code is now sufficiently abstract and well-structured that there's not much need for the static analyzer. (Its code was horrible, so it's good to be able to remove a lot of it).

In fact, I think the future of type safety and DX in this project lies in code generation.

Likewise:

// {ToDo} Autogenerate this
const STATICLY_CHECKED_DATA = {
  'blog-categories': {
    'patch-notes': {
      _title: '__SCANNED_ON_BUILD_FIELD__',
      '_meta-description': '__SCANNED_ON_BUILD_FIELD__',

      'discord-bot': {
        title: '__SCANNED_ON_BUILD_FIELD__',
        'meta-description': '__SCANNED_ON_BUILD_FIELD__'
      },
      dashboard: {
        title: '__SCANNED_ON_BUILD_FIELD__',
      // * ...

And:

// {ToDo} Autogenerate this
export type BlogArchitecture = {
  'patch-notes': 'dashboard' | 'discord-bot';
  'patch-notes-bis': 'dashboard-bis' | 'discord-bot-bis';
  testing: 'fake-subcategory';
};

Autogenerating this will remove 85% of the static analyzer code. Looks nice to me.

gustaveWPM commented 9 months ago

BlogArchitecture is now autogenerated: https://github.com/Tirraa/dashboard_rtm/commit/49d8d5875a837858fa22a7024a14542deea128de

gustaveWPM commented 9 months ago

STATICLY_CHECKED_DATA is now autogenerated: https://github.com/Tirraa/dashboard_rtm/commit/c7e171f6b0f2938bbf69f1515cace939625906b5

gustaveWPM commented 9 months ago

LGTM