diff --git a/linter-4.2/docs/rules/recipe121.md b/linter-4.2/docs/rules/recipe121.md index ce8d38e80089c630c5e0b50d18d1fd514abfad48..f1eb19786534f787a2a98ecbd796116d5892fcd8 100644 --- a/linter-4.2/docs/rules/recipe121.md +++ b/linter-4.2/docs/rules/recipe121.md @@ -32,4 +32,3 @@ Use regular ``import`` instead. - Recipe 126: ``export = ...`` assignment is not supported (``arkts-no-export-assignment``) - diff --git a/linter-4.2/docs/rules/recipe125.md b/linter-4.2/docs/rules/recipe125.md deleted file mode 100644 index b7409c6a512ccc9af59e51b4c30e9bcb1fe8b68c..0000000000000000000000000000000000000000 --- a/linter-4.2/docs/rules/recipe125.md +++ /dev/null @@ -1,62 +0,0 @@ -# Re-exporting is supported with restrictions - -Rule ``arkts-limited-reexport`` - -**Severity: error** - -ArkTS supports re-exporting syntax which covers most common cases of re-export: -re-exporting imported entities and re-exporting which is combined with renaming. -Other syntax flavors like ``export * as ...`` are not supported. - - -## TypeScript - - -``` - - // module1 - export class Class1 { - // ... - } - export class Class2 { - // ... - } - - // module2 - export * as utilities from "module1" - - // consumer module - import { utilities } from "module2" - -``` - -## ArkTS - - -``` - - // module1 - export class Class1 { - // ... - } - export class C2 { - // ... - } - - // module2 - export { Class1 } from "module1" - export { C2 as Class2 } from "module1" - - // Re-exporting by wild-card is also supported: - // export * from "module1" - - // consumer module - import { Class1, Class2 } from "module2" - -``` - -## See also - -- Recipe 126: ``export = ...`` assignment is not supported (``arkts-no-export-assignment``) - - diff --git a/linter-4.2/docs/rules/recipe126.md b/linter-4.2/docs/rules/recipe126.md index 5e4f7f9afa9dbdd4bb0f1e88fcc5f7c2cd03ca0a..59c5f912d65e7a9ef192608d9cdb616f4a18d353 100644 --- a/linter-4.2/docs/rules/recipe126.md +++ b/linter-4.2/docs/rules/recipe126.md @@ -49,6 +49,5 @@ Use regular ``export`` / ``import`` instead. ## See also - Recipe 121: ``require`` and ``import`` assignment are not supported (``arkts-no-require``) -- Recipe 125: Re-exporting is supported with restrictions (``arkts-limited-reexport``) diff --git a/linter-4.2/docs/rules/recipe128.md b/linter-4.2/docs/rules/recipe128.md index 35a88d0a6f7f677e43236501c8c3bcdae6f55b01..5ae2063ce762387e501fe41c8b37782ad65c7bbc 100644 --- a/linter-4.2/docs/rules/recipe128.md +++ b/linter-4.2/docs/rules/recipe128.md @@ -33,3 +33,4 @@ own mechanisms for interoperating with JavaScript. - Recipe 129: Wildcards in module names are not supported (``arkts-no-module-wildcards``) + diff --git a/linter-4.2/docs/rules/recipe135.md b/linter-4.2/docs/rules/recipe135.md index df981900ae4987a0ded2fb70884e61c5b54f4a7b..d317daf7502db2034fdaa0d958cb95dd5794c23b 100644 --- a/linter-4.2/docs/rules/recipe135.md +++ b/linter-4.2/docs/rules/recipe135.md @@ -14,14 +14,17 @@ Use regular syntax for namespaces instead. ``` - var C = (function() { - function C(n: number) { - this.p = n // Compile-time error only with noImplicitThis + const C = (function () { + class Cl { + static static_value = "static_value"; + static any_value: any = "any_value"; + string_field = "string_field"; } - C.staticProperty = 0 - return C - })() - C.staticProperty = 1 + + return Cl; + })(); + + C.prop = 2; ``` diff --git a/linter-4.2/docs/rules/recipe144.md b/linter-4.2/docs/rules/recipe144.md index bc9b4149f8945942aba1d6e4c3e3705f3c34bc3b..c861edb743a74319c42f121a95133c994f5a4a3d 100644 --- a/linter-4.2/docs/rules/recipe144.md +++ b/linter-4.2/docs/rules/recipe144.md @@ -17,14 +17,14 @@ Properties and functions of the global object: ``eval``, ``__lookupGetter__``, ``__lookupSetter__``, ``assign``, ``create``, ``defineProperties``, ``defineProperty``, ``entries``, ``freeze``, ``fromEntries``, ``getOwnPropertyDescriptor``, ``getOwnPropertyDescriptors``, -``getOwnPropertyNames``, ``getOwnPropertySymbols``, ``getPrototypeOf``, -``hasOwn``, ``hasOwnProperty``, ``is``, ``isExtensible``, ``isFrozen``, -``isPrototypeOf``, ``isSealed``, ``keys``, ``preventExtensions``, -``propertyIsEnumerable``, ``seal``, ``setPrototypeOf``, ``values`` +``getOwnPropertySymbols``, ``getPrototypeOf``, +``hasOwnProperty``, ``is``, ``isExtensible``, ``isFrozen``, +``isPrototypeOf``, ``isSealed``, ``preventExtensions``, +``propertyIsEnumerable``, ``seal``, ``setPrototypeOf`` ``Reflect``: ``apply``, ``construct``, ``defineProperty``, ``deleteProperty``, -``get``, ``getOwnPropertyDescriptor``, ``getPrototypeOf``, ``has``, -``isExtensible``, ``ownKeys``, ``preventExtensions``, ``set``, +``getOwnPropertyDescriptor``, ``getPrototypeOf``, +``isExtensible``, ``preventExtensions``, ``setPrototypeOf`` ``Proxy``: ``handler.apply()``, ``handler.construct()``, diff --git a/linter-4.2/docs/rules/recipe38.md b/linter-4.2/docs/rules/recipe38.md index a0fdb0a06e953ac517d0fe5c18d2dfa4af205d95..be488b74a3cfa43eac7211f7d943b097b7e7ca5a 100644 --- a/linter-4.2/docs/rules/recipe38.md +++ b/linter-4.2/docs/rules/recipe38.md @@ -141,6 +141,6 @@ specifically not supported in the following contexts: ## See also - Recipe 040: Object literals cannot be used as type declarations (``arkts-no-obj-literals-as-types``) -- Recipe 043: Array literals must contain elements of only inferrable types (``arkts-no-noninferrable-arr-literals``) +- Recipe 043: Array literals must contain elements of only inferable types (``arkts-no-noninferable-arr-literals``) diff --git a/linter-4.2/docs/rules/recipe40.md b/linter-4.2/docs/rules/recipe40.md index dd4221b1457b466a4de5876eb63a5733c817c18d..283c0b7759123e1fd46b0e4f32c5cb2f4089ca22 100644 --- a/linter-4.2/docs/rules/recipe40.md +++ b/linter-4.2/docs/rules/recipe40.md @@ -41,6 +41,6 @@ types in place. Declare classes and interfaces explicitly instead. ## See also - Recipe 038: Object literal must correspond to some explicitly declared class or interface (``arkts-no-untyped-obj-literals``) -- Recipe 043: Array literals must contain elements of only inferrable types (``arkts-no-noninferrable-arr-literals``) +- Recipe 043: Array literals must contain elements of only inferable types (``arkts-no-noninferable-arr-literals``) diff --git a/linter-4.2/docs/rules/recipe43.md b/linter-4.2/docs/rules/recipe43.md index b2ee2d200504ffbeb5be1e50dc1d50e5a9e72105..07d8d6e9ce05165e8f38cd83d6091700f960533b 100644 --- a/linter-4.2/docs/rules/recipe43.md +++ b/linter-4.2/docs/rules/recipe43.md @@ -1,12 +1,12 @@ -# Array literals must contain elements of only inferrable types +# Array literals must contain elements of only inferable types -Rule ``arkts-no-noninferrable-arr-literals`` +Rule ``arkts-no-noninferable-arr-literals`` **Severity: error** Basically, ArkTS infers the type of an array literal as a union type of its contents. However, a compile-time error occurs if there is at least one -element with a non-inferrable type (e.g. untyped object literal). +element with a non-inferable type (e.g. untyped object literal). ## TypeScript diff --git a/linter/docs/rules/recipe121.md b/linter/docs/rules/recipe121.md index ce8d38e80089c630c5e0b50d18d1fd514abfad48..f1eb19786534f787a2a98ecbd796116d5892fcd8 100644 --- a/linter/docs/rules/recipe121.md +++ b/linter/docs/rules/recipe121.md @@ -32,4 +32,3 @@ Use regular ``import`` instead. - Recipe 126: ``export = ...`` assignment is not supported (``arkts-no-export-assignment``) - diff --git a/linter/docs/rules/recipe125.md b/linter/docs/rules/recipe125.md deleted file mode 100644 index b7409c6a512ccc9af59e51b4c30e9bcb1fe8b68c..0000000000000000000000000000000000000000 --- a/linter/docs/rules/recipe125.md +++ /dev/null @@ -1,62 +0,0 @@ -# Re-exporting is supported with restrictions - -Rule ``arkts-limited-reexport`` - -**Severity: error** - -ArkTS supports re-exporting syntax which covers most common cases of re-export: -re-exporting imported entities and re-exporting which is combined with renaming. -Other syntax flavors like ``export * as ...`` are not supported. - - -## TypeScript - - -``` - - // module1 - export class Class1 { - // ... - } - export class Class2 { - // ... - } - - // module2 - export * as utilities from "module1" - - // consumer module - import { utilities } from "module2" - -``` - -## ArkTS - - -``` - - // module1 - export class Class1 { - // ... - } - export class C2 { - // ... - } - - // module2 - export { Class1 } from "module1" - export { C2 as Class2 } from "module1" - - // Re-exporting by wild-card is also supported: - // export * from "module1" - - // consumer module - import { Class1, Class2 } from "module2" - -``` - -## See also - -- Recipe 126: ``export = ...`` assignment is not supported (``arkts-no-export-assignment``) - - diff --git a/linter/docs/rules/recipe126.md b/linter/docs/rules/recipe126.md index 5e4f7f9afa9dbdd4bb0f1e88fcc5f7c2cd03ca0a..59c5f912d65e7a9ef192608d9cdb616f4a18d353 100644 --- a/linter/docs/rules/recipe126.md +++ b/linter/docs/rules/recipe126.md @@ -49,6 +49,5 @@ Use regular ``export`` / ``import`` instead. ## See also - Recipe 121: ``require`` and ``import`` assignment are not supported (``arkts-no-require``) -- Recipe 125: Re-exporting is supported with restrictions (``arkts-limited-reexport``) diff --git a/linter/docs/rules/recipe128.md b/linter/docs/rules/recipe128.md index 35a88d0a6f7f677e43236501c8c3bcdae6f55b01..5ae2063ce762387e501fe41c8b37782ad65c7bbc 100644 --- a/linter/docs/rules/recipe128.md +++ b/linter/docs/rules/recipe128.md @@ -33,3 +33,4 @@ own mechanisms for interoperating with JavaScript. - Recipe 129: Wildcards in module names are not supported (``arkts-no-module-wildcards``) + diff --git a/linter/docs/rules/recipe135.md b/linter/docs/rules/recipe135.md index df981900ae4987a0ded2fb70884e61c5b54f4a7b..d317daf7502db2034fdaa0d958cb95dd5794c23b 100644 --- a/linter/docs/rules/recipe135.md +++ b/linter/docs/rules/recipe135.md @@ -14,14 +14,17 @@ Use regular syntax for namespaces instead. ``` - var C = (function() { - function C(n: number) { - this.p = n // Compile-time error only with noImplicitThis + const C = (function () { + class Cl { + static static_value = "static_value"; + static any_value: any = "any_value"; + string_field = "string_field"; } - C.staticProperty = 0 - return C - })() - C.staticProperty = 1 + + return Cl; + })(); + + C.prop = 2; ``` diff --git a/linter/docs/rules/recipe144.md b/linter/docs/rules/recipe144.md index bc9b4149f8945942aba1d6e4c3e3705f3c34bc3b..c861edb743a74319c42f121a95133c994f5a4a3d 100644 --- a/linter/docs/rules/recipe144.md +++ b/linter/docs/rules/recipe144.md @@ -17,14 +17,14 @@ Properties and functions of the global object: ``eval``, ``__lookupGetter__``, ``__lookupSetter__``, ``assign``, ``create``, ``defineProperties``, ``defineProperty``, ``entries``, ``freeze``, ``fromEntries``, ``getOwnPropertyDescriptor``, ``getOwnPropertyDescriptors``, -``getOwnPropertyNames``, ``getOwnPropertySymbols``, ``getPrototypeOf``, -``hasOwn``, ``hasOwnProperty``, ``is``, ``isExtensible``, ``isFrozen``, -``isPrototypeOf``, ``isSealed``, ``keys``, ``preventExtensions``, -``propertyIsEnumerable``, ``seal``, ``setPrototypeOf``, ``values`` +``getOwnPropertySymbols``, ``getPrototypeOf``, +``hasOwnProperty``, ``is``, ``isExtensible``, ``isFrozen``, +``isPrototypeOf``, ``isSealed``, ``preventExtensions``, +``propertyIsEnumerable``, ``seal``, ``setPrototypeOf`` ``Reflect``: ``apply``, ``construct``, ``defineProperty``, ``deleteProperty``, -``get``, ``getOwnPropertyDescriptor``, ``getPrototypeOf``, ``has``, -``isExtensible``, ``ownKeys``, ``preventExtensions``, ``set``, +``getOwnPropertyDescriptor``, ``getPrototypeOf``, +``isExtensible``, ``preventExtensions``, ``setPrototypeOf`` ``Proxy``: ``handler.apply()``, ``handler.construct()``, diff --git a/linter/docs/rules/recipe38.md b/linter/docs/rules/recipe38.md index a0fdb0a06e953ac517d0fe5c18d2dfa4af205d95..be488b74a3cfa43eac7211f7d943b097b7e7ca5a 100644 --- a/linter/docs/rules/recipe38.md +++ b/linter/docs/rules/recipe38.md @@ -141,6 +141,6 @@ specifically not supported in the following contexts: ## See also - Recipe 040: Object literals cannot be used as type declarations (``arkts-no-obj-literals-as-types``) -- Recipe 043: Array literals must contain elements of only inferrable types (``arkts-no-noninferrable-arr-literals``) +- Recipe 043: Array literals must contain elements of only inferable types (``arkts-no-noninferable-arr-literals``) diff --git a/linter/docs/rules/recipe40.md b/linter/docs/rules/recipe40.md index dd4221b1457b466a4de5876eb63a5733c817c18d..283c0b7759123e1fd46b0e4f32c5cb2f4089ca22 100644 --- a/linter/docs/rules/recipe40.md +++ b/linter/docs/rules/recipe40.md @@ -41,6 +41,6 @@ types in place. Declare classes and interfaces explicitly instead. ## See also - Recipe 038: Object literal must correspond to some explicitly declared class or interface (``arkts-no-untyped-obj-literals``) -- Recipe 043: Array literals must contain elements of only inferrable types (``arkts-no-noninferrable-arr-literals``) +- Recipe 043: Array literals must contain elements of only inferable types (``arkts-no-noninferable-arr-literals``) diff --git a/linter/docs/rules/recipe43.md b/linter/docs/rules/recipe43.md index b2ee2d200504ffbeb5be1e50dc1d50e5a9e72105..07d8d6e9ce05165e8f38cd83d6091700f960533b 100644 --- a/linter/docs/rules/recipe43.md +++ b/linter/docs/rules/recipe43.md @@ -1,12 +1,12 @@ -# Array literals must contain elements of only inferrable types +# Array literals must contain elements of only inferable types -Rule ``arkts-no-noninferrable-arr-literals`` +Rule ``arkts-no-noninferable-arr-literals`` **Severity: error** Basically, ArkTS infers the type of an array literal as a union type of its contents. However, a compile-time error occurs if there is at least one -element with a non-inferrable type (e.g. untyped object literal). +element with a non-inferable type (e.g. untyped object literal). ## TypeScript