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..97d39f651e718f18b655d18dca4bf0c76a98ac3e 100644 --- a/linter-4.2/docs/rules/recipe126.md +++ b/linter-4.2/docs/rules/recipe126.md @@ -49,6 +49,4 @@ 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/src/CookBookMsg.ts b/linter-4.2/src/CookBookMsg.ts index 39c634556bd9461e99feb8d7c6180a840ab89fc2..87c5dc8fff787ea98ea12ebb0887704ac3ea85af 100644 --- a/linter-4.2/src/CookBookMsg.ts +++ b/linter-4.2/src/CookBookMsg.ts @@ -144,7 +144,7 @@ cookBookTag[121] = '"require" and "import" assignment are not supported (arkts-n cookBookTag[122] = ''; cookBookTag[123] = ''; cookBookTag[124] = ''; -cookBookTag[125] = 'Re-exporting is supported with restrictions (arkts-limited-reexport)'; +cookBookTag[125] = ''; cookBookTag[126] = '"export = ..." assignment is not supported (arkts-no-export-assignment)'; cookBookTag[127] = 'Special "export type" declarations are not supported (arkts-no-special-exports)'; cookBookTag[128] = 'Ambient module declaration is not supported (arkts-no-ambient-decls)'; diff --git a/linter-4.2/src/Problems.ts b/linter-4.2/src/Problems.ts index 4f9474699046fe0c63f46718d4f0751b414cff82..6bb23acaa338bd78b88a884fffa4e072b4d3a86d 100644 --- a/linter-4.2/src/Problems.ts +++ b/linter-4.2/src/Problems.ts @@ -28,7 +28,7 @@ export enum FaultID { NonDeclarationInNamespace, GeneratorFunction, FunctionContainsThis, PropertyAccessByIndex, JsxElement, EnumMemberNonConstInit, ImplementsClass, MethodReassignment, MultipleStaticBlocks, ThisType, IntefaceExtendDifProps, StructuralIdentity, TypeOnlyImport, TypeOnlyExport, DefaultImport, - LimitedReExporting, ExportAssignment, ImportAssignment, PropertyRuntimeCheck, + ExportAssignment, ImportAssignment, PropertyRuntimeCheck, GenericCallNoTypeArgs, ParameterProperties, InstanceofUnsupported, ShorthandAmbientModuleDecl, WildcardsInModuleName, UMDModuleDefinition, NewTarget, DefiniteAssignment, IifeAsNamespace, Prototype, GlobalThis, @@ -118,7 +118,6 @@ faultsAttrs[FaultID.ImportFromPath] = {cookBookRef: '119',}; faultsAttrs[FaultID.TypeOnlyImport] = {migratable: true, cookBookRef: '118',}; faultsAttrs[FaultID.DefaultImport] = {migratable: true, cookBookRef: '120',}; faultsAttrs[FaultID.ImportAssignment] = {cookBookRef: '121',}; -faultsAttrs[FaultID.LimitedReExporting] = {cookBookRef: '125',}; faultsAttrs[FaultID.ExportAssignment] = {cookBookRef: '126',}; faultsAttrs[FaultID.TypeOnlyExport] = {migratable: true, cookBookRef: '127',}; faultsAttrs[FaultID.ShorthandAmbientModuleDecl] = {cookBookRef: '128',}; diff --git a/linter-4.2/src/TypeScriptLinter.ts b/linter-4.2/src/TypeScriptLinter.ts index d2852f46afd2be6e7ffffb18094a55f580f58e5e..2c40cc426b3565196781183c643f06212c6d9d92 100644 --- a/linter-4.2/src/TypeScriptLinter.ts +++ b/linter-4.2/src/TypeScriptLinter.ts @@ -1805,9 +1805,6 @@ export class TypeScriptLinter { autofix = [Autofixer.dropTypeOnlyFlag(tsExportDecl)]; this.incrementCounters(node, FaultID.TypeOnlyExport, true, autofix); } - let exportClause = tsExportDecl.exportClause; - if (exportClause && ts.isNamespaceExport(exportClause)) - this.incrementCounters(node, FaultID.LimitedReExporting); } private handleExportAssignment(node: ts.Node) { diff --git a/linter-4.2/src/TypeScriptLinterConfig.ts b/linter-4.2/src/TypeScriptLinterConfig.ts index 41885bbc4594336fafd1136e8701238e3c9f442b..1834923b6fb67f8c2ebf986468d177e1c121a9a4 100644 --- a/linter-4.2/src/TypeScriptLinterConfig.ts +++ b/linter-4.2/src/TypeScriptLinterConfig.ts @@ -99,7 +99,6 @@ export class LinterConfig { LinterConfig.nodeDesc[FaultID.TypeOnlyImport] = 'Type-only imports'; LinterConfig.nodeDesc[FaultID.TypeOnlyExport] = 'Type-only exports'; LinterConfig.nodeDesc[FaultID.DefaultImport] = 'Default import declarations'; - LinterConfig.nodeDesc[FaultID.LimitedReExporting] = 'Limited re-exporting declarations'; LinterConfig.nodeDesc[FaultID.ExportAssignment] = 'Export assignments (export = ..)'; LinterConfig.nodeDesc[FaultID.ImportAssignment] = 'Import assignments (import = ..)'; LinterConfig.nodeDesc[FaultID.PropertyRuntimeCheck] = 'Property-based runtime checks'; diff --git a/linter-4.2/test/modules.ts.autofix.json b/linter-4.2/test/modules.ts.autofix.json index 6efcd45689913c9b54c2df63cf07c492349f31fe..abcfc16cba40251083bd01fcbd77787374c086ad 100644 --- a/linter-4.2/test/modules.ts.autofix.json +++ b/linter-4.2/test/modules.ts.autofix.json @@ -168,12 +168,6 @@ } ] }, - { - "line": 100, - "column": 1, - "problem": "LimitedReExporting", - "autofixable": false - }, { "line": 104, "column": 1, diff --git a/linter-4.2/test/modules.ts.relax.json b/linter-4.2/test/modules.ts.relax.json index 7dec750ab9ec8d24108f27f01fe784b688e0a319..55a62b5a6c303b6c83c8a3a7e1df632c10f54db5 100644 --- a/linter-4.2/test/modules.ts.relax.json +++ b/linter-4.2/test/modules.ts.relax.json @@ -94,11 +94,6 @@ "column": 1, "problem": "ImportAfterStatement" }, - { - "line": 100, - "column": 1, - "problem": "LimitedReExporting" - }, { "line": 104, "column": 1, diff --git a/linter-4.2/test/modules.ts.strict.json b/linter-4.2/test/modules.ts.strict.json index 4e31337aadbd6431e8aaee50e40c5bf58809a593..153433193edbb98b92630cdc6e5446f3dbb14a5b 100644 --- a/linter-4.2/test/modules.ts.strict.json +++ b/linter-4.2/test/modules.ts.strict.json @@ -119,11 +119,6 @@ "column": 1, "problem": "TypeOnlyExport" }, - { - "line": 100, - "column": 1, - "problem": "LimitedReExporting" - }, { "line": 104, "column": 1, 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..97d39f651e718f18b655d18dca4bf0c76a98ac3e 100644 --- a/linter/docs/rules/recipe126.md +++ b/linter/docs/rules/recipe126.md @@ -49,6 +49,4 @@ 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/src/CookBookMsg.ts b/linter/src/CookBookMsg.ts index 39c634556bd9461e99feb8d7c6180a840ab89fc2..87c5dc8fff787ea98ea12ebb0887704ac3ea85af 100644 --- a/linter/src/CookBookMsg.ts +++ b/linter/src/CookBookMsg.ts @@ -144,7 +144,7 @@ cookBookTag[121] = '"require" and "import" assignment are not supported (arkts-n cookBookTag[122] = ''; cookBookTag[123] = ''; cookBookTag[124] = ''; -cookBookTag[125] = 'Re-exporting is supported with restrictions (arkts-limited-reexport)'; +cookBookTag[125] = ''; cookBookTag[126] = '"export = ..." assignment is not supported (arkts-no-export-assignment)'; cookBookTag[127] = 'Special "export type" declarations are not supported (arkts-no-special-exports)'; cookBookTag[128] = 'Ambient module declaration is not supported (arkts-no-ambient-decls)'; diff --git a/linter/src/FaultAttrs.ts b/linter/src/FaultAttrs.ts index 51ee559c1dd4758fa87c8a0d8e2efb672f612c5d..7d82115c8407c0fe993fc65f56b40712f109b22a 100644 --- a/linter/src/FaultAttrs.ts +++ b/linter/src/FaultAttrs.ts @@ -94,7 +94,6 @@ faultsAttrs[FaultID.ImportFromPath] = {cookBookRef: '119',}; faultsAttrs[FaultID.TypeOnlyImport] = {migratable: true, cookBookRef: '118',}; faultsAttrs[FaultID.DefaultImport] = {migratable: true, cookBookRef: '120',}; faultsAttrs[FaultID.ImportAssignment] = {cookBookRef: '121',}; -faultsAttrs[FaultID.LimitedReExporting] = {cookBookRef: '125',}; faultsAttrs[FaultID.ExportAssignment] = {cookBookRef: '126',}; faultsAttrs[FaultID.TypeOnlyExport] = {migratable: true, cookBookRef: '127',}; faultsAttrs[FaultID.ShorthandAmbientModuleDecl] = {cookBookRef: '128',}; diff --git a/linter/src/FaultDesc.ts b/linter/src/FaultDesc.ts index fc0ad6dc940a99be4113c3c6c92277e0c7ea464a..ae0717c048282dde9f0ded22c8c5c610d3cafbcf 100644 --- a/linter/src/FaultDesc.ts +++ b/linter/src/FaultDesc.ts @@ -83,7 +83,6 @@ faultDesc[FaultID.StructuralIdentity] = 'Use of type structural identity'; faultDesc[FaultID.TypeOnlyImport] = 'Type-only imports'; faultDesc[FaultID.TypeOnlyExport] = 'Type-only exports'; faultDesc[FaultID.DefaultImport] = 'Default import declarations'; -faultDesc[FaultID.LimitedReExporting] = 'Limited re-exporting declarations'; faultDesc[FaultID.ExportAssignment] = 'Export assignments (export = ..)'; faultDesc[FaultID.ImportAssignment] = 'Import assignments (import = ..)'; faultDesc[FaultID.PropertyRuntimeCheck] = 'Property-based runtime checks'; diff --git a/linter/src/Problems.ts b/linter/src/Problems.ts index 83e1eabf2a272576c89e6405362d87ae4b7f76ae..f4ac406f2ccb2f312bb7cdf6fab625ef4928c234 100644 --- a/linter/src/Problems.ts +++ b/linter/src/Problems.ts @@ -28,7 +28,7 @@ export enum FaultID { NonDeclarationInNamespace, GeneratorFunction, FunctionContainsThis, PropertyAccessByIndex, JsxElement, EnumMemberNonConstInit, ImplementsClass, MethodReassignment, MultipleStaticBlocks, ThisType, IntefaceExtendDifProps, StructuralIdentity, TypeOnlyImport, TypeOnlyExport, DefaultImport, - LimitedReExporting, ExportAssignment, ImportAssignment, PropertyRuntimeCheck, + ExportAssignment, ImportAssignment, PropertyRuntimeCheck, GenericCallNoTypeArgs, ParameterProperties, InstanceofUnsupported, ShorthandAmbientModuleDecl, WildcardsInModuleName, UMDModuleDefinition, NewTarget, DefiniteAssignment, IifeAsNamespace, Prototype, GlobalThis, diff --git a/linter/src/TypeScriptLinter.ts b/linter/src/TypeScriptLinter.ts index dc31177e04be7bda950dba8cb05faa45139b1b1c..1ad9a322575d4d66cef8bd1e03fcaa90b9aaa5a1 100644 --- a/linter/src/TypeScriptLinter.ts +++ b/linter/src/TypeScriptLinter.ts @@ -1412,9 +1412,6 @@ export class TypeScriptLinter { this.incrementCounters(node, FaultID.TypeOnlyExport, true, autofix); } let exportClause = tsExportDecl.exportClause; - if (exportClause && ts.isNamespaceExport(exportClause)) { - this.incrementCounters(node, FaultID.LimitedReExporting); - } if (exportClause && ts.isNamedExports(exportClause)) { for (const exportSpec of exportClause.elements) { if (exportSpec.isTypeOnly) { diff --git a/linter/test/modules.ts b/linter/test/modules.ts index fa40175fffa3437f7845d724a9091138ea8aaa02..fc3f9934e6a4a029f3617bfe4b8f89acea742444 100644 --- a/linter/test/modules.ts +++ b/linter/test/modules.ts @@ -99,7 +99,7 @@ export { type TypeFoo as TypeBar }; // Re-exporting export * from 'module1'; // Ok -export * as Utilities from 'module2'; // Not supported +export * as Utilities from 'module2'; // Ok export { SomeFunction, SomeType as OtherType } from 'module3'; // Ok class Point {} diff --git a/linter/test/modules.ts.autofix.json b/linter/test/modules.ts.autofix.json index ee501d6b68aed2b4b57e362dd16651c07d4f7412..9fe058bebbbe7467d0c6e9288c7cddb796fad136 100755 --- a/linter/test/modules.ts.autofix.json +++ b/linter/test/modules.ts.autofix.json @@ -213,12 +213,6 @@ } ] }, - { - "line": 102, - "column": 1, - "problem": "LimitedReExporting", - "autofixable": false - }, { "line": 106, "column": 1, diff --git a/linter/test/modules.ts.relax.json b/linter/test/modules.ts.relax.json index e024a9be5b95ad9b15a674daa528cb4b9aabd848..12d677fed17bd5b5de87bcaad7e5ce69345b0895 100644 --- a/linter/test/modules.ts.relax.json +++ b/linter/test/modules.ts.relax.json @@ -99,11 +99,6 @@ "column": 1, "problem": "ImportAfterStatement" }, - { - "line": 102, - "column": 1, - "problem": "LimitedReExporting" - }, { "line": 106, "column": 1, diff --git a/linter/test/modules.ts.strict.json b/linter/test/modules.ts.strict.json index 550974d82dca09b7ce37758f20958c5b889e2a1f..4d93b51e999344d211deaacb6efa672b73e82905 100644 --- a/linter/test/modules.ts.strict.json +++ b/linter/test/modules.ts.strict.json @@ -139,11 +139,6 @@ "column": 10, "problem": "TypeOnlyExport" }, - { - "line": 102, - "column": 1, - "problem": "LimitedReExporting" - }, { "line": 106, "column": 1, diff --git a/linter/test_rules/rule125.ts b/linter/test_rules/rule125.ts deleted file mode 100644 index 094f9e773c733ae315c3afe5a8eb0bc921f11b79..0000000000000000000000000000000000000000 --- a/linter/test_rules/rule125.ts +++ /dev/null @@ -1,13 +0,0 @@ - // module1 - export class Class1 { - // ... - } - export class Class2 { - // ... - } - - // module2 - export * as utilities from "module1" - - // consumer module - import { utilities } from "module2" \ No newline at end of file diff --git a/linter/test_rules/rule125.ts.autofix.json b/linter/test_rules/rule125.ts.autofix.json deleted file mode 100644 index b5ef603190f36b508aaebb3155fca086f5704d6f..0000000000000000000000000000000000000000 --- a/linter/test_rules/rule125.ts.autofix.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "nodes": [ - { - "line": 10, - "column": 5, - "problem": "LimitedReExporting", - "autofixable": false, - "suggest": "", - "rule": "Re-exporting is supported with restrictions (arkts-limited-reexport)" - }, - { - "line": 13, - "column": 5, - "problem": "ImportAfterStatement", - "autofixable": false, - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)" - } - ] -} \ No newline at end of file diff --git a/linter/test_rules/rule125.ts.relax.json b/linter/test_rules/rule125.ts.relax.json deleted file mode 100644 index 0a9e3e3bf4ca45c8aff61d0ff1911d79810227c5..0000000000000000000000000000000000000000 --- a/linter/test_rules/rule125.ts.relax.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "nodes": [ - { - "line": 10, - "column": 5, - "problem": "LimitedReExporting", - "suggest": "", - "rule": "Re-exporting is supported with restrictions (arkts-limited-reexport)" - }, - { - "line": 13, - "column": 5, - "problem": "ImportAfterStatement", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)" - } - ] -} \ No newline at end of file diff --git a/linter/test_rules/rule125.ts.strict.json b/linter/test_rules/rule125.ts.strict.json deleted file mode 100644 index 0a9e3e3bf4ca45c8aff61d0ff1911d79810227c5..0000000000000000000000000000000000000000 --- a/linter/test_rules/rule125.ts.strict.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "nodes": [ - { - "line": 10, - "column": 5, - "problem": "LimitedReExporting", - "suggest": "", - "rule": "Re-exporting is supported with restrictions (arkts-limited-reexport)" - }, - { - "line": 13, - "column": 5, - "problem": "ImportAfterStatement", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)" - } - ] -} \ No newline at end of file