We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d0d6136 commit 6cfd4bfCopy full SHA for 6cfd4bf
1 file changed
src/index.js
@@ -0,0 +1,23 @@
1
+'use strict';
2
+
3
+module.exports = function ({ types: t }) {
4
+ return {
5
+ name: 'transform-not-strict',
6
+ visitor: {
7
+ Directive(path) {
8
+ if (path.node.value.value === 'use strict') {
9
+ const siblings = path.container // get all the sibilings (code in the same level) of 'use strict'
10
11
+ for (const sibling of siblings) {
12
+ if (t.isDirective(sibling)) { // if the sibiling is a directive
13
+ if (sibling.value.value === 'not strict') { // check if its 'not strict'
14
+ path.remove(); // remove 'use strict'
15
+ break;
16
+ }
17
18
19
20
+ },
21
22
+ };
23
+};
0 commit comments