Skip to content

Add eslint flat config support #26

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

Closed
wants to merge 1 commit into from

Conversation

bahulneel
Copy link

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'],
]

@rashfael
Copy link
Owner

rashfael commented Apr 2, 2024

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?

@bahulneel
Copy link
Author

bahulneel commented Apr 3, 2024 via email

@tk-tim
Copy link

tk-tim commented Jul 26, 2024

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

@@ -44,4 +48,4 @@
"peerDependencies": {
"eslint-plugin-vue": "^9.8.0"
}
}
}

Choose a reason for hiding this comment

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

This should be reverted.

@yanzhangshuai
Copy link

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

@bahulneel
Copy link
Author

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.

@rashfael
Copy link
Owner

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

@IlyaSemenov
Copy link

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

context.parserServices.getTemplateBodyTokenStore &&

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.

@lehni
Copy link

lehni commented Sep 18, 2024

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)

@rashfael
Copy link
Owner

I released v1.0.0 with flat config support by updating the tooling that I initially copied from eslint-plugin-vue.

@rashfael rashfael closed this Mar 23, 2025
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 this pull request may close these issues.

6 participants