-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new diag "namespace alias" in javascript code
Summary: Add new diag E0719, using Typescript namespace alias in javascript code to separate E0274, rename some test functions from import_alias to namespace_alias This closes #1138
- Loading branch information
1 parent
195cd69
commit 24040d4
Showing
15 changed files
with
132 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,16 @@ | ||
# E0274: TypeScript import aliases are not allowed in JavaScript | ||
|
||
```config-for-examples | ||
{ | ||
"globals": { | ||
"goog": true | ||
} | ||
} | ||
``` | ||
|
||
TypeScript supports aliasing namespaces and namespace members using `import`. It | ||
is a syntax error to write such an alias in JavaScript code: | ||
TypeScript supports import alias using `import`. It is | ||
a syntax error to write such an alias in JavaScript code: | ||
|
||
```javascript | ||
import Chart = goog.Chart; | ||
import m = require('mod'); | ||
``` | ||
|
||
To fix this error, use `const` instead of `import`: | ||
|
||
```javascript | ||
const Chart = goog.Chart; | ||
``` | ||
```javascript | ||
const { Chart } = goog; | ||
const m = require('mod'); | ||
``` | ||
|
||
Introduced in quick-lint-js version 2.8.0. |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# E0719: TypeScript namespace aliases are not allowed in JavaScript | ||
|
||
```config-for-examples | ||
{ | ||
"globals": { | ||
"goog": true | ||
} | ||
} | ||
``` | ||
|
||
TypeScript supports aliasing namespaces and namespace members using `import`. It | ||
is a syntax error to write such an alias in JavaScript code: | ||
|
||
```javascript | ||
import Chart = goog.Chart; | ||
``` | ||
|
||
To fix this error, use `const` instead of `import`: | ||
|
||
```javascript | ||
const Chart = goog.Chart; | ||
``` | ||
```javascript | ||
const { Chart } = goog; | ||
``` |
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.