eslint-plugin-vue-pug icon indicating copy to clipboard operation
eslint-plugin-vue-pug copied to clipboard

Add eslint flat config support

Open bahulneel opened this issue 1 year ago • 8 comments

Flat config is going to be the default in eslint 9, this migrates/hacks the current generated conf into a flat version that can be used in eslint.config.js

import vuePug from 'eslint-plugin-vue-pug/flat'
export default [
   // Other config
  vuePug.configs['vue3-recommended'],
]

bahulneel avatar Apr 02 '24 12:04 bahulneel

Thanks for working on this!

plugin-vue-pug is borrowing tools to generate configs from plugin-vue. They have created new scripts to accomodate flat configs in this PR. plugin-vue-pug should follow the same approach to stay in sync with them. It also looks like plugin-vue switched the default for configs to vue3 and now uses vue2- es prefix for configs. plugin-vue-pug should follow suite.

Do you want to look into borrowing from plugin-vue again?

rashfael avatar Apr 02 '24 15:04 rashfael

Sure, I'll look into it.

On Tue, 2 Apr 2024, 16:44 rash, @.***> wrote:

Thanks for working on this!

plugin-vue-pug is borrowing tools to generate configs from plugin-vue. They have created new scripts to accomodate flat configs in this PR https://github.com/vuejs/eslint-plugin-vue/pull/2407. plugin-vue-pug should follow the same approach to stay in sync with them. It also looks like plugin-vue switched the default for configs to vue3 and now uses vue2- es prefix for configs. plugin-vue-pug should follow suite.

Do you want to look into borrowing from plugin-vue again?

— Reply to this email directly, view it on GitHub https://github.com/rashfael/eslint-plugin-vue-pug/pull/26#issuecomment-2032417111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH7JJTEVI7EBN7I43AYM53Y3LG6JAVCNFSM6AAAAABFTIG4XGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZSGQYTOMJRGE . You are receiving this because you authored the thread.Message ID: @.***>

bahulneel avatar Apr 03 '24 04:04 bahulneel

Hey, can you tell what status is for this issue? vue + eslint + pug still doesn't work in flat config

tk-tim avatar Jul 26 '24 11:07 tk-tim

How to use eslint-plugin-pug in eslint flat. I use pug and eslint@9 in my vue project. There is a problem that that trouble me.

ts/consistent-type-imports rule will InstanceType<typeof Component> covert to import type Component from 'xxxxxx', but this is error

I need help. Thanks.

image

yanzhangshuai avatar Sep 14 '24 05:09 yanzhangshuai

Unfortunately I've stopped working on the project that requires pug, so I haven't had the time to return to this.

Hopefully, someone else can make some progress.

bahulneel avatar Sep 15 '24 14:09 bahulneel

Thanks for giving it a go @bahulneel ! I'll have a look at it again.

rashfael avatar Sep 17 '24 07:09 rashfael

While we are here, I don't think vue-pug/component-name-in-template-casing works in ESLint 9. It crashes here:

https://github.com/rashfael/eslint-plugin-vue-pug/blob/826dbcfcf16a6082c48c3d7e319ecfb00dd69807/lib/rules/component-name-in-template-casing.js#L71

because there is no such thing as context.parserServices. Based on the documentation, I believe in fact there shouldn't be one, instead there should be context.sourceCode.parserServices.

IlyaSemenov avatar Sep 17 '24 08:09 IlyaSemenov

Seeing the same issue as @IlyaSemenov just now…

TypeError: Error while loading rule 'vue-pug/component-name-in-template-casing': Cannot read properties of undefined (reading 'getTemplateBodyTokenStore')
    at Object.create ([...]/node_modules/eslint-plugin-vue-pug/lib/rules/component-name-in-template-casing.js:71:30)
    at createRuleListeners ([...]/node_modules/eslint/lib/linter/linter.js:942:21)
    at [...]/node_modules/eslint/lib/linter/linter.js:1067:84
    at Array.forEach (<anonymous>)
    at runRules ([...]/node_modules/eslint/lib/linter/linter.js:998:34)
    at Linter._verifyWithoutProcessors ([...]/node_modules/eslint/lib/linter/linter.js:1424:31)
    at [...]/node_modules/eslint/lib/linter/linter.js:2100:29
    at Array.map (<anonymous>)
    at Linter._verifyWithProcessor ([...]/node_modules/eslint/lib/linter/linter.js:2095:37)
    at Linter._verifyWithConfigArray ([...]/node_modules/eslint/lib/linter/linter.js:1987:25)

lehni avatar Sep 18 '24 10:09 lehni