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

formatting rules are not exported in build output #509

Closed
veritem opened this issue Aug 15, 2024 · 3 comments · Fixed by #521
Closed

formatting rules are not exported in build output #509

veritem opened this issue Aug 15, 2024 · 3 comments · Fixed by #521

Comments

@veritem
Copy link
Member

veritem commented Aug 15, 2024

No description provided.

@ixartz
Copy link

ixartz commented Aug 15, 2024

It's extremely strange because in the source code you see the code: https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/src/index.ts#L209 but in the build output, the code disappear.

@veritem
Copy link
Member Author

veritem commented Aug 15, 2024

i have no clue why it's happening to be honest. if you want to dig into it sure, go a head. I don't have time right now.

@azu
Copy link
Contributor

azu commented Aug 28, 2024

unbuild compile

export const RULE_NAME = get_filename(import.meta.url)

to

const RULE_NAME$7 = getFilename((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));

It means that use require("u" + "rl").pathToFileURL(__filename).href.

The build output file name always be index.cjs.
https://www.npmjs.com/package/@vitest/eslint-plugin?activeTab=code

As a result, padding* rules use same RULE_NAME and override these.

[paddingAroundAfterAllBlocksName]: paddingAroundAfterAllBlocks,
[paddingAroundAfterEachBlocksName]: paddingAroundAfterEachBlocks,
[paddingAroundAllName]: paddingAroundAll,
[paddingAroundBeforeAllBlocksName]: paddingAroundBeforeAllBlocks,
[paddingAroundBeforeEachBlocksName]: paddingAroundBeforeEachBlocks,
[paddingAroundDescribeBlocksName]: paddingAroundDescribeBlocks,
[paddingAroundExpectGroupsName]: paddingAroundExpectGroups,
[paddingAroundTestBlocksName]: paddingAroundTestBlocks

Perhaps a simple solution would be to define RULE_NAME as just a string instead of get_filename(import.meta.url).

- export const RULE_NAME = get_filename(import.meta.url)
+ export const RULE_NAME = "padding-around-after-each-blocks"

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.

3 participants