Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

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