Skip to content

Commit

Permalink
Merge branch 'main' into deprecate-no-duplicate-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed May 16, 2022
2 parents a34f1d7 + 13c05ae commit 7824785
Show file tree
Hide file tree
Showing 37 changed files with 291 additions and 51 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16)


### Bug Fixes

* **eslint-plugin:** [array-type] in fixer add missing parens for constructor types [#4756](https://github.com/typescript-eslint/typescript-eslint/issues/4756) ([#4971](https://github.com/typescript-eslint/typescript-eslint/issues/4971)) ([0377070](https://github.com/typescript-eslint/typescript-eslint/commit/03770708900da663eb64c19465b3f937bab55b3d))
* **website:** missing colon before tip notes in configs.md ([#4982](https://github.com/typescript-eslint/typescript-eslint/issues/4982)) ([f3a1aba](https://github.com/typescript-eslint/typescript-eslint/commit/f3a1aba6704c5978c9f6002d6b1fc076421103d1))


### Features

* **eslint-plugin:** Add BigInt object type to default ban-types list ([#4970](https://github.com/typescript-eslint/typescript-eslint/issues/4970)) ([1867728](https://github.com/typescript-eslint/typescript-eslint/commit/1867728ba104a6a21941ed300828110964a43b96))
* **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8))





# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,5 +1,5 @@
{
"version": "5.23.0",
"version": "5.24.0",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true
Expand Down
8 changes: 8 additions & 0 deletions packages/ast-spec/CHANGELOG.md
Expand Up @@ -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.

# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16)

**Note:** Version bump only for package @typescript-eslint/ast-spec





# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09)


Expand Down
2 changes: 1 addition & 1 deletion packages/ast-spec/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/ast-spec",
"version": "5.23.0",
"version": "5.24.0",
"description": "TypeScript-ESTree AST spec",
"private": true,
"keywords": [
Expand Down
8 changes: 8 additions & 0 deletions packages/eslint-plugin-internal/CHANGELOG.md
Expand Up @@ -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.

# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal





# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-internal/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin-internal",
"version": "5.23.0",
"version": "5.24.0",
"private": true,
"main": "dist/index.js",
"scripts": {
Expand All @@ -14,8 +14,8 @@
},
"dependencies": {
"@types/prettier": "*",
"@typescript-eslint/scope-manager": "5.23.0",
"@typescript-eslint/utils": "5.23.0",
"@typescript-eslint/scope-manager": "5.24.0",
"@typescript-eslint/utils": "5.24.0",
"prettier": "*"
}
}
8 changes: 8 additions & 0 deletions packages/eslint-plugin-tslint/CHANGELOG.md
Expand Up @@ -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.

# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint





# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-tslint/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin-tslint",
"version": "5.23.0",
"version": "5.24.0",
"main": "dist/index.js",
"typings": "src/index.ts",
"description": "TSLint wrapper plugin for ESLint",
Expand Down Expand Up @@ -38,7 +38,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@typescript-eslint/utils": "5.23.0",
"@typescript-eslint/utils": "5.24.0",
"lodash": "^4.17.21"
},
"peerDependencies": {
Expand All @@ -48,6 +48,6 @@
},
"devDependencies": {
"@types/lodash": "*",
"@typescript-eslint/parser": "5.23.0"
"@typescript-eslint/parser": "5.24.0"
}
}
17 changes: 17 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Expand Up @@ -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.

# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16)


### Bug Fixes

* **eslint-plugin:** [array-type] in fixer add missing parens for constructor types [#4756](https://github.com/typescript-eslint/typescript-eslint/issues/4756) ([#4971](https://github.com/typescript-eslint/typescript-eslint/issues/4971)) ([0377070](https://github.com/typescript-eslint/typescript-eslint/commit/03770708900da663eb64c19465b3f937bab55b3d))


### Features

* **eslint-plugin:** Add BigInt object type to default ban-types list ([#4970](https://github.com/typescript-eslint/typescript-eslint/issues/4970)) ([1867728](https://github.com/typescript-eslint/typescript-eslint/commit/1867728ba104a6a21941ed300828110964a43b96))
* **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8))





# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09)


Expand Down
19 changes: 18 additions & 1 deletion packages/eslint-plugin/docs/rules/no-empty-function.md
Expand Up @@ -28,7 +28,8 @@ This rule adds the following options:
type AdditionalAllowOptionEntries =
| 'private-constructors'
| 'protected-constructors'
| 'decoratedFunctions';
| 'decoratedFunctions'
| 'overrideMethods';

type AllowOptionEntries =
| BaseNoEmptyFunctionAllowOptionEntries
Expand Down Expand Up @@ -77,6 +78,22 @@ class Foo {
}
```

### allow: `overrideMethods`

Examples of correct code for the `{ "allow": ["overrideMethods"] }` option:

```ts
abstract class Base {
protected greet(): void {
console.log('Hello!');
}
}

class Foo extends Base {
protected override greet(): void {}
}
```

## How to Use

```jsonc
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "5.23.0",
"version": "5.24.0",
"description": "TypeScript plugin for ESLint",
"keywords": [
"eslint",
Expand Down Expand Up @@ -44,9 +44,9 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@typescript-eslint/scope-manager": "5.23.0",
"@typescript-eslint/type-utils": "5.23.0",
"@typescript-eslint/utils": "5.23.0",
"@typescript-eslint/scope-manager": "5.24.0",
"@typescript-eslint/type-utils": "5.24.0",
"@typescript-eslint/utils": "5.24.0",
"debug": "^4.3.4",
"functional-red-black-tree": "^1.0.1",
"ignore": "^5.2.0",
Expand Down
16 changes: 15 additions & 1 deletion packages/eslint-plugin/src/rules/no-empty-function.ts
Expand Up @@ -30,6 +30,7 @@ const schema = util.deepMerge(
'asyncFunctions',
'asyncMethods',
'decoratedFunctions',
'overrideMethods',
],
},
},
Expand Down Expand Up @@ -63,6 +64,7 @@ export default util.createRule<Options, MessageIds>({
);
const isAllowedPrivateConstructors = allow.includes('private-constructors');
const isAllowedDecoratedFunctions = allow.includes('decoratedFunctions');
const isAllowedOverrideMethods = allow.includes('overrideMethods');

/**
* Check if the method body is empty
Expand Down Expand Up @@ -138,12 +140,24 @@ export default util.createRule<Options, MessageIds>({
return false;
}

function isAllowedEmptyOverrideMethod(
node: TSESTree.FunctionExpression,
): boolean {
return (
isAllowedOverrideMethods &&
isBodyEmpty(node) &&
node.parent?.type === AST_NODE_TYPES.MethodDefinition &&
node.parent.override === true
);
}

return {
...rules,
FunctionExpression(node): void {
if (
isAllowedEmptyConstructor(node) ||
isAllowedEmptyDecoratedFunctions(node)
isAllowedEmptyDecoratedFunctions(node) ||
isAllowedEmptyOverrideMethod(node)
) {
return;
}
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin/src/rules/typedef.ts
Expand Up @@ -178,7 +178,11 @@ export default util.createRule<[Options], MessageIds>({
return;
}

if (!node.typeAnnotation && !isForOfStatementContext(node)) {
if (
!node.typeAnnotation &&
!isForOfStatementContext(node) &&
node.parent?.type !== AST_NODE_TYPES.AssignmentExpression
) {
report(node);
}
},
Expand Down
25 changes: 25 additions & 0 deletions packages/eslint-plugin/tests/rules/no-empty-function.test.ts
Expand Up @@ -72,6 +72,14 @@ class Foo {
`,
options: [{ allow: ['decoratedFunctions'] }],
},
{
code: `
class Foo extends Base {
override foo() {}
}
`,
options: [{ allow: ['overrideMethods'] }],
},
],

invalid: [
Expand Down Expand Up @@ -192,5 +200,22 @@ class Foo {
},
],
},
{
code: `
class Foo extends Base {
override foo() {}
}
`,
errors: [
{
messageId: 'unexpected',
data: {
name: "method 'foo'",
},
line: 3,
column: 18,
},
],
},
],
});
26 changes: 25 additions & 1 deletion packages/eslint-plugin/tests/rules/typedef.test.ts
Expand Up @@ -47,7 +47,31 @@ ruleTester.run('typedef', rule, {
],
},
{
code: 'const [a] = 1;',
code: '[a] = [1];',
options: [
{
arrayDestructuring: true,
},
],
},
{
code: 'b = [a] = [1];',
options: [
{
arrayDestructuring: true,
},
],
},
{
code: 'const [b]: [number] = ([a] = [1]);',
options: [
{
arrayDestructuring: true,
},
],
},
{
code: 'const [a] = [1];',
options: [
{
arrayDestructuring: false,
Expand Down
8 changes: 8 additions & 0 deletions packages/experimental-utils/CHANGELOG.md
Expand Up @@ -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.

# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16)

**Note:** Version bump only for package @typescript-eslint/experimental-utils





# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09)

**Note:** Version bump only for package @typescript-eslint/experimental-utils
Expand Down
4 changes: 2 additions & 2 deletions packages/experimental-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/experimental-utils",
"version": "5.23.0",
"version": "5.24.0",
"description": "(Experimental) Utilities for working with TypeScript + ESLint together",
"keywords": [
"eslint",
Expand Down Expand Up @@ -38,7 +38,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@typescript-eslint/utils": "5.23.0"
"@typescript-eslint/utils": "5.24.0"
},
"peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
Expand Down
8 changes: 8 additions & 0 deletions packages/parser/CHANGELOG.md
Expand Up @@ -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.

# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16)

**Note:** Version bump only for package @typescript-eslint/parser





# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09)

**Note:** Version bump only for package @typescript-eslint/parser
Expand Down

0 comments on commit 7824785

Please sign in to comment.