Skip to content

Commit

Permalink
Merge branch 'master' into json-schema-dependency
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/experimental-utils/package.json
  • Loading branch information
bradzacher committed Jul 12, 2019
2 parents b5ebbe4 + cd96c38 commit 556ac7d
Show file tree
Hide file tree
Showing 23 changed files with 2,335 additions and 36 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,5 +1,5 @@
{
"version": "1.11.0",
"version": "1.12.0",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true
Expand Down
11 changes: 11 additions & 0 deletions packages/eslint-plugin-tslint/CHANGELOG.md
Expand Up @@ -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
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": "1.11.0",
"version": "1.12.0",
"main": "dist/index.js",
"typings": "src/index.ts",
"description": "TSLint wrapper plugin for ESLint",
Expand Down Expand Up @@ -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": {
Expand All @@ -40,6 +40,6 @@
},
"devDependencies": {
"@types/lodash.memoize": "^4.1.4",
"@typescript-eslint/parser": "1.11.0"
"@typescript-eslint/parser": "1.12.0"
}
}
21 changes: 21 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Expand Up @@ -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)


Expand Down
Expand Up @@ -138,6 +138,9 @@ let objectPropAs = {
let objectPropCast = <ObjectType>{
foo: () => 1,
};

declare functionWithArg(arg: () => number);
functionWithArg(() => 1);
```

### allowHigherOrderFunctions
Expand Down
4 changes: 2 additions & 2 deletions 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",
Expand Down Expand Up @@ -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",
Expand Down
Expand Up @@ -187,6 +187,21 @@ export default util.createRule<Options, MessageIds>({
);
}

/**
* 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.
*/
Expand Down Expand Up @@ -232,7 +247,8 @@ export default util.createRule<Options, MessageIds>({
isTypeCast(node.parent) ||
isVariableDeclaratorWithTypeAnnotation(node.parent) ||
isClassPropertyWithTypeAnnotation(node.parent) ||
isPropertyOfObjectWithType(node.parent)
isPropertyOfObjectWithType(node.parent) ||
isFunctionArgument(node.parent, node)
) {
return;
}
Expand Down
Expand Up @@ -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: [
{
Expand Down Expand Up @@ -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,
},
],
},
],
});
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.

# [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)


Expand Down
4 changes: 2 additions & 2 deletions 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",
Expand Down Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "1.11.0",
"@typescript-eslint/typescript-estree": "1.12.0",
"eslint-scope": "^4.0.0"
},
"peerDependencies": {
Expand Down
11 changes: 11 additions & 0 deletions packages/parser/CHANGELOG.md
Expand Up @@ -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)


Expand Down
8 changes: 4 additions & 4 deletions 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": [
Expand Down Expand Up @@ -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"
}
}

0 comments on commit 556ac7d

Please sign in to comment.