diff --git a/CHANGELOG.md b/CHANGELOG.md index e9be83a9a88e..687e75f17936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + + +### Bug Fixes + +* **eslint-plugin:** [method-signature-style] correct fixer for overloads in an object literal type ([#2708](https://github.com/typescript-eslint/typescript-eslint/issues/2708)) ([0763913](https://github.com/typescript-eslint/typescript-eslint/commit/0763913c4a0d1061465ae3329704f1a7de4b9326)) +* **eslint-plugin:** [method-signature-style] don't auto-fix interfaces within namespaces ([#2678](https://github.com/typescript-eslint/typescript-eslint/issues/2678)) ([e012049](https://github.com/typescript-eslint/typescript-eslint/commit/e01204931e460f5e6731abc443c88d666ca0b07a)) +* **eslint-plugin:** [prefer-string-starts-ends-with] Check negative indices in the second position for slice ([#2696](https://github.com/typescript-eslint/typescript-eslint/issues/2696)) ([66e9c6e](https://github.com/typescript-eslint/typescript-eslint/commit/66e9c6e29f9f56bbd178ba6405f47053be591258)) + + +### Features + +* **eslint-plugin:** [ban-types] support banning `[]` ([#2704](https://github.com/typescript-eslint/typescript-eslint/issues/2704)) ([ef8b5a7](https://github.com/typescript-eslint/typescript-eslint/commit/ef8b5a7e09cca4bdacf205da28f99f2b1a419d00)), closes [#2582](https://github.com/typescript-eslint/typescript-eslint/issues/2582) +* **eslint-plugin:** add `no-unnecessary-type-constraint` rule ([#2516](https://github.com/typescript-eslint/typescript-eslint/issues/2516)) ([880ac75](https://github.com/typescript-eslint/typescript-eslint/commit/880ac753b90d63034f0a33f8f512d9fabc17c8f9)) +* **eslint-plugin:** add extension rule `space-infix-ops` ([#2593](https://github.com/typescript-eslint/typescript-eslint/issues/2593)) ([343d20d](https://github.com/typescript-eslint/typescript-eslint/commit/343d20db23a1640e3bca8cf52b7db1fa46e092e6)) + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/lerna.json b/lerna.json index 93c8b83d70dd..9921c4f3b6ee 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "4.5.0", + "version": "4.6.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 2b7b392f01c5..ad7e9d0ee325 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index d86102a39c5c..dd8e9e03540b 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "4.5.0", + "version": "4.6.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,7 +14,7 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/experimental-utils": "4.5.0", + "@typescript-eslint/experimental-utils": "4.6.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 3f871e1be93f..a476c2e4c623 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index c540f1a33e45..a5b7bffe1a67 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": "4.5.0", + "version": "4.6.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.5.0", + "@typescript-eslint/experimental-utils": "4.6.0", "lodash": "^4.17.15" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "4.5.0" + "@typescript-eslint/parser": "4.6.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 2ec8d86fd895..dc57efa0e0c3 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + + +### Bug Fixes + +* **eslint-plugin:** [method-signature-style] correct fixer for overloads in an object literal type ([#2708](https://github.com/typescript-eslint/typescript-eslint/issues/2708)) ([0763913](https://github.com/typescript-eslint/typescript-eslint/commit/0763913c4a0d1061465ae3329704f1a7de4b9326)) +* **eslint-plugin:** [method-signature-style] don't auto-fix interfaces within namespaces ([#2678](https://github.com/typescript-eslint/typescript-eslint/issues/2678)) ([e012049](https://github.com/typescript-eslint/typescript-eslint/commit/e01204931e460f5e6731abc443c88d666ca0b07a)) +* **eslint-plugin:** [prefer-string-starts-ends-with] Check negative indices in the second position for slice ([#2696](https://github.com/typescript-eslint/typescript-eslint/issues/2696)) ([66e9c6e](https://github.com/typescript-eslint/typescript-eslint/commit/66e9c6e29f9f56bbd178ba6405f47053be591258)) + + +### Features + +* **eslint-plugin:** [ban-types] support banning `[]` ([#2704](https://github.com/typescript-eslint/typescript-eslint/issues/2704)) ([ef8b5a7](https://github.com/typescript-eslint/typescript-eslint/commit/ef8b5a7e09cca4bdacf205da28f99f2b1a419d00)), closes [#2582](https://github.com/typescript-eslint/typescript-eslint/issues/2582) +* **eslint-plugin:** add `no-unnecessary-type-constraint` rule ([#2516](https://github.com/typescript-eslint/typescript-eslint/issues/2516)) ([880ac75](https://github.com/typescript-eslint/typescript-eslint/commit/880ac753b90d63034f0a33f8f512d9fabc17c8f9)) +* **eslint-plugin:** add extension rule `space-infix-ops` ([#2593](https://github.com/typescript-eslint/typescript-eslint/issues/2593)) ([343d20d](https://github.com/typescript-eslint/typescript-eslint/commit/343d20db23a1640e3bca8cf52b7db1fa46e092e6)) + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 2f6425bf9028..9213a8d52735 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -143,6 +143,7 @@ Pro Tip: For larger codebases you may want to consider splitting our linting int | [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Enforces that type arguments will not be used if not required | | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-constraint`](./docs/rules/no-unnecessary-type-constraint.md) | Disallows unnecessary constraints on generic types | | :wrench: | | | [`@typescript-eslint/no-unsafe-assignment`](./docs/rules/no-unsafe-assignment.md) | Disallows assigning any to variables and properties | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/no-unsafe-call`](./docs/rules/no-unsafe-call.md) | Disallows calling an any type value | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/no-unsafe-member-access`](./docs/rules/no-unsafe-member-access.md) | Disallows member access on any typed variables | :heavy_check_mark: | | :thought_balloon: | @@ -219,6 +220,7 @@ In these cases, we create what we call an extension rule; a rule within our plug | [`@typescript-eslint/return-await`](./docs/rules/return-await.md) | Enforces consistent returning of awaited values | | :wrench: | :thought_balloon: | | [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | | | [`@typescript-eslint/space-before-function-paren`](./docs/rules/space-before-function-paren.md) | Enforces consistent spacing before function parenthesis | | :wrench: | | +| [`@typescript-eslint/space-infix-ops`](./docs/rules/space-infix-ops.md) | This rule is aimed at ensuring there are spaces around infix operators. | | :wrench: | | diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index ab8320d10dc7..761cac128f37 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -28,7 +28,7 @@ type Options = { The rule accepts a single object as options, with the following keys: - `types` - An object whose keys are the types you want to ban, and the values are error messages. - - The type can either be a type name literal (`Foo`), a type name with generic parameter instantiation(s) (`Foo`), or the empty object literal (`{}`). + - The type can either be a type name literal (`Foo`), a type name with generic parameter instantiation(s) (`Foo`), the empty object literal (`{}`), or the empty tuple type (`[]`). - The values can be a string, which is the error message to be reported, `false` to specifically disable this type or it can be an object with the following properties: - `message: string` - the message to display when the type is matched. diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md new file mode 100644 index 000000000000..8656ace566e3 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md @@ -0,0 +1,55 @@ +# Disallows unnecessary constraints on generic types (`no-unnecessary-type-constraint`) + +## Rule Details + +Type parameters (``) may be "constrained" with an `extends` keyword ([docs](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints)). +When not provided, type parameters happen to default to: + +- As of TypeScript 3.9: `unknown` ([docs](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#type-parameters-that-extend-any-no-longer-act-as-any)) +- Before that, as of 3.5: `any` ([docs](https://devblogs.microsoft.com/typescript/announcing-typescript-3-5/#breaking-changes)) + +It is therefore redundant to `extend` from these types in later versions of TypeScript. + +Examples of **incorrect** code for this rule: + +```ts +interface FooAny {} +interface FooUnknown {} + +type BarAny = {}; +type BarUnknown = {}; + +class BazAny { + quxUnknown() {} +} + +class BazUnknown { + quxUnknown() {} +} + +const QuuxAny = () => {}; +const QuuxUnknown = () => {}; + +function QuuzAny() {} +function QuuzUnknown() {} +``` + +Examples of **correct** code for this rule: + +```ts +interface Foo {} + +type Bar = {}; + +class Baz { + qux { } +} + +const Quux = () => {}; + +function Quuz() {} +``` + +## When Not To Use It + +If you don't care about the specific styles of your type constraints, or never use them in the first place, then you will not need this rule. diff --git a/packages/eslint-plugin/docs/rules/space-infix-ops.md b/packages/eslint-plugin/docs/rules/space-infix-ops.md new file mode 100644 index 000000000000..da36f25726e2 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/space-infix-ops.md @@ -0,0 +1,26 @@ +# This rule is aimed at ensuring there are spaces around infix operators. (`space-infix-ops`) + +This rule extends the base [`eslint/space-infix-ops`](https://eslint.org/docs/rules/space-infix-ops) rule. + +It also add support for enum members + +```ts +enum MyEnum { + KEY = 'value', +} +``` + +## How to use + +```jsonc +{ + "space-infix-ops": "off", + "@typescript-eslint/space-infix-ops": ["error", { "int32Hint": false }] +} +``` + +## Options + +See [`eslint/space-infix-ops` options](https://eslint.org/docs/rules/space-infix-ops#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/space-infix-ops.md) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 9ba807523d28..6fb0b8def464 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "4.5.0", + "version": "4.6.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -42,8 +42,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.5.0", - "@typescript-eslint/scope-manager": "4.5.0", + "@typescript-eslint/experimental-utils": "4.6.0", + "@typescript-eslint/scope-manager": "4.6.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index ec2984064982..d847322d9860 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -92,6 +92,7 @@ export = { '@typescript-eslint/no-type-alias': 'error', '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', '@typescript-eslint/no-unnecessary-condition': 'error', + '@typescript-eslint/no-unnecessary-type-constraint': 'error', '@typescript-eslint/no-unnecessary-qualifier': 'error', '@typescript-eslint/no-unnecessary-type-arguments': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', @@ -137,6 +138,8 @@ export = { '@typescript-eslint/semi': 'error', 'space-before-function-paren': 'off', '@typescript-eslint/space-before-function-paren': 'error', + 'space-infix-ops': 'off', + '@typescript-eslint/space-infix-ops': 'error', '@typescript-eslint/strict-boolean-expressions': 'error', '@typescript-eslint/switch-exhaustiveness-check': 'error', '@typescript-eslint/triple-slash-reference': 'error', diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index beaadb14ec29..0187134e9917 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -223,6 +223,11 @@ export default util.createRule({ checkBannedTypes(node); }, + TSTupleType(node): void { + if (node.elementTypes.length === 0) { + checkBannedTypes(node); + } + }, TSTypeReference(node): void { checkBannedTypes(node.typeName); diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 587b79d30178..a4540aa5788d 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -15,6 +15,7 @@ import consistentTypeDefinitions from './consistent-type-definitions'; import consistentTypeImports from './consistent-type-imports'; import defaultParamLast from './default-param-last'; import dotNotation from './dot-notation'; +import enumMembersSpacing from './space-infix-ops'; import explicitFunctionReturnType from './explicit-function-return-type'; import explicitMemberAccessibility from './explicit-member-accessibility'; import explicitModuleBoundaryTypes from './explicit-module-boundary-types'; @@ -66,6 +67,7 @@ import noUnnecessaryCondition from './no-unnecessary-condition'; import noUnnecessaryQualifier from './no-unnecessary-qualifier'; import noUnnecessaryTypeArguments from './no-unnecessary-type-arguments'; import noUnnecessaryTypeAssertion from './no-unnecessary-type-assertion'; +import noUnnecessaryTypeConstraint from './no-unnecessary-type-constraint'; import noUnsafeAssignment from './no-unsafe-assignment'; import noUnsafeCall from './no-unsafe-call'; import noUnsafeMemberAccess from './no-unsafe-member-access'; @@ -125,6 +127,7 @@ export default { 'consistent-type-imports': consistentTypeImports, 'default-param-last': defaultParamLast, 'dot-notation': dotNotation, + 'space-infix-ops': enumMembersSpacing, 'explicit-function-return-type': explicitFunctionReturnType, 'explicit-member-accessibility': explicitMemberAccessibility, 'explicit-module-boundary-types': explicitModuleBoundaryTypes, @@ -175,6 +178,7 @@ export default { 'no-unnecessary-qualifier': noUnnecessaryQualifier, 'no-unnecessary-type-arguments': noUnnecessaryTypeArguments, 'no-unnecessary-type-assertion': noUnnecessaryTypeAssertion, + 'no-unnecessary-type-constraint': noUnnecessaryTypeConstraint, 'no-unsafe-assignment': noUnsafeAssignment, 'no-unsafe-call': noUnsafeCall, 'no-unsafe-member-access': noUnsafeMemberAccess, diff --git a/packages/eslint-plugin/src/rules/method-signature-style.ts b/packages/eslint-plugin/src/rules/method-signature-style.ts index 45f7fdbd711a..de6f366b6735 100644 --- a/packages/eslint-plugin/src/rules/method-signature-style.ts +++ b/packages/eslint-plugin/src/rules/method-signature-style.ts @@ -97,76 +97,114 @@ export default util.createRule({ return ''; } + function isNodeParentModuleDeclaration(node: TSESTree.Node): boolean { + if (!node.parent) { + return false; + } + + if (node.parent.type === AST_NODE_TYPES.TSModuleDeclaration) { + return true; + } + + if (node.parent.type === AST_NODE_TYPES.Program) { + return false; + } + return isNodeParentModuleDeclaration(node.parent); + } + return { TSMethodSignature(methodNode): void { if (mode === 'method') { return; } - const duplicatedKeyMethodNodes: TSESTree.TSMethodSignature[] = - methodNode.parent?.type === AST_NODE_TYPES.TSInterfaceBody - ? methodNode.parent.body.filter( - (element): element is TSESTree.TSMethodSignature => - element.type === AST_NODE_TYPES.TSMethodSignature && - element !== methodNode && - getMethodKey(element) === getMethodKey(methodNode), - ) + const parent = methodNode.parent; + const members = + parent?.type === AST_NODE_TYPES.TSInterfaceBody + ? parent.body + : parent?.type === AST_NODE_TYPES.TSTypeLiteral + ? parent.members : []; + const duplicatedKeyMethodNodes: TSESTree.TSMethodSignature[] = members.filter( + (element): element is TSESTree.TSMethodSignature => + element.type === AST_NODE_TYPES.TSMethodSignature && + element !== methodNode && + getMethodKey(element) === getMethodKey(methodNode), + ); + const isParentModule = isNodeParentModuleDeclaration(methodNode); + if (duplicatedKeyMethodNodes.length > 0) { + if (isParentModule) { + context.report({ + node: methodNode, + messageId: 'errorMethod', + }); + } else { + context.report({ + node: methodNode, + messageId: 'errorMethod', + *fix(fixer) { + const methodNodes = [ + methodNode, + ...duplicatedKeyMethodNodes, + ].sort((a, b) => (a.range[0] < b.range[0] ? -1 : 1)); + const typeString = methodNodes.reduce( + (str, node, idx, nodes) => { + const params = getMethodParams(node); + const returnType = getMethodReturnType(node); + return `${str}(${params} => ${returnType})${ + idx !== nodes.length - 1 ? ' & ' : '' + }`; + }, + '', + ); + const key = getMethodKey(methodNode); + const delimiter = getDelimiter(methodNode); + yield fixer.replaceText( + methodNode, + `${key}: ${typeString}${delimiter}`, + ); + for (const node of duplicatedKeyMethodNodes) { + const lastToken = sourceCode.getLastToken(node); + if (lastToken) { + const nextToken = sourceCode.getTokenAfter(lastToken); + if (nextToken) { + yield fixer.remove(node); + yield fixer.replaceTextRange( + [lastToken.range[1], nextToken.range[0]], + '', + ); + } + } + } + }, + }); + } + return; + } + + if (isParentModule) { context.report({ node: methodNode, messageId: 'errorMethod', - *fix(fixer) { - const methodNodes = [ - methodNode, - ...duplicatedKeyMethodNodes, - ].sort((a, b) => (a.range[0] < b.range[0] ? -1 : 1)); - const typeString = methodNodes.reduce((str, node, idx, nodes) => { - const params = getMethodParams(node); - const returnType = getMethodReturnType(node); - return `${str}(${params} => ${returnType})${ - idx !== nodes.length - 1 ? ' & ' : '' - }`; - }, ''); + }); + } else { + context.report({ + node: methodNode, + messageId: 'errorMethod', + fix: fixer => { const key = getMethodKey(methodNode); + const params = getMethodParams(methodNode); + const returnType = getMethodReturnType(methodNode); const delimiter = getDelimiter(methodNode); - yield fixer.replaceText( + return fixer.replaceText( methodNode, - `${key}: ${typeString}${delimiter}`, + `${key}: ${params} => ${returnType}${delimiter}`, ); - for (const node of duplicatedKeyMethodNodes) { - const lastToken = sourceCode.getLastToken(node); - if (lastToken) { - const nextToken = sourceCode.getTokenAfter(lastToken); - if (nextToken) { - yield fixer.remove(node); - yield fixer.replaceTextRange( - [lastToken.range[1], nextToken.range[0]], - '', - ); - } - } - } }, }); - return; } - - context.report({ - node: methodNode, - messageId: 'errorMethod', - fix: fixer => { - const key = getMethodKey(methodNode); - const params = getMethodParams(methodNode); - const returnType = getMethodReturnType(methodNode); - const delimiter = getDelimiter(methodNode); - return fixer.replaceText( - methodNode, - `${key}: ${params} => ${returnType}${delimiter}`, - ); - }, - }); }, TSPropertySignature(propertyNode): void { const typeNode = propertyNode.typeAnnotation?.typeAnnotation; diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts new file mode 100644 index 000000000000..6d5036c2d75a --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts @@ -0,0 +1,103 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import * as semver from 'semver'; +import * as ts from 'typescript'; +import * as util from '../util'; + +type MakeRequired = Omit & + Required>; + +type TypeParameterWithConstraint = MakeRequired< + TSESTree.TSTypeParameter, + 'constraint' +>; + +const is3dot5 = semver.satisfies( + ts.version, + `>= 3.5.0 || >= 3.5.1-rc || >= 3.5.0-beta`, + { + includePrerelease: true, + }, +); + +const is3dot9 = + is3dot5 && + semver.satisfies(ts.version, `>= 3.9.0 || >= 3.9.1-rc || >= 3.9.0-beta`, { + includePrerelease: true, + }); + +export default util.createRule({ + name: 'no-unnecessary-type-constraint', + meta: { + docs: { + category: 'Best Practices', + description: 'Disallows unnecessary constraints on generic types', + recommended: false, + suggestion: true, + }, + fixable: 'code', + messages: { + unnecessaryConstraint: + 'Constraining the generic type `{{name}}` to `{{constraint}}` does nothing and is unnecessary.', + }, + schema: [], + type: 'suggestion', + }, + defaultOptions: [], + create(context) { + if (!is3dot5) { + return {}; + } + + // In theory, we could use the type checker for more advanced constraint types... + // ...but in practice, these types are rare, and likely not worth requiring type info. + // https://github.com/typescript-eslint/typescript-eslint/pull/2516#discussion_r495731858 + const unnecessaryConstraints = is3dot9 + ? new Map([ + [AST_NODE_TYPES.TSAnyKeyword, 'any'], + [AST_NODE_TYPES.TSUnknownKeyword, 'unknown'], + ]) + : new Map([[AST_NODE_TYPES.TSUnknownKeyword, 'unknown']]); + + const inJsx = context.getFilename().toLowerCase().endsWith('tsx'); + + const checkNode = ( + node: TypeParameterWithConstraint, + inArrowFunction: boolean, + ): void => { + const constraint = unnecessaryConstraints.get(node.constraint.type); + + if (constraint) { + context.report({ + data: { + constraint, + name: node.name.name, + }, + fix(fixer) { + return fixer.replaceTextRange( + [node.name.range[1], node.constraint.range[1]], + inArrowFunction && inJsx ? ',' : '', + ); + }, + messageId: 'unnecessaryConstraint', + node, + }); + } + }; + + return { + ':not(ArrowFunctionExpression) > TSTypeParameterDeclaration > TSTypeParameter[constraint]'( + node: TypeParameterWithConstraint, + ): void { + checkNode(node, false); + }, + 'ArrowFunctionExpression > TSTypeParameterDeclaration > TSTypeParameter[constraint]'( + node: TypeParameterWithConstraint, + ): void { + checkNode(node, true); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts index 3126f6160381..f4697b7c01de 100644 --- a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts +++ b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts @@ -575,7 +575,8 @@ export default createRule({ const isStartsWith = !isEndsWith && callNode.arguments.length === 2 && - isNumber(callNode.arguments[0], 0); + isNumber(callNode.arguments[0], 0) && + !isNegativeIndexExpression(callNode.arguments[1], node.object); if (!isStartsWith && !isEndsWith) { return; } diff --git a/packages/eslint-plugin/src/rules/space-infix-ops.ts b/packages/eslint-plugin/src/rules/space-infix-ops.ts new file mode 100644 index 000000000000..57c56ad0b476 --- /dev/null +++ b/packages/eslint-plugin/src/rules/space-infix-ops.ts @@ -0,0 +1,102 @@ +import { + AST_TOKEN_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import baseRule from 'eslint/lib/rules/space-infix-ops'; +import * as util from '../util'; + +export type Options = util.InferOptionsTypeFromRule; +export type MessageIds = util.InferMessageIdsTypeFromRule; + +export default util.createRule({ + name: 'space-infix-ops', + meta: { + type: 'layout', + docs: { + description: + 'This rule is aimed at ensuring there are spaces around infix operators.', + category: 'Stylistic Issues', + recommended: false, + extendsBaseRule: true, + }, + fixable: baseRule.meta.fixable, + schema: baseRule.meta.schema, + messages: baseRule.meta.messages ?? { + missingSpace: "Operator '{{operator}}' must be spaced.", + }, + }, + defaultOptions: [ + { + int32Hint: false, + }, + ], + create(context) { + const rules = baseRule.create(context); + const sourceCode = context.getSourceCode(); + + /** + * Check if it has an assignment char and report if it's faulty + * @param node The node to report + */ + function checkForAssignmentSpace(node: TSESTree.TSEnumMember): void { + if (!node.initializer) { + return; + } + + const leftNode = sourceCode.getTokenByRangeStart(node.id.range[0])!; + const rightNode = sourceCode.getTokenByRangeStart( + node.initializer.range[0], + )!; + + if (!rightNode) { + return; + } + + const operator = sourceCode.getFirstTokenBetween( + leftNode, + rightNode, + token => + token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=', + ); + const prev = sourceCode.getTokenBefore(operator!); + const next = sourceCode.getTokenAfter(operator!); + + if ( + operator && + (!sourceCode.isSpaceBetweenTokens(prev!, operator) || + !sourceCode.isSpaceBetweenTokens(operator, next!)) + ) { + context.report({ + node: node, + loc: operator.loc, + messageId: 'missingSpace', + data: { + operator: operator.value, + }, + fix(fixer) { + const previousToken = sourceCode.getTokenBefore(operator); + const afterToken = sourceCode.getTokenAfter(operator); + let fixString = ''; + + if (operator.range[0] - previousToken!.range[1] === 0) { + fixString = ' '; + } + + fixString += operator.value; + + if (afterToken!.range[0] - operator.range[1] === 0) { + fixString += ' '; + } + + return fixer.replaceText(operator, fixString); + }, + }); + } + } + + return { + ...rules, + TSEnumMember: checkForAssignmentSpace, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/ban-types.test.ts b/packages/eslint-plugin/tests/rules/ban-types.test.ts index ca7078585b13..27743ecc5a3a 100644 --- a/packages/eslint-plugin/tests/rules/ban-types.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-types.test.ts @@ -108,6 +108,7 @@ ruleTester.run('ban-types', rule, { }, ], }, + 'let a: [];', ], invalid: [ { @@ -529,6 +530,94 @@ let bar: object = {}; }, ], }, + { + code: 'let a: [];', + errors: [ + { + messageId: 'bannedTypeMessage', + data: { + name: '[]', + customMessage: ' `[]` does only allow empty arrays.', + }, + line: 1, + column: 8, + }, + ], + options: [ + { + types: { + '[]': '`[]` does only allow empty arrays.', + }, + }, + ], + }, + { + code: noFormat`let a: [ ] ;`, + errors: [ + { + messageId: 'bannedTypeMessage', + data: { + name: '[]', + customMessage: ' `[]` does only allow empty arrays.', + }, + line: 1, + column: 9, + }, + ], + options: [ + { + types: { + '[]': '`[]` does only allow empty arrays.', + }, + }, + ], + }, + { + code: 'let a: [];', + output: 'let a: any[];', + errors: [ + { + messageId: 'bannedTypeMessage', + data: { + name: '[]', + customMessage: ' `[]` does only allow empty arrays.', + }, + line: 1, + column: 8, + }, + ], + options: [ + { + types: { + '[]': { + message: '`[]` does only allow empty arrays.', + fixWith: 'any[]', + }, + }, + }, + ], + }, + { + code: 'let a: [[]];', + errors: [ + { + messageId: 'bannedTypeMessage', + data: { + name: '[]', + customMessage: ' `[]` does only allow empty arrays.', + }, + line: 1, + column: 9, + }, + ], + options: [ + { + types: { + '[]': '`[]` does only allow empty arrays.', + }, + }, + ], + }, ...objectReduceKey( TYPE_KEYWORDS, (acc: TSESLint.InvalidTestCase[], key) => { diff --git a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts index 3f125b33cdf8..e322c63c6a3d 100644 --- a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts +++ b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts @@ -348,5 +348,84 @@ interface Foo { }, ], }, + { + code: noFormat` + declare global { + namespace jest { + interface Matchers { + // Add overloads specific to the DOM + toHaveProp>(name: K, value?: DomPropsOf[K]): R; + toHaveProps(props: Partial>): R; + } + } + } + `, + errors: [ + { + messageId: 'errorMethod', + line: 6, + }, + { + messageId: 'errorMethod', + line: 7, + }, + ], + }, + { + code: noFormat` +type Foo = { + foo(): one; + foo(): two; + foo(): three; +} + `, + output: noFormat` +type Foo = { + foo: (() => one) & (() => two) & (() => three); +} + `, + errors: [ + { + messageId: 'errorMethod', + line: 3, + }, + { + messageId: 'errorMethod', + line: 4, + }, + { + messageId: 'errorMethod', + line: 5, + }, + ], + }, + { + code: noFormat` +declare const Foo: { + foo(): one; + foo(): two; + foo(): three; +} + `, + output: noFormat` +declare const Foo: { + foo: (() => one) & (() => two) & (() => three); +} + `, + errors: [ + { + messageId: 'errorMethod', + line: 3, + }, + { + messageId: 'errorMethod', + line: 4, + }, + { + messageId: 'errorMethod', + line: 5, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts new file mode 100644 index 000000000000..c71821ffeb4a --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts @@ -0,0 +1,230 @@ +import rule from '../../src/rules/no-unnecessary-type-constraint'; +import { RuleTester, noFormat } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parserOptions: { + ecmaVersion: 2018, + }, + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-unnecessary-type-constraint', rule, { + valid: [ + 'function data() {}', + 'function data() {}', + 'function data() {}', + 'function data() {}', + 'function data() {}', + 'function data() {}', + ` +type TODO = any; +function data() {} + `, + 'const data = () => {};', + 'const data = () => {};', + 'const data = () => {};', + 'const data = () => {};', + 'const data = () => {};', + ], + invalid: [ + { + code: 'function data() {}', + errors: [ + { + data: { constraint: 'any', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 28, + column: 15, + line: 1, + }, + ], + output: 'function data() {}', + }, + { + code: 'function data() {}', + errors: [ + { + data: { constraint: 'any', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 28, + column: 15, + line: 1, + }, + ], + output: 'function data() {}', + }, + { + code: 'function data() {}', + errors: [ + { + data: { constraint: 'any', name: 'U' }, + messageId: 'unnecessaryConstraint', + endColumn: 31, + column: 18, + line: 1, + }, + ], + output: 'function data() {}', + }, + { + code: 'function data() {}', + errors: [ + { + data: { constraint: 'any', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 28, + column: 15, + line: 1, + }, + ], + output: 'function data() {}', + }, + { + code: 'const data = () => {};', + errors: [ + { + data: { constraint: 'any', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 28, + column: 15, + line: 1, + }, + ], + filename: 'react.tsx', + output: noFormat`const data = () => {};`, + }, + { + code: 'function data() {}', + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 32, + column: 15, + line: 1, + }, + ], + output: 'function data() {}', + }, + { + code: 'const data = () => {};', + errors: [ + { + data: { constraint: 'any', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 28, + column: 15, + line: 1, + }, + ], + output: 'const data = () => {};', + }, + { + code: 'const data = () => {};', + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 32, + column: 15, + line: 1, + }, + ], + output: 'const data = () => {};', + }, + { + code: 'class Data {}', + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 29, + column: 12, + line: 1, + }, + ], + output: 'class Data {}', + }, + { + code: 'const Data = class {};', + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 37, + column: 20, + line: 1, + }, + ], + output: 'const Data = class {};', + }, + { + code: ` +class Data { + member() {} +} + `, + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 27, + column: 10, + line: 3, + }, + ], + output: ` +class Data { + member() {} +} + `, + }, + { + code: ` +const Data = class { + member() {} +}; + `, + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 27, + column: 10, + line: 3, + }, + ], + output: ` +const Data = class { + member() {} +}; + `, + }, + { + code: 'interface Data {}', + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 33, + column: 16, + line: 1, + }, + ], + output: 'interface Data {}', + }, + { + code: 'type Data = {};', + errors: [ + { + data: { constraint: 'unknown', name: 'T' }, + messageId: 'unnecessaryConstraint', + endColumn: 28, + column: 11, + line: 1, + }, + ], + output: 'type Data = {};', + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts index e97fa912df5b..0cef89740d56 100644 --- a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts @@ -230,6 +230,16 @@ ruleTester.run('prefer-string-starts-ends-with', rule, { x.test(s) } `, + ` + function f(s: string) { + s.slice(0, -4) === "car" + } + `, + ` + function f(x: string, s: string) { + x.endsWith('foo') && x.slice(0, -4) === 'bar' + } + `, ]), invalid: addOptional([ // String indexing. diff --git a/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts b/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts new file mode 100644 index 000000000000..0c90443ca4fc --- /dev/null +++ b/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts @@ -0,0 +1,102 @@ +/* eslint-disable eslint-comments/no-use */ +// this rule tests spacing, which prettier will want to fix and break the tests +/* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ +/* eslint-enable eslint-comments/no-use */ + +import rule from '../../src/rules/space-infix-ops'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('space-infix-ops', rule, { + valid: [ + { + code: ` + enum Test { + KEY1 = 2, + } + `, + }, + { + code: ` + enum Test { + KEY1 = "value", + } + `, + }, + { + code: ` + enum Test { + KEY1, + } + `, + }, + ], + invalid: [ + { + code: ` + enum Test { + A= 2, + B = 1, + } + `, + output: ` + enum Test { + A = 2, + B = 1, + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 12, + line: 3, + }, + ], + }, + { + code: ` + enum Test { + KEY1= "value1", + KEY2 = "value2", + } + `, + output: ` + enum Test { + KEY1 = "value1", + KEY2 = "value2", + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 15, + line: 3, + }, + ], + }, + { + code: ` + enum Test { + A =2, + B = 1, + } + `, + output: ` + enum Test { + A = 2, + B = 1, + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 13, + line: 3, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 8a6c89d529b3..4e10fe235786 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -789,3 +789,25 @@ declare module 'eslint/lib/rules/no-duplicate-imports' { >; export = rule; } + +declare module 'eslint/lib/rules/space-infix-ops' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + const rule: TSESLint.RuleModule< + 'missingSpace', + [ + { + int32Hint: boolean; + }, + ], + { + AssignmentExpression(node: TSESTree.AssignmentExpression): void; + AssignmentPattern(node: TSESTree.AssignmentPattern): void; + BinaryExpression(node: TSESTree.BinaryExpression): void; + LogicalExpression(node: TSESTree.LogicalExpression): void; + ConditionalExpression(node: TSESTree.ConditionalExpression): void; + VariableDeclarator(node: TSESTree.VariableDeclarator): void; + } + >; + export = rule; +} diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 8aeda70f836c..b67dbdb17c65 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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 2f9ab6ba48a4..968681b303a0 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "4.5.0", + "version": "4.6.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -40,9 +40,9 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.5.0", - "@typescript-eslint/types": "4.5.0", - "@typescript-eslint/typescript-estree": "4.5.0", + "@typescript-eslint/scope-manager": "4.6.0", + "@typescript-eslint/types": "4.6.0", + "@typescript-eslint/typescript-estree": "4.6.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 655f89e6068e..0f8445eea6a9 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/parser/package.json b/packages/parser/package.json index a94c0873a97f..6218ee7f49f2 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "4.5.0", + "version": "4.6.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -44,15 +44,15 @@ "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "4.5.0", - "@typescript-eslint/types": "4.5.0", - "@typescript-eslint/typescript-estree": "4.5.0", + "@typescript-eslint/scope-manager": "4.6.0", + "@typescript-eslint/types": "4.6.0", + "@typescript-eslint/typescript-estree": "4.6.0", "debug": "^4.1.1" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/experimental-utils": "4.5.0", - "@typescript-eslint/shared-fixtures": "4.5.0", + "@typescript-eslint/experimental-utils": "4.6.0", + "@typescript-eslint/shared-fixtures": "4.6.0", "glob": "*", "typescript": "*" }, diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 29e6cf4444e2..f0e7c123bacc 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 1d0938392e88..3fbce1bcd421 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "4.5.0", + "version": "4.6.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.5.0", - "@typescript-eslint/visitor-keys": "4.5.0" + "@typescript-eslint/types": "4.6.0", + "@typescript-eslint/visitor-keys": "4.6.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "4.5.0", + "@typescript-eslint/typescript-estree": "4.6.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 4917c9b90974..630d8cd4e4ee 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index e2e4143e3d9b..bd7c54a1137a 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "4.5.0", + "version": "4.6.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 3b229dace067..52ee3851a3e0 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/types/package.json b/packages/types/package.json index c5ee947b8357..3b08376cdca2 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "4.5.0", + "version": "4.6.0", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index f4120b6495ab..6030d477f907 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index d8a25b77dcf2..43c70952c67d 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "4.5.0", + "version": "4.6.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -41,8 +41,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.5.0", - "@typescript-eslint/visitor-keys": "4.5.0", + "@typescript-eslint/types": "4.6.0", + "@typescript-eslint/visitor-keys": "4.6.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -61,7 +61,7 @@ "@types/lodash": "*", "@types/semver": "^7.1.0", "@types/tmp": "^0.2.0", - "@typescript-eslint/shared-fixtures": "4.5.0", + "@typescript-eslint/shared-fixtures": "4.6.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 3942f642006b..7aea91b0efd3 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/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. +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 57fce9aa1ead..77457cdc7680 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "4.5.0", + "version": "4.6.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.5.0", + "@typescript-eslint/types": "4.6.0", "eslint-visitor-keys": "^2.0.0" }, "devDependencies": {