Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gts gjs configuration example #1980

Merged
merged 2 commits into from Nov 7, 2023

Conversation

patricklx
Copy link
Contributor

No description provided.

@patricklx patricklx marked this pull request as ready for review November 4, 2023 22:26
@patricklx
Copy link
Contributor Author

@NullVoxPopuli would like your opinion too

README.md Outdated
@@ -70,6 +70,8 @@ module.exports = {
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:ember/gjs-recommended',
Copy link
Contributor

Choose a reason for hiding this comment

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

both gjs and gts for gts files? 🤷 why not the one that matches the extension?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can also be done. Just means we have to add rules to 2 configs

@@ -53,7 +53,7 @@ learn more [here](https://github.com/ember-template-imports/ember-template-impor
module.exports = {
overrides: [
{
files: ['**/*.{js,ts,gjs,gts}'],
files: ['**/*.{js,ts}'],
plugins: ['ember'],
extends: [
Copy link
Member

Choose a reason for hiding this comment

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

The configs in this example seem pretty redundant. I don't think we should be applying the same config multiple times.

eslint:recommended and plugin:ember/recommended can be applied outside an override. Then we can have a gts override which only applies the gts config. And likewise for a gjs override.

Copy link
Contributor

Choose a reason for hiding this comment

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

Outside-of-overrides is going away in eslint 9

There be OnlyOverrides soonp

So, the sooner we can start teaching people to favor overrides, the better.

The eslint folks did a whole blog series on this, and i endorse it.

Top level config is just... Bad (tldr)

Copy link
Member

Choose a reason for hiding this comment

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

Fair point. However, I think we should stick to showing the old .eslintrc.js format for now, instead of a mix of both formats.

https://eslint.org/docs/latest/use/configure/migration-guide#importing-plugins-and-custom-parsers

Copy link
Contributor

Choose a reason for hiding this comment

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

Since it's new config entirely, why bother adding to something that will be removed?

Copy link
Member

Choose a reason for hiding this comment

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

Normally, you should follow the patterns already in place in the codebase. The README has another example right above this using the old config format. So I'd prefer to keep things consistent. We can migrate the docs over to the new config format all at the same time for consistency, but that seems out-of-scope for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is also another part to consider, which i should have included in the example.
It's when setting a top level parser. E.g typescript.
Because the first parser set, will be used and cannot be overwritten anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

I opened #1983 for more details.

should stick to showing the old .eslintrc.js format for now, instead of a mix of both formats.

overrides only is still "old format", too!

ormally, you should follow the patterns already in place in the codebase

ye, but we're about to do a major so now's the chance!

new config format all at the same time for consistency,

I feel I may have been misunderstood.
I'm not suggesting documenting the new config format, just the pattern of using overrides only with the old format because it makes migrating to the new format easier later.

that seems out-of-scope for this PR.

roger roger

Because the first parser set, will be used and cannot be overwritten anymore

another reason to avoid top level config!

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough.

plugins: ['ember'],
parser: '@typescript-eslint/parser',
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't TS parser only be applied to TS files?

Copy link
Contributor

Choose a reason for hiding this comment

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

ye --- its not what the ember blueprint does --- but it should, imo (more cases for overrides only)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also, the example on typescript-eslint shows it on top level...

Copy link
Contributor

Choose a reason for hiding this comment

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

Not great

@NullVoxPopuli
Copy link
Contributor

needs rebase it looks like

@NullVoxPopuli NullVoxPopuli merged commit ba5c64a into ember-cli:master Nov 7, 2023
8 checks passed
@bmish bmish changed the title improve gts gjs configuration example Improve gts gjs configuration example Nov 7, 2023
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.

None yet

3 participants