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

Flat config support & improvements for d.ts #194

Closed
what1s1ove opened this issue Mar 17, 2024 · 2 comments · Fixed by #196
Closed

Flat config support & improvements for d.ts #194

what1s1ove opened this issue Mar 17, 2024 · 2 comments · Fixed by #196

Comments

@what1s1ove
Copy link

what1s1ove commented Mar 17, 2024

Hey guys! First of all, thank you for such a cool plugin!

Since ESLint 9 is soon to be released, are there any plans to add a Flat config and, equally importantly, improve the d.ts files of the plugin?

eslint.config.js:17:3 - error TS2322: Type 'typeof import("node_modules/eslint-plugin-lit/lib/index")' is not assignable to type 'Plugin'.
  Types of property 'configs' are incompatible.
    Type '{ all: { plugins: string[]; rules: { 'lit/attribute-value-entities': string; 'lit/binding-positions': string; 'lit/lifecycle-super': string; 'lit/no-duplicate-template-bindings': string; 'lit/no-invalid-escape-sequences': string; ... 15 more ...; 'lit/value-after-constraints': string; }; }; recommended: { ...; }; }' is not assignable to type 'Record<string, FlatConfig | ConfigData<RulesRecord> | FlatConfig[]>'.
      Property 'all' is incompatible with index signature.
        Type '{ plugins: string[]; rules: { 'lit/attribute-value-entities': string; 'lit/binding-positions': string; 'lit/lifecycle-super': string; 'lit/no-duplicate-template-bindings': string; 'lit/no-invalid-escape-sequences': string; ... 15 more ...; 'lit/value-after-constraints': string; }; }' is not assignable to type 'FlatConfig | ConfigData<RulesRecord> | FlatConfig[]'.
          Type '{ plugins: string[]; rules: { 'lit/attribute-value-entities': string; 'lit/binding-positions': string; 'lit/lifecycle-super': string; 'lit/no-duplicate-template-bindings': string; 'lit/no-invalid-escape-sequences': string; ... 15 more ...; 'lit/value-after-constraints': string; }; }' is not assignable to type 'ConfigData<RulesRecord>'.
            Types of property 'rules' are incompatible.
              Type '{ 'lit/attribute-value-entities': string; 'lit/binding-positions': string; 'lit/lifecycle-super': string; 'lit/no-duplicate-template-bindings': string; 'lit/no-invalid-escape-sequences': string; ... 15 more ...; 'lit/value-after-constraints': string; }' is not assignable to type 'Partial<RulesRecord>'.
                Property ''lit/attribute-value-entities'' is incompatible with index signature.
                  Type 'string' is not assignable to type 'RuleEntry<any[]> | undefined'.

17   lit,
     ~~~

eslint.config.js:19:2 - error TS2322: Type '{ 'lit/attribute-value-entities': string; 'lit/binding-positions': string; 'lit/lifecycle-super': string; 'lit/no-duplicate-template-bindings': string; 'lit/no-invalid-escape-sequences': string; ... 15 more ...; 'lit/value-after-constraints': string; }' is not assignable to type 'RulesRecord'.
  Property ''lit/attribute-value-entities'' is incompatible with index signature.
    Type 'string' is not assignable to type 'RuleEntry<any[]>'.

19  rules: lit.configs.all.rules,
    ~~~~~

  ../../node_modules/@types/eslint/index.d.ts:1116:9
    1116         rules?: RulesRecord;
                 ~~~~~
    The expected type comes from property 'rules' which is declared here on type 'FlatConfig'
@43081j
Copy link
Owner

43081j commented Mar 18, 2024

would love to add support for flat config, just haven't had chance yet to fully understand how to have "dual" support (i.e. support flag config and rc files)

ill ask around but i think we would need to have two exported config sets

a flat config needs the plugin as a reference afaik, while an rc config needs it as a string

@what1s1ove
Copy link
Author

what1s1ove commented Mar 18, 2024

would love to add support for flat config, just haven't had chance yet to fully understand how to have "dual" support (i.e. support flag config and rc files)

ill ask around but i think we would need to have two exported config sets

a flat config needs the plugin as a reference afaik, while an rc config needs it as a string

Recently, several plugins have migrated to similar support. You might find it interesting to take a look.

By the way, here in the issue of my personal project what1s1ove/whatislove.dev#270 where I track the migration progress of my favorite plugins. You can find issues of some other well-known plugins that are in the process of migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants