Open JacobLey opened 8 months ago
yea this is preventing me from my eslint 9 migration :/
Hi 👋 Can the team please offer some sort of expected timetable for this to be resolved? Flat config is the default in ESLint 9, which has been out for over a month now. Flat config itself has been available since 2022. For something very basic like this, we really would appreciate a bit more transparency about any scheduled fix. Thanks!
The solution for this issue might be here - there is already a TODO: https://github.com/nrwl/nx/blob/master/packages/eslint/src/utils/config-file.ts#L4
export const ESLINT_FLAT_CONFIG_FILENAMES = ['eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs'];
Is there any plan to support flat config by default while creating new workspaces? Because flat config is now default and recommended in ESLint Docs.
@ak274 I have already requested it https://github.com/nrwl/nx/discussions/26338, so far no news
hi @benpsnyder
I see you have added support for .cjs
but not .mjs
and added TODO for it
when do we expect the .mjs
to be done?
hi @benpsnyder
I see you have added support for
.cjs
but not.mjs
and added TODO for itwhen do we expect the
.mjs
to be done?
Adding support for .cjs was easy but I don't plan to work on .mjs at this time which will be harder to implement. I just solved the quick and easy task for now.
Can you explain what is hard about it I can try to work on it on the weekend
I just stumbled upon this as well, got a bit surprised when .mjs
didn't work ):
When is this going to be fixed? Do you have a timeline? I am not able to use eslint.config.mjs
For anyone who wants to use eslint.config.mjs
you can do so now, you just end up forced to manually specify the lint task in your project.json files (since the config file is not picked up by the plugin, so the lint task is not automatically generated).
In my case, since we just use the simplest eslint .
command it isn't a problem, but if you have a more complicated setup I guess it could be an issue.
Incidentally I do also have type: module
in my package.json files so this may be why this works, I haven't tried changing it to commonjs
since our build stack requires module
anyway.
@JamesHenry Would this be just adding the file name to https://github.com/nrwl/nx/blob/master/packages/eslint/src/utils/flat-config.ts#L5 here is there more? Willing to contribute if it is easy.
Current Behavior
Eslint's new Flat Config supports 3 names:
eslint.config.js
(inherits type from package.json, implied to be ESM otherwise)eslint.config.cjs
(explicitly commonjs)eslint.config.mjs
(explicitly ESM)Supported suffixes comes from Eslint's documentation directly: This is quoted from Eslint's documentation itself: https://eslint.org/docs/latest/use/configure/configuration-files-new#configuration-file
However Nx's eslint does not recognize anything other than
eslint.config.js
.This means it is not possible to explictly use CommonJS or ESM, especially if the desired format differs from what is in
package.json
Expected Behavior
Nx's eslint respects all 3 file extensions for Flat Config
GitHub Repo
No response
Steps to Reproduce
1.
Nx Report
Failure Logs
Package Manager Version
pnpm 8.15.4
Operating System
Additional Information
Eslint executor versin:
"@nx/eslint": "18.1.3"
This issue is admittedly light on reproducability, because I can just point directly in the code where these issues are occuring.
The following places explicitly hard code the
eslint.config.js
filename, and do not account for other extensions: