@nest-boot/eslint-plugin 7.0.4 → 7.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/dist/rules/graphql/graphql-field-config-from-types.d.ts +3 -1
  4. package/dist/rules/graphql/graphql-field-config-from-types.js +39 -41
  5. package/dist/rules/graphql/graphql-field-config-from-types.js.map +1 -1
  6. package/dist/rules/graphql/graphql-field-definite-assignment.d.ts +3 -1
  7. package/dist/rules/graphql/graphql-field-definite-assignment.js +13 -13
  8. package/dist/rules/graphql/graphql-field-definite-assignment.js.map +1 -1
  9. package/dist/rules/import/import-bullmq.d.ts +3 -1
  10. package/dist/rules/import/import-bullmq.js +4 -4
  11. package/dist/rules/import/import-bullmq.js.map +1 -1
  12. package/dist/rules/import/import-graphql.d.ts +3 -1
  13. package/dist/rules/import/import-graphql.js +4 -4
  14. package/dist/rules/import/import-graphql.js.map +1 -1
  15. package/dist/rules/import/import-mikro-orm.d.ts +3 -1
  16. package/dist/rules/import/import-mikro-orm.js +4 -4
  17. package/dist/rules/import/import-mikro-orm.js.map +1 -1
  18. package/dist/rules/index.d.ts +21 -7
  19. package/dist/rules/mikro-orm/entity-field-definite-assignment.d.ts +3 -1
  20. package/dist/rules/mikro-orm/entity-field-definite-assignment.js +10 -10
  21. package/dist/rules/mikro-orm/entity-field-definite-assignment.js.map +1 -1
  22. package/dist/rules/mikro-orm/entity-property-config-from-types.d.ts +3 -1
  23. package/dist/rules/mikro-orm/entity-property-config-from-types.js +106 -106
  24. package/dist/rules/mikro-orm/entity-property-config-from-types.js.map +1 -1
  25. package/dist/tsconfig.build.tsbuildinfo +1 -1
  26. package/dist/utils/createRule.d.ts +3 -1
  27. package/dist/utils/decorators.d.ts +16 -16
  28. package/dist/utils/decorators.js +16 -16
  29. package/package.json +14 -9
  30. package/src/rules/graphql/graphql-field-config-from-types.spec.ts +18 -18
  31. package/src/rules/graphql/graphql-field-config-from-types.ts +40 -44
  32. package/src/rules/graphql/graphql-field-definite-assignment.spec.ts +11 -11
  33. package/src/rules/graphql/graphql-field-definite-assignment.ts +13 -13
  34. package/src/rules/import/import-bullmq.spec.ts +9 -9
  35. package/src/rules/import/import-bullmq.ts +5 -4
  36. package/src/rules/import/import-graphql.spec.ts +8 -8
  37. package/src/rules/import/import-graphql.ts +4 -4
  38. package/src/rules/import/import-mikro-orm.spec.ts +8 -8
  39. package/src/rules/import/import-mikro-orm.ts +4 -4
  40. package/src/rules/mikro-orm/entity-field-definite-assignment.spec.ts +18 -18
  41. package/src/rules/mikro-orm/entity-field-definite-assignment.ts +10 -10
  42. package/src/rules/mikro-orm/entity-property-config-from-types.spec.ts +22 -22
  43. package/src/rules/mikro-orm/entity-property-config-from-types.ts +111 -110
  44. package/src/utils/decorators.ts +16 -16
  45. package/tsconfig.json +0 -1
@@ -3,7 +3,7 @@ import rule from "./graphql-field-definite-assignment";
3
3
 
