spacebarchat / server

Spacebar server - A reimplementation of the Discord.com backend, built with Typescript and love
https://spacebar.chat
GNU Affero General Public License v3.0
1.48k stars 251 forks source link

Change eslint config to use new flat config format #1232

Closed dank074 closed 1 week ago

dank074 commented 1 week ago

While attempting to commit I got the following error message:

Oops! Something went wrong! :(
ESLint: 9.13.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

husky - pre-commit script failed (code 1)

This PR updates the eslint config to use the new flat config format

MaddyUnderStars commented 1 week ago

The CI failed eslint seemingly because the disabled rules are running? Could you have a look at that for me please?

TheArcaneBrony commented 1 week ago

Is this just copy paste'd from #1231 ?

dank074 commented 1 week ago

Is this just copy paste'd from #1231 ?

No I ran the migration script myself. Cyber mentioned he had committed these changes but they were not in its own PR

dank074 commented 1 week ago

The CI failed eslint seemingly because the disabled rules are running? Could you have a look at that for me please?

The disabled rules aren't the ones throwing the errors. These are the currently disabled rules:

"no-mixed-spaces-and-tabs": "off",
"@typescript-eslint/no-inferrable-types": "off", // Required by typeorm
"@typescript-eslint/no-var-requires": "off", // Sometimes requred by typeorm to resolve circular deps

and the CI is erroring with the below ones:

  73:39  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
Error:    74:18  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
Error:   214:24  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports

/home/runner/work/server/server/src/api/util/utility/EmbedHandlers.ts
Error:   103:11  error  'e' is defined but never used  @typescript-eslint/no-unused-vars
Error:   136:11  error  'e' is defined but never used  @typescript-eslint/no-unused-vars

Going to try to see what's causing it.

dank074 commented 1 week ago

Would you prefer that I turn these two rules off, or that I add eslint disable directives to the lines causing problems?

Edit: I added the rules to the disabled list. Let me know if you want me to do the latter instead

MaddyUnderStars commented 1 week ago

Sorry for the long wait and the incorrect reply lol yes this is fine. Thanks a lot