From 192e23dc0a185dd4482a5080af380c54cdd3ec68 Mon Sep 17 00:00:00 2001 From: Pavel Birukov Date: Wed, 2 Oct 2019 19:55:50 +0300 Subject: [PATCH 1/4] fix(experimental-utils): remove Rule.meta.extraDescription (#1036) --- packages/experimental-utils/src/ts-eslint/Rule.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 75acea5988ce..1724dec828b8 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -18,10 +18,6 @@ interface RuleMetaDataDocs { * Concise description of the rule */ description: string; - /** - * Extra information linking the rule to a tslint rule - */ - extraDescription?: string[]; /** * The recommendation level for the rule. * Used by the build tools to generate the recommended config. From 47895c078f8ecc679c3c5f794863646d0e6dbcad Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 4 Oct 2019 19:13:49 +0300 Subject: [PATCH 2/4] fix(eslint-plugin): [class-name-casing] allow unicode letters (#1043) --- .../src/rules/class-name-casing.ts | 22 ++++++++++++---- .../tests/rules/class-name-casing.test.ts | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/src/rules/class-name-casing.ts b/packages/eslint-plugin/src/rules/class-name-casing.ts index c71a39fd2ac4..b27bf1ebcf14 100644 --- a/packages/eslint-plugin/src/rules/class-name-casing.ts +++ b/packages/eslint-plugin/src/rules/class-name-casing.ts @@ -38,16 +38,28 @@ export default util.createRule({ }, defaultOptions: [{ allowUnderscorePrefix: false }], create(context, [options]) { + const UNDERSCORE = '_'; + + /** + * Determine if the string is Upper cased + * @param str + */ + function isUpperCase(str: string): boolean { + return str === str.toUpperCase(); + } + /** * Determine if the identifier name is PascalCased * @param name The identifier name */ function isPascalCase(name: string): boolean { - if (options.allowUnderscorePrefix) { - return /^_?[A-Z][0-9A-Za-z]*$/.test(name); - } else { - return /^[A-Z][0-9A-Za-z]*$/.test(name); - } + const startIndex = + options.allowUnderscorePrefix && name.startsWith(UNDERSCORE) ? 1 : 0; + + return ( + isUpperCase(name.charAt(startIndex)) && + !name.includes(UNDERSCORE, startIndex) + ); } /** diff --git a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts index 7409fd927e65..7c89c699d5eb 100644 --- a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts +++ b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts @@ -18,11 +18,22 @@ ruleTester.run('class-name-casing', rule, { code: 'class _NameWithUnderscore {}', options: [{ allowUnderscorePrefix: true }], }, + { + code: 'class Foo {}', + options: [{ allowUnderscorePrefix: true }], + }, + { + code: 'class _ÈFoo {}', + options: [{ allowUnderscorePrefix: true }], + }, 'var Foo = class {};', 'interface SomeInterface {}', 'class ClassNameWithDigit2 {}', 'abstract class ClassNameWithDigit2 {}', 'var ba_zz = class Foo {};', + 'class ClassNameWithUnicodeÈ {}', + 'class ÈClassNameWithUnicode {}', + 'class ClassNameWithæUnicode {}', ], invalid: [ @@ -152,5 +163,19 @@ ruleTester.run('class-name-casing', rule, { }, ], }, + { + code: `class æInvalidClassNameWithUnicode {}`, + errors: [ + { + messageId: 'notPascalCased', + data: { + friendlyName: 'Class', + name: 'æInvalidClassNameWithUnicode', + }, + line: 1, + column: 7, + }, + ], + }, ], }); From 60943e6f270e02a9779d11b6b86b9913b02d2968 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 7 Oct 2019 06:35:41 +0300 Subject: [PATCH 3/4] fix(eslint-plugin): [efrt] support constructor arguments (#1021) Co-authored-by: Brad Zacher --- .../src/rules/explicit-function-return-type.ts | 12 +++++++++++- .../rules/explicit-function-return-type.test.ts | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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 43a1cac41fb4..d7e5fe18b7b6 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -152,6 +152,15 @@ export default util.createRule({ ); } + /** + * Checks if a node belongs to: + * new Foo(() => {}) + * ^^^^^^^^ + */ + function isConstructorArgument(parent: TSESTree.Node): boolean { + return parent.type === AST_NODE_TYPES.NewExpression; + } + /** * Checks if a node is a type cast * `(() => {}) as Foo` @@ -325,7 +334,8 @@ export default util.createRule({ isVariableDeclaratorWithTypeAnnotation(node.parent) || isClassPropertyWithTypeAnnotation(node.parent) || isPropertyOfObjectWithType(node.parent) || - isFunctionArgument(node.parent, node) + isFunctionArgument(node.parent, node) || + isConstructorArgument(node.parent) ) { 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 bd69534089db..3552c718d65a 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 @@ -322,6 +322,18 @@ const func = (value: number) => x as const; }, ], }, + { + filename: 'test.ts', + code: ` +new Promise(resolve => {}); +new Foo(1, () => {}); + `, + options: [ + { + allowTypedFunctionExpressions: true, + }, + ], + }, ], invalid: [ { From 054df278d6b7064a44b5f78fec453bf9ae6ad281 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 7 Oct 2019 17:02:23 +0000 Subject: [PATCH 4/4] chore: publish v2.3.3 --- CHANGELOG.md | 13 +++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 12 ++++++++++++ packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/CHANGELOG.md | 11 +++++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 8 ++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 8 ++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 83 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac7f8e0ca8a1..fd6a1421944f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + + +### Bug Fixes + +* **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)) +* **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)) +* **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)) + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/lerna.json b/lerna.json index 16ca1c0d0e88..093a7b7253e4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.3.2", + "version": "2.3.3", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index bebccf5ca5ef..50d3ff8d511a 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) **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 0d1dd95c219c..1944e16e02e9 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": "2.3.2", + "version": "2.3.3", "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": "2.3.2", + "@typescript-eslint/experimental-utils": "2.3.3", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.3.2" + "@typescript-eslint/parser": "2.3.3" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index d9be8637d98c..ecbd6059dfb2 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + + +### Bug Fixes + +* **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)) +* **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)) + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 3251f3b93cd9..2458e18eb1be 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.3.2", + "version": "2.3.3", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.3.2", + "@typescript-eslint/experimental-utils": "2.3.3", "eslint-utils": "^1.4.2", "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 598085cefc86..43271d72e814 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + + +### Bug Fixes + +* **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)) + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) **Note:** Version bump only for package @typescript-eslint/experimental-utils diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 753fd606a288..b17f79a2ca30 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.3.2", + "version": "2.3.3", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.3.2", + "@typescript-eslint/typescript-estree": "2.3.3", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 1098745e1301..9ccea9c2f802 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/parser/package.json b/packages/parser/package.json index aa14e9e3f770..a5a641ef5170 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.3.2", + "version": "2.3.3", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.3.2", - "@typescript-eslint/typescript-estree": "2.3.2", + "@typescript-eslint/experimental-utils": "2.3.3", + "@typescript-eslint/typescript-estree": "2.3.3", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.3.2", + "@typescript-eslint/shared-fixtures": "2.3.3", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 938f88a906bc..959a366b0e61 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index fc7944ea50d3..6b55d5122d85 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.3.2", + "version": "2.3.3", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index ae3e39147edb..0bf4baa176b7 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 906c23639a36..b5918d8d939e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.3.2", + "version": "2.3.3", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -56,7 +56,7 @@ "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "2.3.2", + "@typescript-eslint/shared-fixtures": "2.3.3", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6",