Skip to content

Add exported meta object #190

New issue

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

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

Already on GitHub? # to your account

Merged
merged 5 commits into from
Apr 28, 2023
Merged

Conversation

TatsuyaYamamoto
Copy link
Contributor

Related issue: nothing

This PR’s purpose is to support ESLint flat config.

Loading vue-eslint-parser in flat config, ESLint check parser’s name and version in meta object.
https://github.com/eslint/eslint/blob/main/lib/config/flat-config-array.js#L196
https://github.com/eslint/eslint/blob/main/lib/config/flat-config-array.js#L45-L76

vue-eslint-parser can be used in the flat config by exporting the meta object like other packages:

@TatsuyaYamamoto
Copy link
Contributor Author

TatsuyaYamamoto commented Apr 27, 2023

https://github.com/vuejs/vue-eslint-parser/actions/runs/4810002085/jobs/8565427992?pr=190

Error: Cannot find module './package.json'

I'll fix this test

@TatsuyaYamamoto
Copy link
Contributor Author

@ota-meshi

Please advise. What path should I use to refer to package.json ?

When testing, “index.ts” should refer to package.json with ". /package.json”, but after build, “index.js” should refer to package.json with ". /package.json”.

Should I bind the version string with rollup at build time?

@ota-meshi
Copy link
Member

How about writing it like this:

    get version() {
        return require("./package.json").version;
    }

@ota-meshi
Copy link
Member

Should I bind the version string with rollup at build time?

I think it would be better if possible. I think using getters may seem like magic 😅

@TatsuyaYamamoto
Copy link
Contributor Author

@ota-meshi passed the tests in my local env!

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

Thank you for this PR! LGTM!

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

Successfully merging this pull request may close these issues.

2 participants