Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a76f36

Browse files
authored
Merge branch 'master' into tsx-test
2 parents b738dcc + 054df27 commit 7a76f36

File tree

27 files changed

+2026
-285
lines changed

27 files changed

+2026
-285
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07)
7+
8+
9+
### Bug Fixes
10+
11+
* **eslint-plugin:** [class-name-casing] allow unicode letters ([#1043](https://github.com/typescript-eslint/typescript-eslint/issues/1043)) ([47895c0](https://github.com/typescript-eslint/typescript-eslint/commit/47895c0))
12+
* **eslint-plugin:** [efrt] support constructor arguments ([#1021](https://github.com/typescript-eslint/typescript-eslint/issues/1021)) ([60943e6](https://github.com/typescript-eslint/typescript-eslint/commit/60943e6))
13+
* **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d))
14+
15+
16+
17+
18+
19+
## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30)
20+
21+
22+
### Bug Fixes
23+
24+
* **eslint-plugin:** [no-unnec-type-arg] undefined symbol crash ([#1007](https://github.com/typescript-eslint/typescript-eslint/issues/1007)) ([cdf9294](https://github.com/typescript-eslint/typescript-eslint/commit/cdf9294))
25+
* **typescript-estree:** correct ClassDeclarationBase type ([#1008](https://github.com/typescript-eslint/typescript-eslint/issues/1008)) ([8ce3a81](https://github.com/typescript-eslint/typescript-eslint/commit/8ce3a81))
26+
* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe))
27+
28+
29+
30+
31+
632
## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23)
733

834

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.3.1",
2+
"version": "2.3.3",
33
"npmClient": "yarn",
44
"useWorkspaces": true,
55
"stream": true

packages/eslint-plugin-tslint/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07)
7+
8+
**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
9+
10+
11+
12+
13+
14+
## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30)
15+
16+
**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
17+
18+
19+
20+
21+
622
## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23)
723

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

packages/eslint-plugin-tslint/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typescript-eslint/eslint-plugin-tslint",
3-
"version": "2.3.1",
3+
"version": "2.3.3",
44
"main": "dist/index.js",
55
"typings": "src/index.ts",
66
"description": "TSLint wrapper plugin for ESLint",
@@ -31,7 +31,7 @@
3131
"typecheck": "tsc --noEmit"
3232
},
3333
"dependencies": {
34-
"@typescript-eslint/experimental-utils": "2.3.1",
34+
"@typescript-eslint/experimental-utils": "2.3.3",
3535
"lodash.memoize": "^4.1.2"
3636
},
3737
"peerDependencies": {
@@ -41,6 +41,6 @@
4141
},
4242
"devDependencies": {
4343
"@types/lodash.memoize": "^4.1.4",
44-
"@typescript-eslint/parser": "2.3.1"
44+
"@typescript-eslint/parser": "2.3.3"
4545
}
4646
}

packages/eslint-plugin/CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07)
7+
8+
9+
### Bug Fixes
10+
11+
* **eslint-plugin:** [class-name-casing] allow unicode letters ([#1043](https://github.com/typescript-eslint/typescript-eslint/issues/1043)) ([47895c0](https://github.com/typescript-eslint/typescript-eslint/commit/47895c0))
12+
* **eslint-plugin:** [efrt] support constructor arguments ([#1021](https://github.com/typescript-eslint/typescript-eslint/issues/1021)) ([60943e6](https://github.com/typescript-eslint/typescript-eslint/commit/60943e6))
13+
14+
15+
16+
17+
18+
## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30)
19+
20+
21+
### Bug Fixes
22+
23+
* **eslint-plugin:** [no-unnec-type-arg] undefined symbol crash ([#1007](https://github.com/typescript-eslint/typescript-eslint/issues/1007)) ([cdf9294](https://github.com/typescript-eslint/typescript-eslint/commit/cdf9294))
24+
* **typescript-estree:** correct ClassDeclarationBase type ([#1008](https://github.com/typescript-eslint/typescript-eslint/issues/1008)) ([8ce3a81](https://github.com/typescript-eslint/typescript-eslint/commit/8ce3a81))
25+
26+
27+
28+
29+
630
## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23)
731

832

packages/eslint-plugin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typescript-eslint/eslint-plugin",
3-
"version": "2.3.1",
3+
"version": "2.3.3",
44
"description": "TypeScript plugin for ESLint",
55
"keywords": [
66
"eslint",
@@ -40,7 +40,7 @@
4040
"typecheck": "tsc --noEmit"
4141
},
4242
"dependencies": {
43-
"@typescript-eslint/experimental-utils": "2.3.1",
43+
"@typescript-eslint/experimental-utils": "2.3.3",
4444
"eslint-utils": "^1.4.2",
4545
"functional-red-black-tree": "^1.0.1",
4646
"regexpp": "^2.0.1",

packages/eslint-plugin/src/rules/class-name-casing.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,28 @@ export default util.createRule<Options, MessageIds>({
3838
},
3939
defaultOptions: [{ allowUnderscorePrefix: false }],
4040
create(context, [options]) {
41+
const UNDERSCORE = '_';
42+
43+
/**
44+
* Determine if the string is Upper cased
45+
* @param str
46+
*/
47+
function isUpperCase(str: string): boolean {
48+
return str === str.toUpperCase();
49+
}
50+
4151
/**
4252
* Determine if the identifier name is PascalCased
4353
* @param name The identifier name
4454
*/
4555
function isPascalCase(name: string): boolean {
46-
if (options.allowUnderscorePrefix) {
47-
return /^_?[A-Z][0-9A-Za-z]*$/.test(name);
48-
} else {
49-
return /^[A-Z][0-9A-Za-z]*$/.test(name);
50-
}
56+
const startIndex =
57+
options.allowUnderscorePrefix && name.startsWith(UNDERSCORE) ? 1 : 0;
58+
59+
return (
60+
isUpperCase(name.charAt(startIndex)) &&
61+
!name.includes(UNDERSCORE, startIndex)
62+
);
5163
}
5264

5365
/**

packages/eslint-plugin/src/rules/explicit-function-return-type.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ export default util.createRule<Options, MessageIds>({
152152
);
153153
}
154154

155+
/**
156+
* Checks if a node belongs to:
157+
* new Foo(() => {})
158+
* ^^^^^^^^
159+
*/
160+
function isConstructorArgument(parent: TSESTree.Node): boolean {
161+
return parent.type === AST_NODE_TYPES.NewExpression;
162+
}
163+
155164
/**
156165
* Checks if a node is a type cast
157166
* `(() => {}) as Foo`
@@ -325,7 +334,8 @@ export default util.createRule<Options, MessageIds>({
325334
isVariableDeclaratorWithTypeAnnotation(node.parent) ||
326335
isClassPropertyWithTypeAnnotation(node.parent) ||
327336
isPropertyOfObjectWithType(node.parent) ||
328-
isFunctionArgument(node.parent, node)
337+
isFunctionArgument(node.parent, node) ||
338+
isConstructorArgument(node.parent)
329339
) {
330340
return;
331341
}

packages/eslint-plugin/src/rules/indent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export default util.createRule<Options, MessageIds>({
344344
]({
345345
type: AST_NODE_TYPES.ClassDeclaration,
346346
body: node.body as any,
347-
id: undefined,
347+
id: null,
348348
// TODO: This is invalid, there can be more than one extends in interface
349349
superClass: node.extends![0].expression as any,
350350

packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ function getTypeParametersFromType(
121121
type: ts.EntityName | ts.Expression | ts.ClassDeclaration,
122122
checker: ts.TypeChecker,
123123
): readonly ts.TypeParameterDeclaration[] | undefined {
124-
const sym = getAliasedSymbol(checker.getSymbolAtLocation(type)!, checker);
124+
const symAtLocation = checker.getSymbolAtLocation(type);
125+
if (symAtLocation === undefined) {
126+
return undefined;
127+
}
128+
129+
const sym = getAliasedSymbol(symAtLocation, checker);
125130
if (sym === undefined || sym.declarations === undefined) {
126131
return undefined;
127132
}

packages/eslint-plugin/tests/rules/class-name-casing.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,22 @@ ruleTester.run('class-name-casing', rule, {
1818
code: 'class _NameWithUnderscore {}',
1919
options: [{ allowUnderscorePrefix: true }],
2020
},
21+
{
22+
code: 'class Foo {}',
23+
options: [{ allowUnderscorePrefix: true }],
24+
},
25+
{
26+
code: 'class _ÈFoo {}',
27+
options: [{ allowUnderscorePrefix: true }],
28+
},
2129
'var Foo = class {};',
2230
'interface SomeInterface {}',
2331
'class ClassNameWithDigit2 {}',
2432
'abstract class ClassNameWithDigit2 {}',
2533
'var ba_zz = class Foo {};',
34+
'class ClassNameWithUnicodeÈ {}',
35+
'class ÈClassNameWithUnicode {}',
36+
'class ClassNameWithæUnicode {}',
2637
],
2738

2839
invalid: [
@@ -152,5 +163,19 @@ ruleTester.run('class-name-casing', rule, {
152163
},
153164
],
154165
},
166+
{
167+
code: `class æInvalidClassNameWithUnicode {}`,
168+
errors: [
169+
{
170+
messageId: 'notPascalCased',
171+
data: {
172+
friendlyName: 'Class',
173+
name: 'æInvalidClassNameWithUnicode',
174+
},
175+
line: 1,
176+
column: 7,
177+
},
178+
],
179+
},
155180
],
156181
});

packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,18 @@ const func = (value: number) => x as const;
322322
},
323323
],
324324
},
325+
{
326+
filename: 'test.ts',
327+
code: `
328+
new Promise(resolve => {});
329+
new Foo(1, () => {});
330+
`,
331+
options: [
332+
{
333+
allowTypedFunctionExpressions: true,
334+
},
335+
],
336+
},
325337
],
326338
invalid: [
327339
{

packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ ruleTester.run('no-unnecessary-type-arguments', rule, {
5252
class D<TD = number> extends C { }`,
5353
`declare const C: unknown;
5454
class D<TD = number> extends C { }`,
55+
`let a: A<number>`,
5556
],
5657
invalid: [
5758
{

packages/experimental-utils/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07)
7+
8+
9+
### Bug Fixes
10+
11+
* **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d))
12+
13+
14+
15+
16+
17+
## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30)
18+
19+
**Note:** Version bump only for package @typescript-eslint/experimental-utils
20+
21+
22+
23+
24+
625
## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23)
726

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

packages/experimental-utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typescript-eslint/experimental-utils",
3-
"version": "2.3.1",
3+
"version": "2.3.3",
44
"description": "(Experimental) Utilities for working with TypeScript + ESLint together",
55
"keywords": [
66
"eslint",
@@ -37,7 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@types/json-schema": "^7.0.3",
40-
"@typescript-eslint/typescript-estree": "2.3.1",
40+
"@typescript-eslint/typescript-estree": "2.3.3",
4141
"eslint-scope": "^5.0.0"
4242
},
4343
"peerDependencies": {

packages/experimental-utils/src/ts-eslint/Rule.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ interface RuleMetaDataDocs {
1818
* Concise description of the rule
1919
*/
2020
description: string;
21-
/**
22-
* Extra information linking the rule to a tslint rule
23-
*/
24-
extraDescription?: string[];
2521
/**
2622
* The recommendation level for the rule.
2723
* Used by the build tools to generate the recommended config.

packages/parser/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07)
7+
8+
**Note:** Version bump only for package @typescript-eslint/parser
9+
10+
11+
12+
13+
14+
## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30)
15+
16+
17+
### Bug Fixes
18+
19+
* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe))
20+
21+
22+
23+
24+
625
## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23)
726

827

packages/parser/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typescript-eslint/parser",
3-
"version": "2.3.1",
3+
"version": "2.3.3",
44
"description": "An ESLint custom parser which leverages TypeScript ESTree",
55
"main": "dist/parser.js",
66
"types": "dist/parser.d.ts",
@@ -43,13 +43,13 @@
4343
},
4444
"dependencies": {
4545
"@types/eslint-visitor-keys": "^1.0.0",
46-
"@typescript-eslint/experimental-utils": "2.3.1",
47-
"@typescript-eslint/typescript-estree": "2.3.1",
46+
"@typescript-eslint/experimental-utils": "2.3.3",
47+
"@typescript-eslint/typescript-estree": "2.3.3",
4848
"eslint-visitor-keys": "^1.1.0"
4949
},
5050
"devDependencies": {
5151
"@types/glob": "^7.1.1",
52-
"@typescript-eslint/shared-fixtures": "2.3.1",
52+
"@typescript-eslint/shared-fixtures": "2.3.3",
5353
"glob": "^7.1.4"
5454
}
5555
}

0 commit comments

Comments
 (0)