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

feat!: use ESTree directive property when searching for "use strict" #118

Merged
merged 2 commits into from Jan 4, 2024

Conversation

mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Jan 3, 2024

Fixes #117

Updates the code that searches for "use strict" directives to use the directive property as the only way to determine whether a node represents a directive. All other ways are dropped, as it is expected that the given AST follows the ESTree Spec.

Option directive that was enabling the use of non-standard DirectiveStatement nodes is also dropped.

The ("use strict"); test demonstrates the behavior change. The other tests are added as regression tests, they were already passing before this change.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

The changes look good to me. Can you add a couple tests with "use strict" inside of a function just to cover our bases?

@mdjermanovic
Copy link
Member Author

I've added equivalent tests with function now.

Copy link
Contributor

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

I'll leave it open for @nzakas

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM.

@nzakas nzakas merged commit 23fe81f into main Jan 4, 2024
10 checks passed
@nzakas nzakas deleted the issue117 branch January 4, 2024 18:20
@github-actions github-actions bot mentioned this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

("use strict") is not a directive
3 participants