Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Breaking: Use ESTree export node types in modules (fixes# 263) #265

Merged
merged 2 commits into from
Jun 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint.

**Important:** This parser is not fully compatbile with all ESLint rules and plugins. Some rules will improperly mark source code as failing or not find problems where it should.
**Important:** This parser is not fully compatible with all ESLint rules and plugins. Some rules will improperly mark source code as failing or not find problems where it should.

## Supported TypeScript Version

Expand All @@ -24,6 +24,8 @@ The following ESLint rules will fail on acceptable code:

The follow ESLint plugins have issues when used with this parser:
- eslint-plugin-react [#213](https://github.com/eslint/typescript-eslint-parser/issues/213)
- eslint-plugin-import
- prefer-default-export - Will fail exports inside of Namespaces or Modules

The following TypeScript syntax will cause rules to fail or ESLint v3 to crash:
- Empty body functions
Expand Down Expand Up @@ -51,7 +53,7 @@ If you're familiar with TypeScript and ESLint, and you'd like to see this projec

## Reporting Bugs

Please check the current list of open and known issues and ensure the bug has not been reported before. When creating a new issue provide as much information about your enviroment as possible. This includes:
Please check the current list of open and known issues and ensure the bug has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes:
- ESLint Version
- TypeScript version
- TypeScript parser version
Expand Down
10 changes: 1 addition & 9 deletions lib/node-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,7 @@ function fixExports(node, result, ast) {
result.range[0] = varToken.getStart();
result.loc = getLocFor(result.range[0], result.range[1], ast);

let declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";

/**
* Prefix exports from TypeScript namespaces with "TS" to distinguish
* them from ES2015 exports
*/
if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) {
declarationType = "TSNamespaceExportDeclaration";
}
const declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";

const newResult = {
type: declarationType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = {
},
"body": [
{
"type": "TSNamespaceExportDeclaration",
"type": "ExportNamedDeclaration",
"declaration": {
"type": "TSNamespaceFunctionDeclaration",
"range": [
Expand Down
Loading