4
4
  tester.run("graphql-field-definite-assignment", rule, {
5
5
  valid: [
6
- // 有初始化值的属性,不需要 !
6
+ // Property with initializer, no ! needed
7
7
  /* typescript */ `
8
8
  @ObjectType()
9
9
  class User {
@@ -11,7 +11,7 @@ tester.run("graphql-field-definite-assignment", rule, {
11
11
  createdAt: Date = new Date();
12
12
  }
13
13
  `,
14
- // ! 的属性,没有初始化值
14
+ // Property with !, no initializer
15
15
  /* typescript */ `
16
16
  @ObjectType()
17
17
  class User {
@@ -19,7 +19,7 @@ tester.run("graphql-field-definite-assignment", rule, {
19
19
  name!: string;
20
20
  }
21
21
  `,
22
- // 可选属性,不需要 !
22
+ // Optional property, no ! needed
23
23
  /* typescript */ `
24
24
  @ObjectType()
25
25
  class User {
@@ -27,7 +27,7 @@ tester.run("graphql-field-definite-assignment", rule, {
27
27
  age?: number;
28
28
  }
29
29
  `,
30
- // InputType 类型
30
+ // InputType class
31
31
  /* typescript */ `
32
32
  @InputType()
33
33
  class CreateUserInput {
@@ -35,7 +35,7 @@ tester.run("graphql-field-definite-assignment", rule, {
35
35
  name!: string;
36
36
  }
37
37
  `,
38
- // ArgsType 类型
38
+ // ArgsType class
39
39
  /* typescript */ `
40
40
  @ArgsType()
41
41
  class GetUserArgs {
@@ -43,14 +43,14 @@ tester.run("graphql-field-definite-assignment", rule, {
43
43
  id!: string;
44
44
  }
45
45
  `,
46
- // GraphQL 模型类不检查
46
+ // Non-GraphQL model class is not checked
47
47
  /* typescript */ `
48
48
  class NotAGraphQLModel {
49
49
  @Field()
50
50
  field: string;
51
51
  }
52
52
  `,
53
- // 没有 @Field 装饰器不检查
53
+ // Property without @Field decorator is not checked
54
54
  /* typescript */ `
55
55
  @ObjectType()
56
56
  class User {
@@ -59,7 +59,7 @@ tester.run("graphql-field-definite-assignment", rule, {
59
59
  `,
60
60
  ],
61
61
  invalid: [
62
- // 没有初始化值,也没有 !
62
+ // No initializer and no !
63
63
  {
64
64
  code: /* typescript */ `
65
65
  @ObjectType()
@@ -77,7 +77,7 @@ tester.run("graphql-field-definite-assignment", rule, {
77
77
  `,
78
78
  errors: [{ messageId: "addDefiniteAssignment" }],
79
79
  },
80
- // 有初始化值,但也有 !
80
+ // Has initializer but also has !
81
81
  {
82
82
  code: /* typescript */ `
83
83
  @ObjectType()
@@ -95,7 +95,7 @@ tester.run("graphql-field-definite-assignment", rule, {
95
95
  `,
96
96
  errors: [{ messageId: "removeDefiniteAssignment" }],
97
97
  },
98
- // InputType - 没有初始化值,也没有 !
98
+ // InputType - no initializer and no !
99
99
  {
100
100
  code: /* typescript */ `
101
101
  @InputType()
@@ -113,7 +113,7 @@ tester.run("graphql-field-definite-assignment", rule, {
113
113
  `,
114
114
  errors: [{ messageId: "addDefiniteAssignment" }],
115
115
  },
116
- // 数字类型,没有初始化值和 !
116
+ // Number type, no initializer and no !
117
117
  {
118
118
  code: /* typescript */ `
119
119
  @ObjectType()
@@ -15,15 +15,15 @@ export default createRule<
15
15
  type: "problem",
16
16
  docs: {
17
17
  description:
18
- "确保 GraphQL @Field 装饰器的属性正确使用 definite assignment assertion (!)。没有初始化值的属性应添加 !,有初始化值的属性应移除 !。",
18
+ "Ensures that properties with the GraphQL @Field decorator correctly use the definite assignment assertion (!). Properties without initializers should have !, and properties with initializers should not have !.",
19
19
  },
20
20
  fixable: "code",
21
21
  schema: [],
22
22
  messages: {
23
23
  addDefiniteAssignment:
24
- "属性 '{{propertyName}}' 使用了 @Field 装饰器但没有初始化值,应添加 definite assignment assertion (!)",
24
+ "Property '{{propertyName}}' has a @Field decorator but no initializer, it should have a definite assignment assertion (!).",
25
25
  removeDefiniteAssignment:
26
- "属性 '{{propertyName}}' 使用了 @Field 装饰器且有初始化值,应移除 definite assignment assertion (!)",
26
+ "Property '{{propertyName}}' has a @Field decorator and an initializer, the definite assignment assertion (!) should be removed.",
27
27
  },
28
28
  },
29
29
  defaultOptions: [],
@@ -56,10 +56,10 @@ export default createRule<
56
56
  const isOptionalProperty = (
57
57
  member: TSESTree.PropertyDefinition,
58
58
  ): boolean => {
59
- // 检查 AST 节点的 optional 标记
59
+ // Check the AST node's optional flag
60
60
  if (member.optional) return true;
61
61
 
62
- // 检查源代码中是否有 ? 符号(在属性名和冒号之间)
62
+ // Check if there is a ? symbol in the source code (between property name and colon)
63
63
  const keyEnd = member.key.range[1];
64
64
  const text = source.text;
65
65
  for (let i = keyEnd; i < member.range[1]; i++) {
@@ -81,13 +81,13 @@ export default createRule<
81
81
  const propertyName = getPropertyName(member);
82
82
  if (!propertyName) return;
83
83
 
84
- // 可选属性(?:)不需要 definite assignment assertion
84
+ // Optional properties (?:) do not need a definite assignment assertion
85
85
  if (isOptionalProperty(member)) return;
86
86
 
87
87
  const hasInit = hasInitializer(member);
88
88
  const hasDefinite = hasDefiniteAssignment(member);
89
89
 
90
- // 情况1: 没有初始化值,但也没有 definite assignment assertion
90
+ // Case 1: No initializer and no definite assignment assertion
91
91
  if (!hasInit && !hasDefinite) {
92
92
  context.report({
93
93
  node: member,
@@ -96,15 +96,15 @@ export default createRule<
96
96
  propertyName,
97
97
  },
98
98
  fix: (fixer) => {
99
- // 找到属性名称的结束位置
99
+ // Find the end position of the property name
100
100
  const keyEnd = member.key.range[1];
101
- // 在属性名称后添加 !
101
+ // Insert ! after the property name
102
102
  return fixer.insertTextAfterRange([keyEnd, keyEnd], "!");
103
103
  },
104
104
  });
105
105
  }
106
106
 
107
- // 情况2: 有初始化值,但也有 definite assignment assertion
107
+ // Case 2: Has initializer but also has definite assignment assertion
108
108
  if (hasInit && hasDefinite) {
109
109
  context.report({
110
110
  node: member,
@@ -113,18 +113,18 @@ export default createRule<
113
113
  propertyName,
114
114
  },
115
115
  fix: (fixer) => {
116
- // 找到 ! 的位置并移除
116
+ // Find and remove the ! position
117
117
  const keyEnd = member.key.range[1];
118
118
  const text = source.text;
119
119
 
120
- // 查找 ! 的位置(在属性名称和冒号之间)
120
+ // Find the ! position (between the property name and the colon)
121
121
  let exclamationPos = -1;
122
122
  for (let i = keyEnd; i < member.range[1]; i++) {
123
123
  if (text[i] === "!") {
124
124
  exclamationPos = i;
125
125
  break;
126
126
  }
127
- // 如果遇到冒号,说明没有 !
127
+ // If we encounter a colon, there is no !
128
128
  if (text[i] === ":") {
129
129
  break;
130
130
  }
@@ -3,29 +3,29 @@ import rule from "./import-bullmq";
3
3
 
4
4
  tester.run("import-bullmq", rule, {
5
5
  valid: [
6
- // 正确的导入来源
6
+ // Correct import source
7
7
  /* typescript */ `
8
8
  import { BullModule } from "@nest-boot/bullmq";
9
9
  `,
10
- // 从其他包导入
10
+ // Importing from another package
11
11
  /* typescript */ `
12
12
  import { Module } from "@nestjs/common";
13
13
  `,
14
- // 命名导入
14
+ // Named import
15
15
  /* typescript */ `
16
16
  import { InjectQueue, Processor } from "@nest-boot/bullmq";
17
17
  `,
18
- // 默认导入
18
+ // Default import
19
19
  /* typescript */ `
20
20
  import BullMQ from "@nest-boot/bullmq";
21
21
  `,
22
- // bullmq 核心包导入(不应该被替换)
22
+ // Importing from bullmq core package (should not be replaced)
23
23
  /* typescript */ `
24
24
  import { Queue, Worker } from "bullmq";
25
25
  `,
26
26
  ],
27
27
  invalid: [
28
- // @nestjs/bullmq 导入,应该替换为 @nest-boot/bullmq
28
+ // Importing from @nestjs/bullmq, should be replaced with @nest-boot/bullmq
29
29
  {
30
30
  code: /* typescript */ `
31
31
  import { BullModule } from "@nestjs/bullmq";
@@ -35,7 +35,7 @@ tester.run("import-bullmq", rule, {
35
35
  `,
36
36
  errors: [{ messageId: "replaceBullmqImport" }],
37
37
  },
38
- // Processor 相关导入
38
+ // Processor related imports
39
39
  {
40
40
  code: /* typescript */ `
41
41
  import { Processor, InjectQueue } from "@nestjs/bullmq";
@@ -45,7 +45,7 @@ tester.run("import-bullmq", rule, {
45
45
  `,
46
46
  errors: [{ messageId: "replaceBullmqImport" }],
47
47
  },
48
- // 类型导入
48
+ // Type import
49
49
  {
50
50
  code: /* typescript */ `
51
51
  import type { BullModuleOptions } from "@nestjs/bullmq";
@@ -55,7 +55,7 @@ tester.run("import-bullmq", rule, {
55
55
  `,
56
56
  errors: [{ messageId: "replaceBullmqImport" }],
57
57
  },
58
- // 装饰器导入
58
+ // Decorator imports
59
59
  {
60
60
  code: /* typescript */ `
61
61
  import { OnQueueActive, OnQueueCompleted } from "@nestjs/bullmq";
@@ -6,25 +6,26 @@ export default createRule({
6
6
  type: "problem",
7
7
  docs: {
8
8
  description:
9
- "将从 @nestjs/bullmq 导入的包修复为从 @nest-boot/bullmq 导入",
9
+ "Fix imports from @nestjs/bullmq to use @nest-boot/bullmq instead",
10
10
  },
11
11
  fixable: "code",
12
12
  schema: [],
13
13
  messages: {
14
- replaceBullmqImport: "应从 @nest-boot/bullmq 导入,而不是 @nestjs/bullmq",
14
+ replaceBullmqImport:
15
+ "Should import from @nest-boot/bullmq instead of @nestjs/bullmq",
15
16
  },
16
17
  },
17
18
  defaultOptions: [],
18
19
  create(context) {
19
20
  return {
20
21
  ImportDeclaration(node) {
21
- // 检查是否从 @nestjs/bullmq 导入
22
+ // Check if importing from @nestjs/bullmq
22
23
  if (node.source.value === "@nestjs/bullmq") {
23
24
  context.report({
24
25
  node,
25
26
  messageId: "replaceBullmqImport",
26
27
  fix(fixer) {
27
- // 将导入源替换为 @nest-boot/bullmq
28
+ // Replace import source with @nest-boot/bullmq
28
29
  return fixer.replaceText(node.source, '"@nest-boot/bullmq"');
29
30
  },
30
31
  });
@@ -3,25 +3,25 @@ import rule from "./import-graphql";
3
3
 
4
4
  tester.run("import-graphql", rule, {
5
5
  valid: [
6
- // 正确的导入来源
6
+ // Correct import source
7
7
  /* typescript */ `
8
8
  import { Field, ObjectType } from "@nest-boot/graphql";
9
9
  `,
10
- // 从其他包导入
10
+ // Importing from another package
11
11
  /* typescript */ `
12
12
  import { Module } from "@nestjs/common";
13
13
  `,
14
- // 命名导入
14
+ // Named import
15
15
  /* typescript */ `
16
16
  import { Resolver, Query } from "@nest-boot/graphql";
17
17
  `,
18
- // 默认导入
18
+ // Default import
19
19
  /* typescript */ `
20
20
  import GraphQL from "@nest-boot/graphql";
21
21
  `,
22
22
  ],
23
23
  invalid: [
24
- // @nestjs/graphql 导入,应该替换为 @nest-boot/graphql
24
+ // Importing from @nestjs/graphql, should be replaced with @nest-boot/graphql
25
25
  {
26
26
  code: /* typescript */ `
27
27
  import { Field, ObjectType } from "@nestjs/graphql";
@@ -31,7 +31,7 @@ tester.run("import-graphql", rule, {
31
31
  `,
32
32
  errors: [{ messageId: "replaceGraphqlImport" }],
33
33
  },
34
- // Resolver 相关导入
34
+ // Resolver related imports
35
35
  {
36
36
  code: /* typescript */ `
37
37
  import { Resolver, Query, Mutation } from "@nestjs/graphql";
@@ -41,7 +41,7 @@ tester.run("import-graphql", rule, {
41
41
  `,
42
42
  errors: [{ messageId: "replaceGraphqlImport" }],
43
43
  },
44
- // 类型导入
44
+ // Type import
45
45
  {
46
46
  code: /* typescript */ `
47
47
  import type { GraphQLModule } from "@nestjs/graphql";
@@ -51,7 +51,7 @@ tester.run("import-graphql", rule, {
51
51
  `,
52
52
  errors: [{ messageId: "replaceGraphqlImport" }],
53
53
  },
54
- // 混合导入
54
+ // Mixed imports
55
55
  {
56
56
  code: /* typescript */ `
57
57
  import { Args, Int } from "@nestjs/graphql";
@@ -6,26 +6,26 @@ export default createRule({
6
6
  type: "problem",
7
7
  docs: {
8
8
  description:
9
- "将从 @nestjs/graphql 导入的包修复为从 @nest-boot/graphql 导入",
9
+ "Fix imports from @nestjs/graphql to use @nest-boot/graphql instead",
10
10
  },
11
11
  fixable: "code",
12
12
  schema: [],
13
13
  messages: {
14
14
  replaceGraphqlImport:
15
- "应从 @nest-boot/graphql 导入,而不是 @nestjs/graphql",
15
+ "Should import from @nest-boot/graphql instead of @nestjs/graphql",
16
16
  },
17
17
  },
18
18
  defaultOptions: [],
19
19
  create(context) {
20
20
  return {
21
21
  ImportDeclaration(node) {
22
- // 检查是否从 @nestjs/graphql 导入
22
+ // Check if importing from @nestjs/graphql
23
23
  if (node.source.value === "@nestjs/graphql") {
24
24
  context.report({
25
25
  node,
26
26
  messageId: "replaceGraphqlImport",
27
27
  fix(fixer) {
28
- // 将导入源替换为 @nest-boot/graphql
28
+ // Replace import source with @nest-boot/graphql
29
29
  return fixer.replaceText(node.source, '"@nest-boot/graphql"');
30
30
  },
31
31
  });
@@ -3,25 +3,25 @@ import rule from "./import-mikro-orm";
3
3
 
4
4
  tester.run("import-mikro-orm", rule, {
5
5
  valid: [
6
- // 正确的导入来源
6
+ // Correct import source
7
7
  /* typescript */ `
8
8
  import { MikroOrmModule } from "@nest-boot/mikro-orm";
9
9
  `,
10
- // 从其他包导入
10
+ // Importing from another package
11
11
  /* typescript */ `
12
12
  import { Module } from "@nestjs/common";
13
13
  `,
14
- // @mikro-orm/core 导入(不应该被替换)
14
+ // Importing from @mikro-orm/core (should not be replaced)
15
15
  /* typescript */ `
16
16
  import { Entity, Property } from "@mikro-orm/core";
17
17
  `,
18
- // 命名导入
18
+ // Named import
19
19
  /* typescript */ `
20
20
  import { InjectRepository } from "@nest-boot/mikro-orm";
21
21
  `,
22
22
  ],
23
23
  invalid: [
24
- // @mikro-orm/nestjs 导入,应该替换为 @nest-boot/mikro-orm
24
+ // Importing from @mikro-orm/nestjs, should be replaced with @nest-boot/mikro-orm
25
25
  {
26
26
  code: /* typescript */ `
27
27
  import { MikroOrmModule } from "@mikro-orm/nestjs";
@@ -31,7 +31,7 @@ tester.run("import-mikro-orm", rule, {
31
31
  `,
32
32
  errors: [{ messageId: "replaceMikroOrmImport" }],
33
33
  },
34
- // InjectRepository 导入
34
+ // InjectRepository import
35
35
  {
36
36
  code: /* typescript */ `
37
37
  import { InjectRepository } from "@mikro-orm/nestjs";
@@ -41,7 +41,7 @@ tester.run("import-mikro-orm", rule, {
41
41
  `,
42
42
  errors: [{ messageId: "replaceMikroOrmImport" }],
43
43
  },
44
- // 类型导入
44
+ // Type import
45
45
  {
46
46
  code: /* typescript */ `
47
47
  import type { MikroOrmModuleOptions } from "@mikro-orm/nestjs";
@@ -51,7 +51,7 @@ tester.run("import-mikro-orm", rule, {
51
51
  `,
52
52
  errors: [{ messageId: "replaceMikroOrmImport" }],
53
53
  },
54
- // 混合导入
54
+ // Mixed imports
55
55
  {
56
56
  code: /* typescript */ `
57
57
  import { MikroOrmModule, InjectRepository } from "@mikro-orm/nestjs";
@@ -6,26 +6,26 @@ export default createRule({
6
6
  type: "problem",
7
7
  docs: {
8
8
  description:
9
- "将从 @mikro-orm/nestjs 导入的包修复为从 @nest-boot/mikro-orm 导入",
9
+ "Fix imports from @mikro-orm/nestjs to use @nest-boot/mikro-orm instead",
10
10
  },
11
11
  fixable: "code",
12
12
  schema: [],
13
13
  messages: {
14
14
  replaceMikroOrmImport:
15
- "应从 @nest-boot/mikro-orm 导入,而不是 @mikro-orm/nestjs",
15
+ "Should import from @nest-boot/mikro-orm instead of @mikro-orm/nestjs",
16
16
  },
17
17
  },
18
18
  defaultOptions: [],
19
19
  create(context) {
20
20
  return {
21
21
  ImportDeclaration(node) {
22
- // 检查是否从 @mikro-orm/nestjs 导入
22
+ // Check if importing from @mikro-orm/nestjs
23
23
  if (node.source.value === "@mikro-orm/nestjs") {
24
24
  context.report({
25
25
  node,
26
26
  messageId: "replaceMikroOrmImport",
27
27
  fix(fixer) {
28
- // 将导入源替换为 @nest-boot/mikro-orm
28
+ // Replace import source with @nest-boot/mikro-orm
29
29
  return fixer.replaceText(node.source, '"@nest-boot/mikro-orm"');
30
30
  },
31
31
  });
@@ -3,7 +3,7 @@ import rule from "./entity-field-definite-assignment";
3
3
 
4
4
  tester.run("entity-field-definite-assignment", rule, {
5
5
  valid: [
6
- // 有初始化值的属性,不需要 !
6
+ // Property with initializer, no ! needed
7
7
  /* typescript */ `
8
8
  @Entity()
9
9
  class User {
@@ -11,7 +11,7 @@ tester.run("entity-field-definite-assignment", rule, {
11
11
  createdAt: Date = new Date();
12
12
  }
13
13
  `,
14
- // ! 的属性,没有初始化值
14
+ // Property with !, no initializer
15
15
  /* typescript */ `
16
16
  @Entity()
17
17
  class User {
@@ -19,7 +19,7 @@ tester.run("entity-field-definite-assignment", rule, {
19
19
  name!: string;
20
20
  }
21
21
  `,
22
- // 可选属性,不需要 !
22
+ // Optional property, no ! needed
23
23
  /* typescript */ `
24
24
  @Entity()
25
25
  class User {
@@ -27,7 +27,7 @@ tester.run("entity-field-definite-assignment", rule, {
27
27
  age?: number;
28
28
  }
29
29
  `,
30
- // 可空属性且有初始化值
30
+ // Nullable property with initializer
31
31
  /* typescript */ `
32
32
  @Entity()
33
33
  class User {
@@ -35,21 +35,21 @@ tester.run("entity-field-definite-assignment", rule, {
35
35
  name: string | null = null;
36
36
  }
37
37
  `,
38
- // Entity 类不检查
38
+ // Non-Entity class is not checked
39
39
  /* typescript */ `
40
40
  class NotAnEntity {
41
41
  @Property()
42
42
  field: string;
43
43
  }
44
44
  `,
45
- // 没有 @Property 装饰器不检查
45
+ // Property without @Property decorator is not checked
46
46
  /* typescript */ `
47
47
  @Entity()
48
48
  class User {
49
49
  field: string;
50
50
  }
51
51
  `,
52
- // @Enum 装饰器 - !
52
+ // @Enum decorator - with !
53
53
  /* typescript */ `
54
54
  @Entity()
55
55
  class User {
@@ -57,7 +57,7 @@ tester.run("entity-field-definite-assignment", rule, {
57
57
  role!: UserRole;
58
58
  }
59
59
  `,
60
- // @OneToOne 装饰器 - 使用 Ref
60
+ // @OneToOne decorator - using Ref
61
61
  /* typescript */ `
62
62
  @Entity()
63
63
  class User {
@@ -65,7 +65,7 @@ tester.run("entity-field-definite-assignment", rule, {
65
65
  profile!: Ref<Profile>;
66
66
  }
67
67
  `,
68
- // @OneToMany 装饰器 - 使用 Collection 初始化
68
+ // @OneToMany decorator - initialized with Collection
69
69
  /* typescript */ `
70
70
  @Entity()
71
71
  class User {
@@ -73,7 +73,7 @@ tester.run("entity-field-definite-assignment", rule, {
73
73
  posts = new Collection<Post>(this);
74
74
  }
75
75
  `,
76
- // @ManyToOne 装饰器 - 使用 Ref
76
+ // @ManyToOne decorator - using Ref
77
77
  /* typescript */ `
78
78
  @Entity()
79
79
  class Post {
@@ -81,7 +81,7 @@ tester.run("entity-field-definite-assignment", rule, {
81
81
  author!: Ref<User>;
82
82
  }
83
83
  `,
84
- // @ManyToMany 装饰器 - 使用 Collection 初始化
84
+ // @ManyToMany decorator - initialized with Collection
85
85
  /* typescript */ `
86
86
  @Entity()
87
87
  class User {
@@ -91,7 +91,7 @@ tester.run("entity-field-definite-assignment", rule, {
91
91
  `,
92
92
  ],
93
93
  invalid: [
94
- // 没有初始化值,也没有 !
94
+ // No initializer and no !
95
95
  {
96
96
  code: /* typescript */ `
97
97
  @Entity()
@@ -109,7 +109,7 @@ tester.run("entity-field-definite-assignment", rule, {
109
109
  `,
110
110
  errors: [{ messageId: "addDefiniteAssignment" }],
111
111
  },
112
- // 有初始化值,但也有 !
112
+ // Has initializer but also has !
113
113
  {
114
114
  code: /* typescript */ `
115
115
  @Entity()
@@ -127,7 +127,7 @@ tester.run("entity-field-definite-assignment", rule, {
127
127
  `,
128
128
  errors: [{ messageId: "removeDefiniteAssignment" }],
129
129
  },
130
- // @Enum 装饰器 - 没有初始化值,也没有 !
130
+ // @Enum decorator - no initializer and no !
131
131
  {
132
132
  code: /* typescript */ `
133
133
  @Entity()
@@ -145,7 +145,7 @@ tester.run("entity-field-definite-assignment", rule, {
145
145
  `,
146
146
  errors: [{ messageId: "addDefiniteAssignment" }],
147
147
  },
148
- // @OneToOne 装饰器 - 没有初始化值,也没有 ! (使用 Ref)
148
+ // @OneToOne decorator - no initializer and no ! (using Ref)
149
149
  {
150
150
  code: /* typescript */ `
151
151
  @Entity()
@@ -163,7 +163,7 @@ tester.run("entity-field-definite-assignment", rule, {
163
163
  `,
164
164
  errors: [{ messageId: "addDefiniteAssignment" }],
165
165
  },
166
- // @OneToMany 装饰器 - 有初始化值,但也有 ! (使用 Collection)
166
+ // @OneToMany decorator - has initializer but also has ! (using Collection)
167
167
  {
168
168
  code: /* typescript */ `
169
169
  @Entity()
@@ -181,7 +181,7 @@ tester.run("entity-field-definite-assignment", rule, {
181
181
  `,
182
182
  errors: [{ messageId: "removeDefiniteAssignment" }],
183
183
  },
184
- // @ManyToOne 装饰器 - 没有初始化值,也没有 ! (使用 Ref)
184
+ // @ManyToOne decorator - no initializer and no ! (using Ref)
185
185
  {
186
186
  code: /* typescript */ `
187
187
  @Entity()
@@ -199,7 +199,7 @@ tester.run("entity-field-definite-assignment", rule, {
199
199
  `,
200
200
  errors: [{ messageId: "addDefiniteAssignment" }],
201
201
  },
202
- // @ManyToMany 装饰器 - 有初始化值,但也有 ! (使用 Collection)
202
+ // @ManyToMany decorator - has initializer but also has ! (using Collection)
203
203
  {
204
204
  code: /* typescript */ `
205
205
  @Entity()