-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26dc13c
commit 3a4d9a1
Showing
3 changed files
with
12 additions
and
15 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
codemods/convert-any-to-primitive/lib/convert-any-to-primitive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import {types, operator} from 'putout'; | ||
|
||
const {compare} = operator; | ||
|
||
const { | ||
isNumericLiteral, | ||
isStringLiteral, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 6 additions & 8 deletions
14
packages/plugin-minify/lib/remove-return-undefined/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
export const report = () => `Avoid 'return undefined'`; | ||
|
||
export const match = () => ({ | ||
return: check, | ||
return: (vars, {parentPath}) => { | ||
if (!parentPath.isBlockStatement()) | ||
return false; | ||
|
||
return parentPath.parentPath.isFunction(); | ||
}, | ||
}); | ||
|
||
export const replace = () => ({ | ||
'return': '', | ||
'return undefined': 'return', | ||
'return void 0': 'return', | ||
}); | ||
|
||
function check(vars, {parentPath}) { | ||
if (!parentPath.isBlockStatement()) | ||
return false; | ||
|
||
return parentPath.parentPath.isFunction(); | ||
} |