ESLint Flat Config (v9 support #2229) #2426
No reviewers
Labels
No labels
awaiting-reply
breaking changes
bug
cannot-reproduce
dependencies
documentation
duplicate
electron-issue
enhancement
fix-available
good first issue
help wanted
invalid
javascript
need more information
need rebase
official-youtube-music-issue
plugin request
question
release
security
stale
Status: blocked
typo
wontfix
ytmd-issue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: YTMD/youtube-music#2426
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have remade the config in ESLint's new format, as required by ESLint v9.
Major changes
eslint.config.mjs
file - which I assume would break actual prettier formatters built into IDEsOther changes
src/plugins/precise-volume/override.ts
Line 11:src/plugins/synced-lyrics/renderer/lyrics/fetch.ts
Line 19:Could you convert
.mjs
to.mts
?Thanks for your contribution!
I don't think that is possible

https://github.com/eslint/eslint/discussions/17726
Perhaps there is some roundabout convoluted way to do this, but I don't think it would be worth the effort when the
//@ts-check
directive effectively makes it a typescript file. https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.htmlactually, let me double check. https://github.com/eslint/rfcs/pull/117
@JellyBrick this is the conclusion I arrived at:
To parse config files, ESLint is hard coded to use Node (The possibility of using tsx was suggested in the ESLint RFC PR I mentioned earlier, but ultimately did not make it in)
However, Node recently added an experimental flag to strip types from TS files in 22.6.0 which means linting will not work on systems with one of the last 3 latest versions of Node - none of which are LTS (At time of writing)
Ignoring that, this lead me to
NODE_OPTIONS='--experimental-strip-types' pnpm run lint -c eslint.config.mts
However, this will not work on Windows because Windows requires setting environmental variables with a different command... which brings me to the latest iteration I've come up with
pnpm cross-env NODE_OPTIONS='--experimental-strip-types' eslint . -c eslint.config.mts"
broken down:
eslint.config.mts
as ESLint does not auto-detect the config file with non-JS extensionsWhile it's ultimately up to you, as I have provided a working method, I don't think the complexity of the command is worth the effort, when compared to
// @ts-check
paired with.mjs
, which gives you typescript linting and works out of the box, with the only pitfall being you cannot use typescript keywords (the most important being theas
keyword or specifying types with:type
There is an implentation for this in JS however, being JSDoc which most IDEs will grab information from properly@SomeAspy How about this? https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files
I think that would involve having eslint.config.mjs file point to eslint.config.mts, which seems to mostly defeat the purpose. Why do you want the eslint config to be TS?
I love typescript as much as the next guy, but I think having eslint.config.mjs point to eslint.config.mts seems like unnecessary clutter, although, I will oblige if you really want it.