Repository navigation
Use ESLint 9 and Flat Config - #10516
Conversation
| }, | ||
| "types": [ | ||
| "ember-source/types", | ||
| "./node_modules/ember-source/types/stable", |
There was a problem hiding this comment.
🤷 it seems that mixing import paths and file paths no longer works, and they all have to be file paths here
|
You can do the file filtering here, and avoid all the additional code changes? Some of those methods are public API. EDIT: Ah, the filenames would be the same, I see. Seems unfortunate. EDIT: Maybe the same can be achieved using the mapping functionality => ember-cli/blueprints/addon/index.js Lines 240 to 249 in ca8cd79 |
File map doesn't let you do conditional mapping |
| * ESM node files | ||
| */ | ||
| { | ||
| files: ['*.mjs'], |
There was a problem hiding this comment.
maybe
| files: ['*.mjs'], | |
| files: ['**/*.mjs'], |
like it's done on line 107 for .cjs?
There was a problem hiding this comment.
We don't know that we want to support more depths of mjs tho?
There was a problem hiding this comment.
@NullVoxPopuli fine by me, just was confused why we would support nested .cjs but not nested .mjs
There was a problem hiding this comment.
yeah, for me, it's about wanting to get rid of mjs soonish (with type=module)
2c61595 to
af3e1ad
Compare
| @return {FileInfo | null} | ||
| */ | ||
| buildFileInfo(intoDir, templateVariables, file) { | ||
| buildFileInfo(intoDir, templateVariables, file /*, options */) { |
There was a problem hiding this comment.
@NullVoxPopuli if this is commented, is this actually needed?
There was a problem hiding this comment.
It's just how I document that an argument is passed to this function.
It's used in blueprints/app/index.js, and passed where buildFileInfo is called in this file.
Without typescript, I tend to add a lot of comments so that I don't forgot what is passed where, what's optional, etc
710fd7f to
29594bc
Compare
| prettier, | ||
| { | ||
| ignores: ['dist/', 'node_modules/', 'coverage/', '!**/.*'], | ||
| linterOptions: { |
There was a problem hiding this comment.
I tried this setup in a v5.12 project and I noticed the global ignores config wasn't working as expected.
It seems that ignores must be the only key in the object to be considered the "global ignore" config.
We should split the linterOptions into a separate object.
There was a problem hiding this comment.
makes sense -- thank you for trying this out!
| ...emberRecommended.rules, | ||
| ...gjsRecommended.rules, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This updates the linting setup to the one that will be part of the blueprint soon: ember-cli/ember-cli#10516 This setup is fully compatible with .gjs, so we don't need a stopgap fix due to the eslint-plugin-ember upgrade. We did have to make some modifications since eslint-plugin-ember doesn't expose the flat configs as intended yet.
This updates the linting setup to the one that will be part of the blueprint soon: ember-cli/ember-cli#10516 This setup is fully compatible with .gjs, so we don't need a stopgap fix due to the eslint-plugin-ember upgrade. We did have to make some modifications since eslint-plugin-ember doesn't expose the flat configs as intended yet.
Notes:
--typescriptembroider-build/app-blueprint#80--typescriptembroider-build/app-blueprint#80This does mean there is a bit of duplication, but I think the tradeoff is worth it.
To get this to work, I had to thread
optionsthrough a couple methods in the blueprint and then add a.filter(Boolean)to filter out "null" (files not applicable based on options).This couldn't use the same technique as the other TS files, because there are two hardcoded, and irrelevant features we have so far:
And what we want here is "conditionally rename files based on options, deleting the conditionally irrelevant variant" -- if you look in buildFileInfo, you'll see -- the logic is pretty easy