bluesky-social / social-app

The Bluesky Social application for Web, iOS, and Android
https://bsky.app
MIT License
11.82k stars 1.51k forks source link

DRAFT: migrate bsky.social to eslint v9 + flat config #6494

Closed PaulACoroneos closed 3 days ago

PaulACoroneos commented 4 days ago

I have started work to migrate the main eslint config for bsky.social to flat config + ESlint v9. I am probably going to need some help from core team because:

image

(but don't panic, a lot of errors are the same one over, and over again. We had options of course we can discuss in this PR).

OPEN TODO's

Working on this migration has similarly been hard for my day to day (actually doing an even bigger migration now) so apologies if this is not a complete start. But I am hoping we can use it as a starting point. Please let me know what steps I can take to help move this forward.

Examples of broken stuff I think we can just fix (I am fine if we want to consider disabling this rule(s) if we don't want them, disabling for now, then re-enabling in follow up MR, etc):

image image
PaulACoroneos commented 4 days ago

Okay latest update. I have "disabled" the following rules with an intent to "quick follow" most of them:

{
      'no-async-promise-executor': 'off',
      'no-case-declarations': 'off',
      'no-control-regex': 'off',
      'no-dupe-else-if': 'off',
      'no-empty': 'off',
      'no-empty-pattern': 'off',
      'no-irregular-whitespace': 'off',
      'no-prototype-builtins': 'off',
      'no-sparse-arrays': 'off',
      'no-unsafe-optional-chaining': 'off',
      'no-useless-escape': 'off',
      'no-var': 'off',
      'prefer-const': 'off',
      'prefer-rest-params': 'off',
      '@typescript-eslint/ban-ts-comment': "off",
      "@typescript-eslint/no-empty-object-type": ["error", { "allowObjectTypes": "always" }],
      '@typescript-eslint/no-explicit-any': 'warn',
      '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
      '@typescript-eslint/no-unsafe-function-type': 'off',
      '@typescript-eslint/no-unused-expressions':'off',
      "@typescript-eslint/no-require-imports": "off",
      '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_'  }],
      '@typescript-eslint/no-wrapper-object-types': 'off'
 }     

I did go ahead and fix/enforce @typescript-eslint/no-unused variables and that is now present in the MR. I have found at least one logic bug so far using the above rules (not fixed for this MR, ideally id fix as part of turning on that rule, but I can split if we deem it higher priority:

image

https://github.com/bluesky-social/social-app/blob/0b38c77faa71dbc777d3d0162b86cb3e8695ff99/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx#L189

PaulACoroneos commented 3 days ago

I am going to close this MR as simplifying it might as well start from scratch