From ea80537d732e07096b9b2f198b19215dae5552c1 Mon Sep 17 00:00:00 2001 From: Ilya Trubachev Date: Fri, 15 Sep 2023 11:38:32 +0300 Subject: [PATCH] remove arkts-limited-reexport recipe Signed-off-by: Ilya Trubachev --- linter-4.2/docs/rules/recipe125.md | 62 ----------------------- linter-4.2/docs/rules/recipe126.md | 2 - linter-4.2/src/CookBookMsg.ts | 2 +- linter-4.2/src/Problems.ts | 3 +- linter-4.2/src/TypeScriptLinter.ts | 3 -- linter-4.2/src/TypeScriptLinterConfig.ts | 1 - linter-4.2/test/modules.ts.autofix.json | 6 --- linter-4.2/test/modules.ts.relax.json | 5 -- linter-4.2/test/modules.ts.strict.json | 5 -- linter/docs/rules/recipe125.md | 62 ----------------------- linter/docs/rules/recipe126.md | 2 - linter/src/CookBookMsg.ts | 2 +- linter/src/FaultAttrs.ts | 1 - linter/src/FaultDesc.ts | 1 - linter/src/Problems.ts | 2 +- linter/src/TypeScriptLinter.ts | 3 -- linter/test/modules.ts | 2 +- linter/test/modules.ts.autofix.json | 6 --- linter/test/modules.ts.relax.json | 5 -- linter/test/modules.ts.strict.json | 5 -- linter/test_rules/rule125.ts | 13 ----- linter/test_rules/rule125.ts.autofix.json | 19 ------- linter/test_rules/rule125.ts.relax.json | 17 ------- linter/test_rules/rule125.ts.strict.json | 17 ------- 24 files changed, 5 insertions(+), 241 deletions(-) delete mode 100644 linter-4.2/docs/rules/recipe125.md delete mode 100644 linter/docs/rules/recipe125.md delete mode 100644 linter/test_rules/rule125.ts delete mode 100644 linter/test_rules/rule125.ts.autofix.json delete mode 100644 linter/test_rules/rule125.ts.relax.json delete mode 100644 linter/test_rules/rule125.ts.strict.json diff --git a/linter-4.2/docs/rules/recipe125.md b/linter-4.2/docs/rules/recipe125.md deleted file mode 100644 index b7409c6a5..000000000 --- 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 5e4f7f9af..97d39f651 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 39c634556..87c5dc8ff 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 4f9474699..6bb23acaa 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 d2852f46a..2c40cc426 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 41885bbc4..1834923b6 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 6efcd4568..abcfc16cb 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 7dec750ab..55a62b5a6 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 4e31337aa..153433193 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 b7409c6a5..000000000 --- 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 5e4f7f9af..97d39f651 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 39c634556..87c5dc8ff 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 51ee559c1..7d82115c8 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 fc0ad6dc9..ae0717c04 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 83e1eabf2..f4ac406f2 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 dc31177e0..1ad9a3225 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 fa40175ff..fc3f9934e 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 ee501d6b6..9fe058beb 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 e024a9be5..12d677fed 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 550974d82..4d93b51e9 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 094f9e773..000000000 --- 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 b5ef60319..000000000 --- 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 0a9e3e3bf..000000000 --- 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 0a9e3e3bf..000000000 --- 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 -- Gitee