linting: disallow t.identifier("undefined") in plugins (#6096)
* add new custom eslint rule, replace remaining t.identifier("undefined") with buildUndefinedNode(), update tests
* change no-undefined-identifier reporting descriptor
This commit is contained in:
committed by
Justin Ridgewell
parent
4577bd1b7c
commit
2db0c3ad1d
@@ -201,7 +201,7 @@ export default function() {
|
||||
state.opts.allowTopLevelThis !== true &&
|
||||
!path.findParent(path => THIS_BREAK_KEYS.indexOf(path.type) >= 0)
|
||||
) {
|
||||
path.replaceWith(t.identifier("undefined"));
|
||||
path.replaceWith(path.scope.buildUndefinedNode());
|
||||
}
|
||||
},
|
||||
|
||||
@@ -568,7 +568,7 @@ export default function() {
|
||||
maxHoistedExportsNodeAssignmentLength,
|
||||
);
|
||||
|
||||
let hoistedExportsNode = t.identifier("undefined");
|
||||
let hoistedExportsNode = scope.buildUndefinedNode();
|
||||
|
||||
nonHoistedExportNamesChunk.forEach(function(name) {
|
||||
hoistedExportsNode = buildExportsAssignment(
|
||||
|
||||
Reference in New Issue
Block a user