Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn namespace assignment error into a warning (#3633)
* turn namespace assignment error into a warning * refactoring
- Loading branch information
1 parent
d613137
commit 2cf243a
Showing
3 changed files
with
41 additions
and
36 deletions.
There are no files selected for viewing
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
28 changes: 15 additions & 13 deletions
28
test/function/samples/namespace-reassign-import-fails/_config.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,24 +1,26 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
description: 'disallows reassignments to namespace exports', | ||
error: { | ||
code: 'ILLEGAL_NAMESPACE_REASSIGNMENT', | ||
message: `Illegal reassignment to import 'exp'`, | ||
pos: 31, | ||
watchFiles: [path.resolve(__dirname, 'main.js'), path.resolve(__dirname, 'foo.js')], | ||
loc: { | ||
file: path.resolve(__dirname, 'main.js'), | ||
line: 3, | ||
column: 0 | ||
}, | ||
frame: ` | ||
description: 'warns for reassignments to namespace exports', | ||
warnings: [ | ||
{ | ||
code: 'ILLEGAL_NAMESPACE_REASSIGNMENT', | ||
message: `Illegal reassignment to import 'exp'`, | ||
id: path.resolve(__dirname, 'main.js'), | ||
pos: 31, | ||
loc: { | ||
file: path.resolve(__dirname, 'main.js'), | ||
line: 3, | ||
column: 0 | ||
}, | ||
frame: ` | ||
1: import * as exp from './foo'; | ||
2: | ||
3: exp.foo = 2; | ||
^ | ||
` | ||
} | ||
} | ||
] | ||
}; | ||
|
||
// test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/namespace-reassign-import-fails |
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