From 6de19d3357706903c0ba7a73ef35aac6bfe048e7 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 8 Jul 2019 05:43:47 -0700 Subject: [PATCH 1/4] fix(typescript-estree): fix `async` identifier token typed as `Keyword` (#681) --- .../lib/__snapshots__/typescript.ts.snap | 608 +++++++ .../basics/keyword-variables.src.ts | 13 + packages/typescript-estree/src/node-utils.ts | 23 +- .../semantic-diagnostics-enabled.ts.snap | 2 + .../lib/__snapshots__/typescript.ts.snap | 1436 +++++++++++++++++ 5 files changed, 2071 insertions(+), 11 deletions(-) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index aab28814499..2e00218b783 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -18534,6 +18534,614 @@ Object { } `; +exports[`typescript fixtures/basics/keyword-variables.src 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 154, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 154, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "get", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 13, + ], + "type": "Literal", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "set", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 27, + 28, + ], + "type": "Literal", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "module", + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 45, + 46, + ], + "type": "Literal", + }, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "type", + "range": Array [ + 54, + 58, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 61, + 62, + ], + "type": "Literal", + }, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "async", + "range": Array [ + 70, + 75, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": Object { + "range": Array [ + 78, + 79, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "async": Object { + "$ref": 4, + }, + "get": Object { + "$ref": 0, + }, + "module": Object { + "$ref": 2, + }, + "set": Object { + "$ref": 1, + }, + "type": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "get", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 13, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + Object { + "name": Object { + "name": "get", + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 93, + 96, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 82, + 153, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "get", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + Object { + "name": "get", + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + }, + ], + "name": "get", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "set", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 28, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 15, + 29, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + Object { + "name": Object { + "name": "set", + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 100, + 103, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 82, + 153, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "set", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + Object { + "name": "set", + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + }, + ], + "name": "set", + "references": Array [ + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "module", + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 36, + 46, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 30, + 47, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + Object { + "name": Object { + "name": "module", + "range": Array [ + 107, + 113, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 107, + 113, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 82, + 153, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "module", + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + }, + Object { + "name": "module", + "range": Array [ + 107, + 113, + ], + "type": "Identifier", + }, + ], + "name": "module", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "type", + "range": Array [ + 54, + 58, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 54, + 62, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 48, + 63, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + Object { + "name": Object { + "name": "type", + "range": Array [ + 117, + 121, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 117, + 121, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 82, + 153, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "type", + "range": Array [ + 54, + 58, + ], + "type": "Identifier", + }, + Object { + "name": "type", + "range": Array [ + 117, + 121, + ], + "type": "Identifier", + }, + ], + "name": "type", + "references": Array [ + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "async", + "range": Array [ + 70, + 75, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 70, + 79, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + Object { + "name": Object { + "name": "async", + "range": Array [ + 125, + 130, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 125, + 130, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 82, + 153, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "async", + "range": Array [ + 70, + 75, + ], + "type": "Identifier", + }, + Object { + "name": "async", + "range": Array [ + 125, + 130, + ], + "type": "Identifier", + }, + ], + "name": "async", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [], +} +`; + exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` Object { "$id": 2, diff --git a/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts new file mode 100644 index 00000000000..f4cbb3212bf --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts @@ -0,0 +1,13 @@ +const get = 1; +const set = 1; +const module = 1; +const type = 1; +const async = 1; + +import { + get, + set, + module, + type, + async, +} from 'fake-module'; diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index d682bb091b4..a8d1b137d1c 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -455,6 +455,7 @@ export function getTokenType(token: any): AST_TOKEN_TYPES { case SyntaxKind.SetKeyword: case SyntaxKind.TypeKeyword: case SyntaxKind.ModuleKeyword: + case SyntaxKind.AsyncKeyword: return AST_TOKEN_TYPES.Identifier; default: @@ -550,17 +551,17 @@ export function convertToken( ast: ts.SourceFile, ): TSESTree.Token { const start = - token.kind === SyntaxKind.JsxText - ? token.getFullStart() - : token.getStart(ast), - end = token.getEnd(), - value = ast.text.slice(start, end), - newToken: TSESTree.Token = { - type: getTokenType(token), - value, - range: [start, end], - loc: getLocFor(start, end, ast), - }; + token.kind === SyntaxKind.JsxText + ? token.getFullStart() + : token.getStart(ast); + const end = token.getEnd(); + const value = ast.text.slice(start, end); + const newToken: TSESTree.Token = { + type: getTokenType(token), + value, + range: [start, end], + loc: getLocFor(start, end, ast), + }; if (newToken.type === 'RegularExpression') { newToken.regex = { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 227932cd936..7af41c0f302 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -1883,6 +1883,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/keyof-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/keyword-variables.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/nested-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/never-type-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index c8f0cf9e364..0859b036250 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -58608,6 +58608,1442 @@ Object { } `; +exports[`typescript fixtures/basics/keyword-variables.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "get", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "set", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 29, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "module", + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 36, + 46, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 30, + 47, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "type", + "range": Array [ + 54, + 58, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 54, + 62, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 63, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "async", + "range": Array [ + 70, + 75, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 70, + 79, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 82, + 153, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 7, + "line": 13, + }, + }, + "range": Array [ + 139, + 152, + ], + "raw": "'fake-module'", + "type": "Literal", + "value": "fake-module", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "get", + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "get", + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + }, + "range": Array [ + 93, + 96, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "name": "set", + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "name": "set", + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + }, + "range": Array [ + 100, + 103, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "name": "module", + "range": Array [ + 107, + 113, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "name": "module", + "range": Array [ + 107, + 113, + ], + "type": "Identifier", + }, + "range": Array [ + 107, + 113, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "name": "type", + "range": Array [ + 117, + 121, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "name": "type", + "range": Array [ + 117, + 121, + ], + "type": "Identifier", + }, + "range": Array [ + 117, + 121, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "name": "async", + "range": Array [ + 125, + 130, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "name": "async", + "range": Array [ + 125, + 130, + ], + "type": "Identifier", + }, + "range": Array [ + 125, + 130, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 154, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 53, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 54, + 58, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 107, + 113, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 117, + 121, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 125, + 130, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 7, + "line": 12, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 13, + }, + "start": Object { + "column": 2, + "line": 13, + }, + }, + "range": Array [ + 134, + 138, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 7, + "line": 13, + }, + }, + "range": Array [ + 139, + 152, + ], + "type": "String", + "value": "'fake-module'", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` Object { "body": Array [ From e0aeb184049084748e613b8d181d97ce19aaaa37 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 8 Jul 2019 07:31:27 -0700 Subject: [PATCH 2/4] feat(eslint-plugin): [explicit-function-return-type] add handling for usage as arguments (#680) --- .../rules/explicit-function-return-type.md | 3 + .../rules/explicit-function-return-type.ts | 18 ++- .../explicit-function-return-type.test.ts | 119 ++++++++++++++++++ 3 files changed, 139 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index a20aa83c7a5..9aacb0acafc 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -138,6 +138,9 @@ let objectPropAs = { let objectPropCast = { foo: () => 1, }; + +declare functionWithArg(arg: () => number); +functionWithArg(() => 1); ``` ### allowHigherOrderFunctions diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 876f42517d6..d5176a43af5 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -187,6 +187,21 @@ export default util.createRule({ ); } + /** + * Checks if a node belongs to: + * `foo(() => 1)` + */ + function isFunctionArgument( + parent: TSESTree.Node, + child: TSESTree.Node, + ): boolean { + return ( + parent.type === AST_NODE_TYPES.CallExpression && + // make sure this isn't an IIFE + parent.callee !== child + ); + } + /** * Checks if a function declaration/expression has a return type. */ @@ -232,7 +247,8 @@ export default util.createRule({ isTypeCast(node.parent) || isVariableDeclaratorWithTypeAnnotation(node.parent) || isClassPropertyWithTypeAnnotation(node.parent) || - isPropertyOfObjectWithType(node.parent) + isPropertyOfObjectWithType(node.parent) || + isFunctionArgument(node.parent, node) ) { return; } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 1b9209b7abf..eb67f620be1 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -245,6 +245,42 @@ function FunctionDeclaration() { `, options: [{ allowHigherOrderFunctions: true }], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/679 + { + filename: 'test.ts', + code: ` +declare function foo(arg: () => void): void +foo(() => 1) +foo(() => {}) +foo(() => null) +foo(() => true) +foo(() => '') + `, + options: [ + { + allowTypedFunctionExpressions: true, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Accumulator { + private count: number = 0; + + public accumulate(fn: () => number): void { + this.count += fn(); + } +} + +new Accumulator().accumulate(() => 1); + `, + options: [ + { + allowTypedFunctionExpressions: true, + }, + ], + }, ], invalid: [ { @@ -550,5 +586,88 @@ function FunctionDeclaration() { }, ], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/679 + { + filename: 'test.ts', + code: ` +declare function foo(arg: () => void): void +foo(() => 1) +foo(() => {}) +foo(() => null) +foo(() => true) +foo(() => '') + `, + options: [ + { + allowTypedFunctionExpressions: false, + }, + ], + errors: [ + { + messageId: 'missingReturnType', + line: 3, + }, + { + messageId: 'missingReturnType', + line: 4, + }, + { + messageId: 'missingReturnType', + line: 5, + }, + { + messageId: 'missingReturnType', + line: 6, + }, + { + messageId: 'missingReturnType', + line: 7, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Accumulator { + private count: number = 0; + + public accumulate(fn: () => number): void { + this.count += fn(); + } +} + +new Accumulator().accumulate(() => 1); + `, + options: [ + { + allowTypedFunctionExpressions: false, + }, + ], + errors: [ + { + messageId: 'missingReturnType', + line: 10, + column: 30, + }, + ], + }, + { + filename: 'test.ts', + code: ` +(() => true)() + `, + options: [ + { + allowTypedFunctionExpressions: false, + }, + ], + errors: [ + { + messageId: 'missingReturnType', + line: 2, + column: 2, + }, + ], + }, ], }); From b30e78d894806638417cd99c6d3fe4a74cbde7ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2019 08:03:56 -0700 Subject: [PATCH 3/4] chore(deps): bump lodash.template from 4.4.0 to 4.5.0 (#693) Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0) Signed-off-by: dependabot[bot] --- yarn.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index 53025c9063a..c6bebb98da3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4712,7 +4712,7 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash._reinterpolate@~3.0.0: +lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= @@ -4758,19 +4758,19 @@ lodash.sortby@^4.7.0: integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= lodash.template@^4.0.2: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.4.0.tgz#e73a0385c8355591746e020b99679c690e68fba0" - integrity sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A= + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" + integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== dependencies: - lodash._reinterpolate "~3.0.0" + lodash._reinterpolate "^3.0.0" lodash.templatesettings "^4.0.0" lodash.templatesettings@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz#2b4d4e95ba440d915ff08bc899e4553666713316" - integrity sha1-K01OlbpEDZFf8IvImeRVNmZxMxY= + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33" + integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ== dependencies: - lodash._reinterpolate "~3.0.0" + lodash._reinterpolate "^3.0.0" lodash.unescape@4.0.1: version "4.0.1" From cd96c3875e90580c67023d2483c44da76a572eec Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 12 Jul 2019 12:52:29 +0000 Subject: [PATCH 4/4] chore: publish v1.12.0 --- CHANGELOG.md | 22 ++++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 11 +++++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 21 +++++++++++++++++++++ packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/CHANGELOG.md | 8 ++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 11 +++++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 11 +++++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 17 +++++++++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 116 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36abcf4782d..f2df49f1cc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) + + +### Bug Fixes + +* **eslint-plugin:** handle `const;` ([#633](https://github.com/typescript-eslint/typescript-eslint/issues/633)) ([430d628](https://github.com/typescript-eslint/typescript-eslint/commit/430d628)), closes [#441](https://github.com/typescript-eslint/typescript-eslint/issues/441) +* **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) + + +### Features + +* **eslint-plugin:** [ban-types] Support namespaced type ([#616](https://github.com/typescript-eslint/typescript-eslint/issues/616)) ([e325b72](https://github.com/typescript-eslint/typescript-eslint/commit/e325b72)) +* **eslint-plugin:** [explicit-function-return-type] add handling for usage as arguments ([#680](https://github.com/typescript-eslint/typescript-eslint/issues/680)) ([e0aeb18](https://github.com/typescript-eslint/typescript-eslint/commit/e0aeb18)) +* **eslint-plugin:** [no-explicit-any] Add an optional fixer ([#609](https://github.com/typescript-eslint/typescript-eslint/issues/609)) ([606fc70](https://github.com/typescript-eslint/typescript-eslint/commit/606fc70)) +* **eslint-plugin:** Add rule no-reference-import ([#625](https://github.com/typescript-eslint/typescript-eslint/issues/625)) ([af70a59](https://github.com/typescript-eslint/typescript-eslint/commit/af70a59)) +* **eslint-plugin:** add rule strict-boolean-expressions ([#579](https://github.com/typescript-eslint/typescript-eslint/issues/579)) ([34e7d1e](https://github.com/typescript-eslint/typescript-eslint/commit/34e7d1e)) +* **eslint-plugin:** added new rule prefer-readonly ([#555](https://github.com/typescript-eslint/typescript-eslint/issues/555)) ([76b89a5](https://github.com/typescript-eslint/typescript-eslint/commit/76b89a5)) + + + + + # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) diff --git a/lerna.json b/lerna.json index b1a0c8942fb..d494e08b3c9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.11.0", + "version": "1.12.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 26731119b1d..c0e725bdfcb 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) + + +### Features + +* **eslint-plugin:** added new rule prefer-readonly ([#555](https://github.com/typescript-eslint/typescript-eslint/issues/555)) ([76b89a5](https://github.com/typescript-eslint/typescript-eslint/commit/76b89a5)) + + + + + # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index d62e4996099..f370f0c5847 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "1.11.0", + "version": "1.12.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "1.11.0", + "@typescript-eslint/experimental-utils": "1.12.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ "devDependencies": { "@types/json-schema": "^7.0.3", "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "1.11.0" + "@typescript-eslint/parser": "1.12.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 497ba5cb783..e5a04d77763 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,27 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) + + +### Bug Fixes + +* **eslint-plugin:** handle `const;` ([#633](https://github.com/typescript-eslint/typescript-eslint/issues/633)) ([430d628](https://github.com/typescript-eslint/typescript-eslint/commit/430d628)), closes [#441](https://github.com/typescript-eslint/typescript-eslint/issues/441) + + +### Features + +* **eslint-plugin:** [ban-types] Support namespaced type ([#616](https://github.com/typescript-eslint/typescript-eslint/issues/616)) ([e325b72](https://github.com/typescript-eslint/typescript-eslint/commit/e325b72)) +* **eslint-plugin:** [explicit-function-return-type] add handling for usage as arguments ([#680](https://github.com/typescript-eslint/typescript-eslint/issues/680)) ([e0aeb18](https://github.com/typescript-eslint/typescript-eslint/commit/e0aeb18)) +* **eslint-plugin:** [no-explicit-any] Add an optional fixer ([#609](https://github.com/typescript-eslint/typescript-eslint/issues/609)) ([606fc70](https://github.com/typescript-eslint/typescript-eslint/commit/606fc70)) +* **eslint-plugin:** Add rule no-reference-import ([#625](https://github.com/typescript-eslint/typescript-eslint/issues/625)) ([af70a59](https://github.com/typescript-eslint/typescript-eslint/commit/af70a59)) +* **eslint-plugin:** add rule strict-boolean-expressions ([#579](https://github.com/typescript-eslint/typescript-eslint/issues/579)) ([34e7d1e](https://github.com/typescript-eslint/typescript-eslint/commit/34e7d1e)) +* **eslint-plugin:** added new rule prefer-readonly ([#555](https://github.com/typescript-eslint/typescript-eslint/issues/555)) ([76b89a5](https://github.com/typescript-eslint/typescript-eslint/commit/76b89a5)) + + + + + # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index d530f86a12b..28dcc098a7f 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "1.11.0", + "version": "1.12.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -41,7 +41,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "1.11.0", + "@typescript-eslint/experimental-utils": "1.12.0", "eslint-utils": "^1.3.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 0726874992f..40646cc4204 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index fa86431a8e0..d0a85ed8a90 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "1.11.0", + "version": "1.12.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -36,7 +36,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "1.11.0", + "@typescript-eslint/typescript-estree": "1.12.0", "eslint-scope": "^4.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 3ed7f17edcf..78926d846a9 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) + + +### Bug Fixes + +* **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) + + + + + # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) diff --git a/packages/parser/package.json b/packages/parser/package.json index e683453843b..cc6b85720b0 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.11.0", + "version": "1.12.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "files": [ @@ -42,11 +42,11 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "1.11.0", - "@typescript-eslint/typescript-estree": "1.11.0", + "@typescript-eslint/experimental-utils": "1.12.0", + "@typescript-eslint/typescript-estree": "1.12.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { - "@typescript-eslint/shared-fixtures": "1.11.0" + "@typescript-eslint/shared-fixtures": "1.12.0" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 9cdeac70951..06c3ba92d00 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) + + +### Bug Fixes + +* **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) + + + + + # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 28caabd65f4..080975e7bb2 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "1.11.0", + "version": "1.12.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 4f3c7cd4956..183ff3c672d 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) + + +### Bug Fixes + +* **eslint-plugin:** handle `const;` ([#633](https://github.com/typescript-eslint/typescript-eslint/issues/633)) ([430d628](https://github.com/typescript-eslint/typescript-eslint/commit/430d628)), closes [#441](https://github.com/typescript-eslint/typescript-eslint/issues/441) +* **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) + + +### Features + +* **eslint-plugin:** added new rule prefer-readonly ([#555](https://github.com/typescript-eslint/typescript-eslint/issues/555)) ([76b89a5](https://github.com/typescript-eslint/typescript-eslint/commit/76b89a5)) + + + + + # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 61ccbddf858..33079d27f03 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "1.11.0", + "version": "1.12.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -46,6 +46,6 @@ }, "devDependencies": { "@babel/types": "^7.3.2", - "@typescript-eslint/shared-fixtures": "1.11.0" + "@typescript-eslint/shared-fixtures": "1.12.0" } }