diff --git a/CHANGELOG.md b/CHANGELOG.md index 4854975493f1..b96426e25062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + + +### Bug Fixes + +* **eslint-plugin:** [consistent-type-assertions] enforce assertionStyle for `const` assertions ([#4685](https://github.com/typescript-eslint/typescript-eslint/issues/4685)) ([8ec05be](https://github.com/typescript-eslint/typescript-eslint/commit/8ec05bed0fed0dcd48b087acd5ab5a6132bf3b09)) +* **scope-manager:** incorrect reference for this within a jsx identifier ([#4535](https://github.com/typescript-eslint/typescript-eslint/issues/4535)) ([dd49280](https://github.com/typescript-eslint/typescript-eslint/commit/dd49280e50cb2f5bd26dc07210551bc1fda120af)) +* **utils:** RuleTester: Only call afterAll if defined ([#4656](https://github.com/typescript-eslint/typescript-eslint/issues/4656)) ([0fe0683](https://github.com/typescript-eslint/typescript-eslint/commit/0fe0683effe4c7390806a72c6aa7795445a67929)) + + +### Features + +* **eslint-plugin:** [prefer-optional-chain] support logical with empty object ([#4430](https://github.com/typescript-eslint/typescript-eslint/issues/4430)) ([d21cfe0](https://github.com/typescript-eslint/typescript-eslint/commit/d21cfe0f4b7d3041948b1b6e0cd56c5ec34b2b3f)) + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) diff --git a/lerna.json b/lerna.json index 56110c900f15..3bef5bd8f183 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "5.15.0", + "version": "5.16.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/package.json b/package.json index 0420f968b8cc..495f80242f20 100644 --- a/package.json +++ b/package.json @@ -61,8 +61,8 @@ "@nrwl/nx-cloud": "13.1.6", "@nrwl/tao": "13.8.5", "@nrwl/workspace": "13.8.5", - "@swc/core": "^1.2.143", - "@swc/jest": "^0.2.17", + "@swc/core": "^1.2.159", + "@swc/jest": "^0.2.20", "@types/debug": "^4.1.7", "@types/eslint-visitor-keys": "^1.0.0", "@types/glob": "^7.2.0", diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index d3ec483acf58..ee83aec75d1c 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/ast-spec diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 74028384cecc..c030ec8db13a 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "5.15.0", + "version": "5.16.0", "description": "TypeScript-ESTree AST spec", "private": true, "keywords": [ diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index bc79915b5928..359cd37c3140 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 146fa2865165..7c39c5389a46 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": "5.15.0", + "version": "5.16.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,8 +14,8 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/scope-manager": "5.15.0", - "@typescript-eslint/utils": "5.15.0", + "@typescript-eslint/scope-manager": "5.16.0", + "@typescript-eslint/utils": "5.16.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 95bac15be4d2..534a7d05c494 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **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 ed23be4c3aed..333e7a67938d 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": "5.15.0", + "version": "5.16.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/utils": "5.15.0", + "@typescript-eslint/utils": "5.16.0", "lodash": "^4.17.21" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "5.15.0" + "@typescript-eslint/parser": "5.16.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index deb6ee7da79c..0c749c0396f9 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + + +### Bug Fixes + +* **eslint-plugin:** [consistent-type-assertions] enforce assertionStyle for `const` assertions ([#4685](https://github.com/typescript-eslint/typescript-eslint/issues/4685)) ([8ec05be](https://github.com/typescript-eslint/typescript-eslint/commit/8ec05bed0fed0dcd48b087acd5ab5a6132bf3b09)) + + +### Features + +* **eslint-plugin:** [prefer-optional-chain] support logical with empty object ([#4430](https://github.com/typescript-eslint/typescript-eslint/issues/4430)) ([d21cfe0](https://github.com/typescript-eslint/typescript-eslint/commit/d21cfe0f4b7d3041948b1b6e0cd56c5ec34b2b3f)) + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) diff --git a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md index 1f42754e0f75..4d0e0871c73b 100644 --- a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md +++ b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md @@ -22,6 +22,10 @@ function myFunc(foo: T | null) { function myFunc(foo: T | null) { return foo && foo.a && foo.a.b && foo.a.b.c; } +// or +function myFunc(foo: T | null) { + return (((foo || {}).a || {}).b || {}).c; +} function myFunc(foo: T | null) { return foo?.['a']?.b?.c; @@ -57,6 +61,9 @@ foo && foo.a && foo.a.b && foo.a.b.c; foo && foo['a'] && foo['a'].b && foo['a'].b.c; foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method(); +(((foo || {}).a || {}).b {}).c; +(((foo || {})['a'] || {}).b {}).c; + // this rule also supports converting chained strict nullish checks: foo && foo.a != null && diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index e7bef5c4f441..c857d3016e21 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "5.15.0", + "version": "5.16.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -44,9 +44,9 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.15.0", - "@typescript-eslint/type-utils": "5.15.0", - "@typescript-eslint/utils": "5.15.0", + "@typescript-eslint/scope-manager": "5.16.0", + "@typescript-eslint/type-utils": "5.16.0", + "@typescript-eslint/utils": "5.16.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", diff --git a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts index 4a75edd7bda9..c75b93eea0e2 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts @@ -84,13 +84,13 @@ export default util.createRule({ function reportIncorrectAssertionType( node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, ): void { + const messageId = options.assertionStyle; + // If this node is `as const`, then don't report an error. - if (isConst(node.typeAnnotation)) { + if (isConst(node.typeAnnotation) && messageId === 'never') { return; } - const messageId = options.assertionStyle; - context.report({ node, messageId, diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index 92c794caf07f..8c423b2f1044 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -299,10 +299,10 @@ function getMemberRawName( const { name, type } = util.getNameFromMember(member, sourceCode); if (type === util.MemberNameType.Quoted) { - return name.substr(1, name.length - 2); + return name.slice(1, -1); } if (type === util.MemberNameType.Private) { - return name.substr(1); + return name.slice(1); } return name; } diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index 109deaa6d60d..b3815e09ef97 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -1,5 +1,7 @@ -import { AST_NODE_TYPES, TSESTree, TSESLint } from '@typescript-eslint/utils'; +import * as ts from 'typescript'; import * as util from '../util'; +import { AST_NODE_TYPES, TSESTree, TSESLint } from '@typescript-eslint/utils'; +import { isBinaryExpression } from 'tsutils'; type ValidChainTarget = | TSESTree.BinaryExpression @@ -47,7 +49,68 @@ export default util.createRule({ defaultOptions: [], create(context) { const sourceCode = context.getSourceCode(); + const parserServices = util.getParserServices(context, true); + return { + 'LogicalExpression[operator="||"], LogicalExpression[operator="??"]'( + node: TSESTree.LogicalExpression, + ): void { + const leftNode = node.left; + const rightNode = node.right; + const parentNode = node.parent; + const isRightNodeAnEmptyObjectLiteral = + rightNode.type === AST_NODE_TYPES.ObjectExpression && + rightNode.properties.length === 0; + if ( + !isRightNodeAnEmptyObjectLiteral || + !parentNode || + parentNode.type !== AST_NODE_TYPES.MemberExpression || + parentNode.optional + ) { + return; + } + + function isLeftSideLowerPrecedence(): boolean { + const logicalTsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + + const leftTsNode = parserServices.esTreeNodeToTSNodeMap.get(leftNode); + const operator = isBinaryExpression(logicalTsNode) + ? logicalTsNode.operatorToken.kind + : ts.SyntaxKind.Unknown; + const leftPrecedence = util.getOperatorPrecedence( + leftTsNode.kind, + operator, + ); + + return leftPrecedence < util.OperatorPrecedence.LeftHandSide; + } + context.report({ + node: parentNode, + messageId: 'optionalChainSuggest', + suggest: [ + { + messageId: 'optionalChainSuggest', + fix: (fixer): TSESLint.RuleFix => { + const leftNodeText = sourceCode.getText(leftNode); + // Any node that is made of an operator with higher or equal precedence, + const maybeWrappedLeftNode = isLeftSideLowerPrecedence() + ? `(${leftNodeText})` + : leftNodeText; + const propertyToBeOptionalText = sourceCode.getText( + parentNode.property, + ); + const maybeWrappedProperty = parentNode.computed + ? `[${propertyToBeOptionalText}]` + : propertyToBeOptionalText; + return fixer.replaceTextRange( + parentNode.range, + `${maybeWrappedLeftNode}?.${maybeWrappedProperty}`, + ); + }, + }, + ], + }); + }, [[ 'LogicalExpression[operator="&&"] > Identifier', 'LogicalExpression[operator="&&"] > MemberExpression', diff --git a/packages/eslint-plugin/src/util/index.ts b/packages/eslint-plugin/src/util/index.ts index a83198807a67..b2932466388d 100644 --- a/packages/eslint-plugin/src/util/index.ts +++ b/packages/eslint-plugin/src/util/index.ts @@ -4,6 +4,7 @@ export * from './astUtils'; export * from './collectUnusedVariables'; export * from './createRule'; export * from './getFunctionHeadLoc'; +export * from './getOperatorPrecedence'; export * from './getThisExpression'; export * from './getWrappingFixer'; export * from './misc'; diff --git a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts index 1711e4450c38..a1d8e47645a5 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts @@ -5,18 +5,26 @@ const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const ANGLE_BRACKET_TESTS = ` +const ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE = ` const x = new Generic(); const x = b; const x = [1]; -const x = ('string'); +const x = ('string');`; + +const ANGLE_BRACKET_TESTS = `${ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE} +const x = { key: 'value' }; `; -const AS_TESTS = ` + +const AS_TESTS_EXCEPT_CONST_CASE = ` const x = new Generic() as Foo; const x = b as A; const x = [1] as readonly number[]; -const x = ('string') as a | b; +const x = ('string') as a | b;`; + +const AS_TESTS = `${AS_TESTS_EXCEPT_CONST_CASE} +const x = { key: 'value' } as const; `; + const OBJECT_LITERAL_AS_CASTS = ` const x = {} as Foo; `; @@ -189,7 +197,7 @@ ruleTester.run('consistent-type-assertions', rule, { ], }), ...batchedSingleLineTests({ - code: AS_TESTS, + code: AS_TESTS_EXCEPT_CONST_CASE, options: [ { assertionStyle: 'never', @@ -219,7 +227,7 @@ ruleTester.run('consistent-type-assertions', rule, { ], }), ...batchedSingleLineTests({ - code: ANGLE_BRACKET_TESTS, + code: ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE, options: [ { assertionStyle: 'never', diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts index d6ac19abb896..2b004e9d7a9c 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts @@ -146,6 +146,22 @@ const baseCases = [ ruleTester.run('prefer-optional-chain', rule, { valid: [ + 'foo || {};', + 'foo || ({} as any);', + '(foo || {})?.bar;', + '(foo || { bar: 1 }).bar;', + '(undefined && (foo || {})).bar;', + 'foo ||= bar;', + 'foo ||= bar || {};', + 'foo ||= bar?.baz;', + 'foo ||= bar?.baz || {};', + 'foo ||= bar?.baz?.buzz;', + '(foo1 ? foo2 : foo3 || {}).foo4;', + '(foo = 2 || {}).bar;', + 'func(foo || {}).bar;', + 'foo ?? {};', + '(foo ?? {})?.bar;', + 'foo ||= bar ?? {};', 'foo && bar;', 'foo && foo;', 'foo || bar;', @@ -501,5 +517,631 @@ foo?.bar(/* comment */a, }, }, }, + { + code: '(foo || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 16, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(foo || ({})).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(await foo || {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 22, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(await foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo1?.foo2 || {}).foo3;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 24, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo1?.foo2?.foo3;', + }, + ], + }, + ], + }, + { + code: '((() => foo())() || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(() => foo())()?.bar;', + }, + ], + }, + ], + }, + { + code: 'const foo = (bar || {}).baz;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 13, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'const foo = bar?.baz;', + }, + ], + }, + ], + }, + { + code: '(foo.bar || {})[baz];', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo.bar?.[baz];', + }, + ], + }, + ], + }, + { + code: '((foo1 || {}).foo2 || {}).foo3;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 31, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 || {}).foo2?.foo3;', + }, + ], + }, + { + messageId: 'optionalChainSuggest', + column: 2, + endColumn: 19, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1?.foo2 || {}).foo3;', + }, + ], + }, + ], + }, + { + code: '(foo || undefined || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo || undefined)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo() || bar || {}).baz;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 25, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo() || bar)?.baz;', + }, + ], + }, + ], + }, + { + code: '((foo1 ? foo2 : foo3) || {}).foo4;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 34, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 ? foo2 : foo3)?.foo4;', + }, + ], + }, + ], + }, + { + code: noFormat`if (foo) { (foo || {}).bar; }`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 12, + endColumn: 27, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`if (foo) { foo?.bar; }`, + }, + ], + }, + ], + }, + { + code: noFormat`if ((foo || {}).bar) { foo.bar; }`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 5, + endColumn: 20, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`if (foo?.bar) { foo.bar; }`, + }, + ], + }, + ], + }, + { + code: noFormat`(undefined && foo || {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 29, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(undefined && foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo ?? {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 16, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(foo ?? ({})).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(await foo ?? {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 22, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(await foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo1?.foo2 ?? {}).foo3;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 24, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo1?.foo2?.foo3;', + }, + ], + }, + ], + }, + { + code: '((() => foo())() ?? {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(() => foo())()?.bar;', + }, + ], + }, + ], + }, + { + code: 'const foo = (bar ?? {}).baz;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 13, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'const foo = bar?.baz;', + }, + ], + }, + ], + }, + { + code: '(foo.bar ?? {})[baz];', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo.bar?.[baz];', + }, + ], + }, + ], + }, + { + code: '((foo1 ?? {}).foo2 ?? {}).foo3;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 31, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 ?? {}).foo2?.foo3;', + }, + ], + }, + { + messageId: 'optionalChainSuggest', + column: 2, + endColumn: 19, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1?.foo2 ?? {}).foo3;', + }, + ], + }, + ], + }, + { + code: '(foo ?? undefined ?? {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo ?? undefined)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo() ?? bar ?? {}).baz;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 25, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo() ?? bar)?.baz;', + }, + ], + }, + ], + }, + { + code: '((foo1 ? foo2 : foo3) ?? {}).foo4;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 34, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 ? foo2 : foo3)?.foo4;', + }, + ], + }, + ], + }, + { + code: noFormat`if (foo) { (foo ?? {}).bar; }`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 12, + endColumn: 27, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`if (foo) { foo?.bar; }`, + }, + ], + }, + ], + }, + { + code: noFormat`if ((foo ?? {}).bar) { foo.bar; }`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 5, + endColumn: 20, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`if (foo?.bar) { foo.bar; }`, + }, + ], + }, + ], + }, + { + code: noFormat`(undefined && foo ?? {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 29, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(undefined && foo)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(a > b || {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a > b)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(((typeof x) as string) || {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 35, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`((typeof x) as string)?.bar;`, + }, + ], + }, + ], + }, + { + code: '(void foo() || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 23, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(void foo())?.bar;', + }, + ], + }, + ], + }, + { + code: '((a ? b : c) || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 24, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a ? b : c)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`((a instanceof Error) || {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 33, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a instanceof Error)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`((a << b) || {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a << b)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`((foo ** 2) || {}).bar;`, + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 23, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo ** 2)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo ** 2 || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo ** 2)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo++ || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo++)?.bar;', + }, + ], + }, + ], + }, + { + code: '(+foo || {}).bar;', + errors: [ + { + messageId: 'optionalChainSuggest', + column: 1, + endColumn: 17, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(+foo)?.bar;', + }, + ], + }, + ], + }, ], }); diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 72d2c227b2cd..64b49a1a52b5 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **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 445b9629e8a1..12352fd6e2da 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "5.15.0", + "version": "5.16.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.15.0" + "@typescript-eslint/utils": "5.16.0" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 0f27700a8fad..7762f289a6dc 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) diff --git a/packages/parser/package.json b/packages/parser/package.json index 00c877654330..0eed6bca39d8 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "5.15.0", + "version": "5.16.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -44,9 +44,9 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.15.0", - "@typescript-eslint/types": "5.15.0", - "@typescript-eslint/typescript-estree": "5.15.0", + "@typescript-eslint/scope-manager": "5.16.0", + "@typescript-eslint/types": "5.16.0", + "@typescript-eslint/typescript-estree": "5.16.0", "debug": "^4.3.2" }, "devDependencies": { diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index db0a427e4483..86a5015f61b1 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + + +### Bug Fixes + +* **scope-manager:** incorrect reference for this within a jsx identifier ([#4535](https://github.com/typescript-eslint/typescript-eslint/issues/4535)) ([dd49280](https://github.com/typescript-eslint/typescript-eslint/commit/dd49280e50cb2f5bd26dc07210551bc1fda120af)) + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/scope-manager diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index d84546d51833..98d05eb39120 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "5.15.0", + "version": "5.16.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.15.0", - "@typescript-eslint/visitor-keys": "5.15.0" + "@typescript-eslint/types": "5.16.0", + "@typescript-eslint/visitor-keys": "5.16.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "5.15.0", + "@typescript-eslint/typescript-estree": "5.16.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 10273bfb6b35..3190af3a56cd 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -509,17 +509,27 @@ class Referencer extends Visitor { } protected JSXMemberExpression(node: TSESTree.JSXMemberExpression): void { - this.visit(node.object); + if (node.object.type !== AST_NODE_TYPES.JSXIdentifier) { + this.visit(node.object); + } else { + if (node.object.name !== 'this') { + this.visit(node.object); + } + } // we don't ever reference the property as it's always going to be a property on the thing } - protected JSXOpeningElement(node: TSESTree.JSXOpeningElement): void { this.referenceJsxPragma(); if (node.name.type === AST_NODE_TYPES.JSXIdentifier) { - if (node.name.name[0].toUpperCase() === node.name.name[0]) { + if ( + node.name.name[0].toUpperCase() === node.name.name[0] || + node.name.name === 'this' + ) { // lower cased component names are always treated as "intrinsic" names, and are converted to a string, // not a variable by JSX transforms: //
=> React.createElement("div", null) + + // the only case we want to visit a lower-cased component has its name as "this", this.visit(node.name); } } else { diff --git a/packages/scope-manager/tests/fixtures/jsx/this-jsxidentifier.tsx b/packages/scope-manager/tests/fixtures/jsx/this-jsxidentifier.tsx new file mode 100644 index 000000000000..4a3190a5a6dc --- /dev/null +++ b/packages/scope-manager/tests/fixtures/jsx/this-jsxidentifier.tsx @@ -0,0 +1,12 @@ +declare const React; + +class Foo { + foo: any; + Div = { + Element: () =>
, + }; + method() { + ; + ()(); + } +} diff --git a/packages/scope-manager/tests/fixtures/jsx/this-jsxidentifier.tsx.shot b/packages/scope-manager/tests/fixtures/jsx/this-jsxidentifier.tsx.shot new file mode 100644 index 000000000000..713e659bb5bc --- /dev/null +++ b/packages/scope-manager/tests/fixtures/jsx/this-jsxidentifier.tsx.shot @@ -0,0 +1,143 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx this-jsxidentifier 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"React">, + node: VariableDeclarator$1, + }, + ], + name: "React", + references: Array [ + Reference$1 { + identifier: Identifier<"React">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"Foo">, + node: ClassDeclaration$2, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + ClassNameDefinition$3 { + name: Identifier<"Foo">, + node: ClassDeclaration$2, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$5 { + defs: Array [], + name: "arguments", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$3, + isStrict: false, + references: Array [ + Reference$1, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "React" => Variable$2, + "Foo" => Variable$3, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + ], + }, + ClassScope$2 { + block: ClassDeclaration$2, + isStrict: true, + references: Array [], + set: Map { + "Foo" => Variable$4, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$4, + ], + }, + ClassFieldInitializerScope$3 { + block: ObjectExpression$4, + isStrict: true, + references: Array [], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + FunctionScope$4 { + block: ArrowFunctionExpression$5, + isStrict: true, + references: Array [], + set: Map {}, + type: "function", + upper: ClassFieldInitializerScope$3, + variables: Array [], + }, + FunctionScope$5 { + block: FunctionExpression$6, + isStrict: true, + references: Array [ + Reference$2 { + identifier: JSXIdentifier$7, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: null, + }, + Reference$3 { + identifier: JSXIdentifier$8, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: null, + }, + ], + set: Map { + "arguments" => Variable$5, + }, + type: "function", + upper: ClassScope$2, + variables: Array [ + Variable$5, + ], + }, + ], +} +`; diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 0ec11a46e263..e839f3da88d1 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **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 ccf63218e71b..7d7fff857123 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "5.15.0", + "version": "5.16.0", "private": true } diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index f499254b0b76..76d380f5542f 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/type-utils diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index acf36dcec5c4..cbc1fdddc488 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "5.15.0", + "version": "5.16.0", "description": "Type utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.15.0", + "@typescript-eslint/utils": "5.16.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.15.0", + "@typescript-eslint/parser": "5.16.0", "typescript": "*" }, "peerDependencies": { diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index a4662c5c14dd..6195a0cf0df0 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) diff --git a/packages/types/package.json b/packages/types/package.json index abb59b402ca0..ff0b88c0f6a0 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "5.15.0", + "version": "5.16.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 9b969d2eba4a..faa4b6f6f2e4 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 7df2739504bc..6b072fb8bcce 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "5.15.0", + "version": "5.16.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": "5.15.0", - "@typescript-eslint/visitor-keys": "5.15.0", + "@typescript-eslint/types": "5.16.0", + "@typescript-eslint/visitor-keys": "5.16.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -58,7 +58,7 @@ "@types/is-glob": "*", "@types/semver": "*", "@types/tmp": "*", - "@typescript-eslint/shared-fixtures": "5.15.0", + "@typescript-eslint/shared-fixtures": "5.16.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 737b01b242f8..effc4ead9077 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -36,7 +36,7 @@ export function convertComments( range[1] - textStart - 2; comments.push({ type, - value: code.substr(textStart, textEnd), + value: code.slice(textStart, textStart + textEnd), range, loc, }); diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index a0e654c90979..53d6fe9ee4de 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -57,7 +57,7 @@ const correctPathCasing = useCaseSensitiveFileNames function getCanonicalFileName(filePath: string): CanonicalPath { let normalized = path.normalize(filePath); if (normalized.endsWith(path.sep)) { - normalized = normalized.substr(0, normalized.length - 1); + normalized = normalized.slice(0, -1); } return correctPathCasing(normalized) as CanonicalPath; } diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index f09970752b4d..2847a29515cf 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + + +### Bug Fixes + +* **utils:** RuleTester: Only call afterAll if defined ([#4656](https://github.com/typescript-eslint/typescript-eslint/issues/4656)) ([0fe0683](https://github.com/typescript-eslint/typescript-eslint/commit/0fe0683effe4c7390806a72c6aa7795445a67929)) + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/utils diff --git a/packages/utils/package.json b/packages/utils/package.json index 999efb0a0770..61c09e9ed145 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "5.15.0", + "version": "5.16.0", "description": "Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -40,9 +40,9 @@ }, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.15.0", - "@typescript-eslint/types": "5.15.0", - "@typescript-eslint/typescript-estree": "5.15.0", + "@typescript-eslint/scope-manager": "5.16.0", + "@typescript-eslint/types": "5.16.0", + "@typescript-eslint/typescript-estree": "5.16.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, diff --git a/packages/utils/src/eslint-utils/RuleTester.ts b/packages/utils/src/eslint-utils/RuleTester.ts index f2af7a290fd8..d0c0ada27bcf 100644 --- a/packages/utils/src/eslint-utils/RuleTester.ts +++ b/packages/utils/src/eslint-utils/RuleTester.ts @@ -28,16 +28,18 @@ class RuleTester extends TSESLint.RuleTester { // make sure that the parser doesn't hold onto file handles between tests // on linux (i.e. our CI env), there can be very a limited number of watch handles available - afterAll(() => { - try { - // instead of creating a hard dependency, just use a soft require - // a bit weird, but if they're using this tooling, it'll be installed - // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - require(parser).clearCaches(); - } catch { - // ignored - } - }); + if (typeof afterAll !== 'undefined') { + afterAll(() => { + try { + // instead of creating a hard dependency, just use a soft require + // a bit weird, but if they're using this tooling, it'll be installed + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access + require(parser).clearCaches(); + } catch { + // ignored + } + }); + } } private getFilename(options?: TSESLint.ParserOptions): string { if (options) { diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 9f94d13d8434..f2a7da05b545 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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **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 c0fbb5944450..9cb9d0a97bcf 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "5.15.0", + "version": "5.16.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": "5.15.0", + "@typescript-eslint/types": "5.16.0", "eslint-visitor-keys": "^3.0.0" }, "devDependencies": { diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md index 17831c521fdc..2b6627729669 100644 --- a/packages/website-eslint/CHANGELOG.md +++ b/packages/website-eslint/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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/website-eslint diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index fa0f32474715..be8fc19e8e26 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/website-eslint", - "version": "5.15.0", + "version": "5.16.0", "private": true, "description": "ESLint which works in browsers.", "engines": { @@ -16,19 +16,19 @@ "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore" }, "dependencies": { - "@typescript-eslint/types": "5.15.0", - "@typescript-eslint/utils": "5.15.0" + "@typescript-eslint/types": "5.16.0", + "@typescript-eslint/utils": "5.16.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.0.6", "@rollup/pluginutils": "^4.1.1", - "@typescript-eslint/eslint-plugin": "5.15.0", - "@typescript-eslint/parser": "5.15.0", - "@typescript-eslint/scope-manager": "5.15.0", - "@typescript-eslint/typescript-estree": "5.15.0", - "@typescript-eslint/visitor-keys": "5.15.0", + "@typescript-eslint/eslint-plugin": "5.16.0", + "@typescript-eslint/parser": "5.16.0", + "@typescript-eslint/scope-manager": "5.16.0", + "@typescript-eslint/typescript-estree": "5.16.0", + "@typescript-eslint/visitor-keys": "5.16.0", "eslint": "*", "rollup": "^2.59.0", "semver": "^7.3.5" diff --git a/packages/website-eslint/src/mock/path.js b/packages/website-eslint/src/mock/path.js index 3d04551e2e79..a93a1a650d1a 100644 --- a/packages/website-eslint/src/mock/path.js +++ b/packages/website-eslint/src/mock/path.js @@ -95,7 +95,7 @@ export function resolve() { // posix version export function normalize(path) { let isPathAbsolute = isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; + trailingSlash = path.endsWith('/'); // Normalize the path path = normalizeArray( @@ -136,8 +136,8 @@ export function join() { // path.relative(from, to) // posix version export function relative(from, to) { - from = resolve(from).substr(1); - to = resolve(to).substr(1); + from = resolve(from).slice(1); + to = resolve(to).slice(1); function trim(arr) { let start = 0; @@ -191,7 +191,7 @@ export function dirname(path) { if (dir) { // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); + dir = dir.slice(0, -1); } return root + dir; @@ -200,8 +200,8 @@ export function dirname(path) { export function basename(path, ext) { let f = splitPath(path)[2]; // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); + if (ext && f.slice(-1 * ext.length) === ext) { + f = f.slice(0, f.length - ext.length); } return f; } @@ -231,14 +231,3 @@ function filter(xs, f) { } return res; } - -// String.prototype.substr - negative index don't work in IE8 -const substr = - 'ab'.substr(-1) === 'b' - ? function (str, start, len) { - return str.substr(start, len); - } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - }; diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index 622ac28c7d71..0c11aeaf791e 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/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. +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package website + + + + + # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package website diff --git a/packages/website/data/sponsors.json b/packages/website/data/sponsors.json index 08fb6f15743e..5eabd5e5dcec 100644 --- a/packages/website/data/sponsors.json +++ b/packages/website/data/sponsors.json @@ -12,7 +12,7 @@ "description": "LIVE PAIN FREE", "id": "x8k03rey-d5agmq5m-z9b6lbwo-z7j4nxv9", "image": "https://images.opencollective.com/my-sports-injury-ltd/518c583/logo.png", - "name": "My Sports Injury Ltd", + "name": "MySportsInjury", "slug": "my-sports-injury-ltd", "tier": "supporter", "website": "https://www.mysportsinjury.co.uk" @@ -170,4 +170,4 @@ "tier": "supporter", "website": null } -] \ No newline at end of file +] diff --git a/packages/website/package.json b/packages/website/package.json index 944c56e9ee29..526491f3ffeb 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "website", - "version": "5.15.0", + "version": "5.16.0", "private": true, "scripts": { "build": "docusaurus build", @@ -24,7 +24,7 @@ "@docusaurus/theme-common": "^2.0.0-beta.15", "@docusaurus/theme-search-algolia": "^2.0.0-beta.15", "@mdx-js/react": "1.6.22", - "@typescript-eslint/website-eslint": "5.15.0", + "@typescript-eslint/website-eslint": "5.16.0", "clsx": "^1.1.1", "eslint": "*", "json5": "^2.2.0", diff --git a/yarn.lock b/yarn.lock index 3281b510c947..e6d5b8c1e0db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3837,91 +3837,91 @@ dependencies: source-map-support "^0.5.21" -"@swc/core-android-arm-eabi@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.154.tgz#f4d25e01e494919aa3df8aabd21a1fbd69f78dcb" - integrity sha512-zwpOQ6EVHUQSK0AiwruRv/uwvLKBbj9wJ7n3Y6hipoeXYNGYzlDpuxsWzBgNtpLYozSKsL9ErByvNGWjR1uvRw== - -"@swc/core-android-arm64@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.2.154.tgz#3d4003cb380283deae3fb4f1e9e6a01433b3c8e9" - integrity sha512-MYNCY1KXYfcHPfkDdokVZqm5NqmQrhURXf9/PjpkDgcNu/7IDBxvPsFoBTq6Czl/FyEF1QyilfgoTpP/liyYNA== - -"@swc/core-darwin-arm64@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.154.tgz#119930c62c3ce7f2184f10f05db1526930cba5fc" - integrity sha512-30Zpyp/RdR9ywJcneDYoESRdoJVI/mVMzTvWzPDHUpkABgPTXA4h53kL1e6oIYEp4uOkcKFFD4iAzbz1tj/vhw== - -"@swc/core-darwin-x64@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.2.154.tgz#d428c7f3d1672986eb91b4ae036f9061cccc25d1" - integrity sha512-t3oRoDd3q2jlRdpCO1gG3GB6nbl0Z+jHFsIcKzdeBVhnG3R6pqOflA6GYrNEaIyskPf0WT5POcpBv38I7liyPQ== - -"@swc/core-freebsd-x64@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.154.tgz#0322ff67c2309382bad8cf791c104ec0c76d4899" - integrity sha512-YSQF9AekPRbQTPNNlaWmJqds1QfbS9qDDL9zyUcC2XVk5bAKQQMmVYSRTJm4aV6no2Vy+C5yQeuR2vDwVUUXvw== - -"@swc/core-linux-arm-gnueabihf@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.154.tgz#59d20cae1f1751da6d306a184fe94cef5022d891" - integrity sha512-xAg+eP7wsQ2I8jOPDmvbqe6N1UvjUWD1/1jq1zF3kCwH7352kZWljFdJ0WcojUN0pX5lyIl4QWN1xarhtprFhg== - -"@swc/core-linux-arm64-gnu@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.154.tgz#c09769e5b9a7002a01e9ef5716e8862263e7ee35" - integrity sha512-lxrZyD6sONGZsL/wgB4q65/U4lwdWHJv81NSp+ScjvNSKeSJz/a+fxMB7FVf/iEpCtZobLgFUZO+sRVtO2jH3g== - -"@swc/core-linux-arm64-musl@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.154.tgz#bcaf95d1d93900739cbfbb6610f0917ed67dc5c8" - integrity sha512-dnPzLhCHyTLAKmJYHq7W6WJ1Pp+0vnM4mX091EjN5Pw+JTSF1ItNAWya8n87PV3LaDz5sF0JqGwHEqAzgfokHg== - -"@swc/core-linux-x64-gnu@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.154.tgz#367010e73772c17acc2f7f8e6cf805324b2530d8" - integrity sha512-kdDxQxbt5ANoYXJE804GBJmh/ppiKWI996Ax2vuiUPUil9PtzIe5uxEAh/OwM9Tq+7YSfNcHUF2ZG/a6N7CvmA== - -"@swc/core-linux-x64-musl@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.154.tgz#64b7599aba7fd27d62947111c6fe5d74e971694e" - integrity sha512-g8GJCj2W4jla9R9EvbFnrEiykLK1utZLTQxi8TEx3Vjjv3iTDkA3VEq+JUHDZUzj8wsRcmxB2x23RxXXJ9PbtA== - -"@swc/core-win32-arm64-msvc@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.154.tgz#05b18f15635474f404e8502c31b3cb45798b4f62" - integrity sha512-zRa0L56etjgK6YjIY3bh9XlT+Zf8tWgdGGkXqimm9RMMgGBrJ0e+Wg8j5LCM0a9YMONPNwqM1P9UK2i32AFM+Q== - -"@swc/core-win32-ia32-msvc@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.154.tgz#9e45e54527b2eedb5ab462c59ae828266f34f790" - integrity sha512-Vojk27M5Dnpxw2Oh2D2mnTc8Jl2ZWpjOASYSwOZ+pM3qx1LWhVrTjR3NxZIMMlQ7uygE2GxjwolCVaknMDHXJw== - -"@swc/core-win32-x64-msvc@1.2.154": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.154.tgz#70566e0bcd36fe5b7c860cd6e6f047ad9eb30ab6" - integrity sha512-8+x7yoLsw42VE/9b92yCigpmodMlKaMbUvmVtXFcmx/KpzdUpgN+5e4XfljkmYTBZTSYbwqGM8K2jceGsfZmLg== - -"@swc/core@^1.2.119", "@swc/core@^1.2.143", "@swc/core@^1.2.146": - version "1.2.154" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.2.154.tgz#114375f9dbc46c432662568714c00b2895082353" - integrity sha512-Wz61emNkLRnnbBriqV2DEn4oqfsanKeT5OrBw1ZpIXlZ1qx5h3ft5yuJm0jvSBj+oiTeX+BZcE4f2VEwE1xvqQ== +"@swc/core-android-arm-eabi@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.159.tgz#020b3a018ba912d90f0630ca8171cb1993377433" + integrity sha512-OIHGUjHIgow0TRWQpoKzAKAzdOmZPK/aVSkctWdMJvAc0Oj6yxlj35UfOtdifJJxRej/KEMZpFeQTJ69ezycuQ== + +"@swc/core-android-arm64@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.2.159.tgz#438c396b01d4371e36ac4ff2f917e425df927a7b" + integrity sha512-zKMq4/a62usmD+CTEpyNNN57LBGHJMK2s2KDcU7Vu/tHoHKGkFYQi7PYBw3t6+tCyPfwoo20NONOiYZv6dm36Q== + +"@swc/core-darwin-arm64@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.159.tgz#58eb17200621c29ff5757f43478c87bab5166e0b" + integrity sha512-vZJmK7Baph2UCUIrArEt4RxnvK87OF8TSUe8VNgYPIFtoCEA6ttKXnndCI5kUKPvakpAg4NoHs1mm/x7gVZVVQ== + +"@swc/core-darwin-x64@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.2.159.tgz#fcf7ce53024c16255e91d10980fbda6799cc3476" + integrity sha512-hhJ336eq9QMv8PTnrCfY99xhdf8LH8RquLLfVV+XwbeXGF23fJJrsjQgv9rTC5aadIh6AxR2cHgCm4CGU/Xs0w== + +"@swc/core-freebsd-x64@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.159.tgz#84411aa22ac584e2141cfb8de249cd9e52204084" + integrity sha512-ZwJcA38AEmQp4OCkYOZD/5FjSU1VEMX/iMISEGUwDEE7d4CypFFP3mCpk5JAVEWJIhdYjgfo2SY8v9PfoSmBDg== + +"@swc/core-linux-arm-gnueabihf@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.159.tgz#744fad70e871ac045867b5a4eb76d216d86b6b69" + integrity sha512-M1QF8BBrbuXkw+T8U4xjMhGvjog83pA40PfZknGk+czQFJcNo4mq5hxMPalRbLN6olMoZNI6EM5a6zSocoDXEg== + +"@swc/core-linux-arm64-gnu@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.159.tgz#ab324d79871ba4414e84a9e7e1c7399483079c39" + integrity sha512-1uCMSEfzXtJHnuQoYHuHvzmBQ4/YlEcPydRMpc8/nO/svRGAHUZPKIz887tNk0nVtlF4Kil/LTrG+Wqxrp9z7A== + +"@swc/core-linux-arm64-musl@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.159.tgz#a9f957666ea2603ce7865cf9ff91ce63c1ffbe7c" + integrity sha512-FE+LyayWD55ESq0bV40x+Lmse7UyI/hhfrO/wvEs3v97z+fRhzPvcPAw38MoW2DVazPw3GotuBIf6Y5XkFO+fg== + +"@swc/core-linux-x64-gnu@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.159.tgz#36d5483673a96649ac5898a3b4b864b3b036f536" + integrity sha512-O7pH2A+ENjCuvMuKjv6UoIBsmwAbrTi+45WFL1snqCDZw+4p3WutFUSlhEW72uI6CEdb4kfZG0lajW2/Qbkuvg== + +"@swc/core-linux-x64-musl@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.159.tgz#a74d026cdd59118b348c0cd2c2d889d2bea67ec5" + integrity sha512-Se1EccOiN4h8/SaTZFVp7VoSUNR7ENmAmpVNROKnfZGb589THpLlC5MZtp5EFYDaLjpLHypVeqw0OO4tgwsL4w== + +"@swc/core-win32-arm64-msvc@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.159.tgz#18488c44e09ad659cc9696ccd481f2dfd013ba61" + integrity sha512-nKv1ksT3+V3xhPRXFr5Eeg0b93dqpGzKIoC13WwC0jRYbD0/SZwwcTU/XUZcm4MWQI8CG+PwwhO3SLMo747eqw== + +"@swc/core-win32-ia32-msvc@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.159.tgz#2c22f15303a133f6651f6b89e360e00a7f23eb17" + integrity sha512-24khotmSwFF2rEUeXPdqaTSOrIylroEx8MfuyG1BxfYfol+B9QyG8YqDyz713YM9dJYgs7JKuSfkK8qGQ2MbYA== + +"@swc/core-win32-x64-msvc@1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.159.tgz#f6c052ea50cb026c3af0993a46e018c3cbc42da8" + integrity sha512-Z/hcfe1DRcOQgnxZcnYy8d4lxZi1IHI2FeeRwDWtKn28cSaPca1acZVb4qA0hSfqsftKo0zTgLro6oh9gWxFng== + +"@swc/core@^1.2.119", "@swc/core@^1.2.146", "@swc/core@^1.2.159": + version "1.2.159" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.2.159.tgz#e4c884a00c34c9b0ce4d2669d75b3f5d1c87aea9" + integrity sha512-y+z+c4IelqaxvpQrc8hYdEpuvP1BVS9Fe5t8P8/yyP1oSrJkrLibROX4dHujg4EekFQhPCUjA29NawC4D08IQA== optionalDependencies: - "@swc/core-android-arm-eabi" "1.2.154" - "@swc/core-android-arm64" "1.2.154" - "@swc/core-darwin-arm64" "1.2.154" - "@swc/core-darwin-x64" "1.2.154" - "@swc/core-freebsd-x64" "1.2.154" - "@swc/core-linux-arm-gnueabihf" "1.2.154" - "@swc/core-linux-arm64-gnu" "1.2.154" - "@swc/core-linux-arm64-musl" "1.2.154" - "@swc/core-linux-x64-gnu" "1.2.154" - "@swc/core-linux-x64-musl" "1.2.154" - "@swc/core-win32-arm64-msvc" "1.2.154" - "@swc/core-win32-ia32-msvc" "1.2.154" - "@swc/core-win32-x64-msvc" "1.2.154" - -"@swc/jest@^0.2.17": + "@swc/core-android-arm-eabi" "1.2.159" + "@swc/core-android-arm64" "1.2.159" + "@swc/core-darwin-arm64" "1.2.159" + "@swc/core-darwin-x64" "1.2.159" + "@swc/core-freebsd-x64" "1.2.159" + "@swc/core-linux-arm-gnueabihf" "1.2.159" + "@swc/core-linux-arm64-gnu" "1.2.159" + "@swc/core-linux-arm64-musl" "1.2.159" + "@swc/core-linux-x64-gnu" "1.2.159" + "@swc/core-linux-x64-musl" "1.2.159" + "@swc/core-win32-arm64-msvc" "1.2.159" + "@swc/core-win32-ia32-msvc" "1.2.159" + "@swc/core-win32-x64-msvc" "1.2.159" + +"@swc/jest@^0.2.20": version "0.2.20" resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.20.tgz#2bddb4348fb730296b86cdcd96748be131b11395" integrity sha512-5qSUBYY1wyIMn7p0Vl9qqV4hMI69oJwZCIPUpBsTFWN2wlwn6RDugzdgCn+bLXVYh+Cxi8bJcZ1uumDgsoL+FA==