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

Fix benchmark script #7504

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Fix benchmark script #7504

merged 1 commit into from
Jan 30, 2024

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Jan 30, 2024

This fixes the broken benchmark script (npm run benchmark)
The error reason is that rules[ruleName] has returned a Promise since 16.0.0.

$ npm run benchmark-rule -- value-keyword-case lower
...
const rule = ruleFunc(primary, secondary, context);
             ^

TypeError: ruleFunc is not a function
...

Also, this changes parserOptions.ecmaVersion in the ESLint config to allow top-level await.

Which issue, if any, is this issue related to?

None.

Is there anything in the PR that needs further explanation?

If we release eslint-config-stylelint including stylelint/eslint-config-stylelint#252 and bump the package version first, the ESLint config's change in this PR will be needless.

Of course, we can revisit it later.

This fixes the broken benchmark script (`npm run benchmark`)
The error reason is that `rules[ruleName]` has returned a `Promise` since 16.0.0.

```sh-session
$ npm run benchmark-rule -- value-keyword-case lower
...
const rule = ruleFunc(primary, secondary, context);
             ^

TypeError: ruleFunc is not a function
...
```

Also, this changes `parserOptions.ecmaVersion` in the ESLint config to allow top-level `await`.
Copy link

changeset-bot bot commented Jan 30, 2024

⚠️ No Changeset found

Latest commit: e664303

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ybiquitous
Copy link
Member Author

Success! 🎉

$ npm run benchmark-rule -- value-keyword-case lower

> stylelint@16.2.0 benchmark-rule
> node scripts/benchmark-rule.mjs value-keyword-case lower

Warnings: 120
Mean: 223.59690633333332 ms
Deviation: 14.505605610006747 ms

Copy link
Member

@romainmenke romainmenke left a comment

Choose a reason for hiding this comment

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

LGTM!

@ybiquitous ybiquitous merged commit 398d3a8 into main Jan 30, 2024
15 of 16 checks passed
@ybiquitous ybiquitous deleted the fix-benchmark-script branch January 30, 2024 15:37
@ybiquitous
Copy link
Member Author

Thanks for the quick review!

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

Successfully merging this pull request may close these issues.

2 participants