Skip to content

Use ESLint 9 and Flat Config - #10516

Merged
NullVoxPopuli merged 6 commits into
masterfrom
eslint-9-flat-config
Oct 15, 2024
Merged

NullVoxPopuli merged 6 commits into
masterfrom
eslint-9-flat-config

Conversation

@NullVoxPopuli

@NullVoxPopuli NullVoxPopuli commented Oct 10, 2024 •

Copy link
Copy Markdown
Contributor

Notes:

},
"types": [
"ember-source/types",
"./node_modules/ember-source/types/stable",

@NullVoxPopuli NullVoxPopuli Oct 10, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 it seems that mixing import paths and file paths no longer works, and they all have to be file paths here

@bertdeblock

bertdeblock commented Oct 13, 2024 •

Copy link
Copy Markdown
Member

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 =>

fileMap: {
'^app/.gitkeep': 'app/.gitkeep',
'^app.*': 'tests/dummy/:path',
'^config.*': 'tests/dummy/:path',
'^public.*': 'tests/dummy/:path',
'^addon-config/ember-try.js': 'tests/dummy/config/ember-try.js',
'^npmignore': '.npmignore',
},
in combination with the existing filtering logic.

Comment thread blueprints/addon/files/npmignore Resolved
@NullVoxPopuli

NullVoxPopuli commented Oct 13, 2024 •

Copy link
Copy Markdown
Contributor Author

Maybe the same can be achieved using the mapping functionality =>

File map doesn't let you do conditional mapping

* ESM node files
*/
{
files: ['*.mjs'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

Suggested change
files: ['*.mjs'],
files: ['**/*.mjs'],

like it's done on line 107 for .cjs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't know that we want to support more depths of mjs tho?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NullVoxPopuli fine by me, just was confused why we would support nested .cjs but not nested .mjs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, for me, it's about wanting to get rid of mjs soonish (with type=module)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

Comment thread blueprints/app/files/package.json Resolved
@NullVoxPopuli
NullVoxPopuli force-pushed the eslint-9-flat-config branch 2 times, most recently from 2c61595 to af3e1ad Compare October 13, 2024 15:01
Comment thread lib/models/blueprint.js
@return {FileInfo | null}
*/
buildFileInfo(intoDir, templateVariables, file) {
buildFileInfo(intoDir, templateVariables, file /*, options */) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NullVoxPopuli if this is commented, is this actually needed?

@NullVoxPopuli NullVoxPopuli Oct 14, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@NullVoxPopuli
NullVoxPopuli merged commit 2f46ef4 into master Oct 15, 2024
@NullVoxPopuli
NullVoxPopuli deleted the eslint-9-flat-config branch October 15, 2024 16:39
prettier,
{
ignores: ['dist/', 'node_modules/', 'coverage/', '!**/.*'],
linterOptions: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense -- thank you for trying this out!

Comment on lines +48 to +49
...emberRecommended.rules,
...gjsRecommended.rules,

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

Windvis added a commit to lblod/frontend-loket that referenced this pull request Oct 17, 2024
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.
Windvis added a commit to lblod/frontend-loket that referenced this pull request Nov 6, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants