Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ast-spec): add TSQualifiedName to TypeNode union #5906

Merged
merged 2 commits into from Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/ast-spec/src/unions/TypeNode.ts
Expand Up @@ -25,6 +25,7 @@ import type { TSOptionalType } from '../type/TSOptionalType/spec';
import type { TSPrivateKeyword } from '../type/TSPrivateKeyword/spec';
import type { TSProtectedKeyword } from '../type/TSProtectedKeyword/spec';
import type { TSPublicKeyword } from '../type/TSPublicKeyword/spec';
import type { TSQualifiedName } from '../type/TSQualifiedName/spec';
import type { TSReadonlyKeyword } from '../type/TSReadonlyKeyword/spec';
import type { TSRestType } from '../type/TSRestType/spec';
import type { TSStaticKeyword } from '../type/TSStaticKeyword/spec';
Expand Down Expand Up @@ -71,6 +72,7 @@ export type TypeNode =
| TSPrivateKeyword
| TSProtectedKeyword
| TSPublicKeyword
| TSQualifiedName
| TSReadonlyKeyword
| TSRestType
| TSStaticKeyword
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/rules/sort-type-constituents.ts
Expand Up @@ -60,6 +60,7 @@ function getGroup(node: TSESTree.TypeNode): Group {
case AST_NODE_TYPES.TSIndexedAccessType:
case AST_NODE_TYPES.TSInferType:
case AST_NODE_TYPES.TSTypeReference:
case AST_NODE_TYPES.TSQualifiedName:
return Group.named;

case AST_NODE_TYPES.TSMappedType:
Expand Down
Expand Up @@ -60,6 +60,7 @@ function getGroup(node: TSESTree.TypeNode): Group {
case AST_NODE_TYPES.TSIndexedAccessType:
case AST_NODE_TYPES.TSInferType:
case AST_NODE_TYPES.TSTypeReference:
case AST_NODE_TYPES.TSQualifiedName:
return Group.named;

case AST_NODE_TYPES.TSMappedType:
Expand Down
Expand Up @@ -45,6 +45,8 @@ const valid = (operator: '|' | '&'): TSESLint.ValidTestCase<Options>[] => [
type T =
${operator} A
${operator} B
${operator} C.D
${operator} D.E
${operator} intrinsic
${operator} number[]
${operator} string[]
Expand Down Expand Up @@ -220,6 +222,8 @@ type T =
${operator} readonly number[]
${operator} string[]
${operator} number[]
${operator} D.E
${operator} C.D
${operator} B
${operator} A
${operator} undefined
Expand All @@ -229,7 +233,7 @@ type T =
`,
output: `
type T =
A ${operator} B ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined;
A ${operator} B ${operator} C.D ${operator} D.E ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined;
`,
errors: [
{
Expand Down
Expand Up @@ -45,6 +45,8 @@ const valid = (operator: '|' | '&'): TSESLint.ValidTestCase<Options>[] => [
type T =
${operator} A
${operator} B
${operator} C.D
${operator} D.E
${operator} intrinsic
${operator} number[]
${operator} string[]
Expand Down Expand Up @@ -220,6 +222,8 @@ type T =
${operator} readonly number[]
${operator} string[]
${operator} number[]
${operator} D.E
${operator} C.D
${operator} B
${operator} A
${operator} undefined
Expand All @@ -229,7 +233,7 @@ type T =
`,
output: `
type T =
A ${operator} B ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined;
A ${operator} B ${operator} C.D ${operator} D.E ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined;
`,
errors: [
{
Expand Down