diff --git a/linter-4.2/src/Utils.ts b/linter-4.2/src/Utils.ts index 1fc3ed1abd7b6ed8c1435be18dafe5ad0036e1d9..8036825748dc701b1a8d1786630a804390006d78 100644 --- a/linter-4.2/src/Utils.ts +++ b/linter-4.2/src/Utils.ts @@ -116,7 +116,7 @@ export class TsUtils { static LIMITED_STD_ARRAY_API = ['isArray']; static LIMITED_STD_ARRAYBUFFER_API = ['isView']; - static NON_INITIALIZABLE_PROPERTY_DECORATORS = ['Link', 'Consume', 'ObjectLink']; + static NON_INITIALIZABLE_PROPERTY_DECORATORS = ['Link', 'Consume', 'ObjectLink', 'Prop', 'BuilderParam']; static NON_RETURN_FUNCTION_DECORATORS = ['AnimatableExtend', 'Builder', 'Extend', 'Styles']; diff --git a/linter-4.2/test/arkui_decorators.ts.autofix.json b/linter-4.2/test/arkui_decorators.ts.autofix.json index 709643e577625d6f240498d7a9c7e65f73b0e1d9..44561c0aa3a28c5065110e92b64e2b868830bd05 100644 --- a/linter-4.2/test/arkui_decorators.ts.autofix.json +++ b/linter-4.2/test/arkui_decorators.ts.autofix.json @@ -174,14 +174,6 @@ "suggest": "Property 'age' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'age' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 50, - "column": 3, - "problem": "StrictDiagnostic", - "autofixable": false, - "suggest": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor." - }, { "line": 61, "column": 3, @@ -190,14 +182,6 @@ "suggest": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 67, - "column": 3, - "problem": "StrictDiagnostic", - "autofixable": false, - "suggest": "Property 'prop' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'prop' has no initializer and is not definitely assigned in the constructor." - }, { "line": 71, "column": 3, diff --git a/linter-4.2/test/arkui_decorators.ts.relax.json b/linter-4.2/test/arkui_decorators.ts.relax.json index 7df5376061530b3e2d203c96f4a2e1705b8c411a..3f42713ea8e748739b807a7f2533420504b880c3 100644 --- a/linter-4.2/test/arkui_decorators.ts.relax.json +++ b/linter-4.2/test/arkui_decorators.ts.relax.json @@ -154,13 +154,6 @@ "suggest": "Property 'age' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'age' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 50, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor." - }, { "line": 61, "column": 3, @@ -168,13 +161,6 @@ "suggest": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 67, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'prop' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'prop' has no initializer and is not definitely assigned in the constructor." - }, { "line": 71, "column": 3, diff --git a/linter-4.2/test/arkui_decorators.ts.strict.json b/linter-4.2/test/arkui_decorators.ts.strict.json index 7df5376061530b3e2d203c96f4a2e1705b8c411a..3f42713ea8e748739b807a7f2533420504b880c3 100644 --- a/linter-4.2/test/arkui_decorators.ts.strict.json +++ b/linter-4.2/test/arkui_decorators.ts.strict.json @@ -154,13 +154,6 @@ "suggest": "Property 'age' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'age' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 50, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor." - }, { "line": 61, "column": 3, @@ -168,13 +161,6 @@ "suggest": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 67, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'prop' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'prop' has no initializer and is not definitely assigned in the constructor." - }, { "line": 71, "column": 3, diff --git a/linter-4.2/test/non_initializable_prop_decorators.ts b/linter-4.2/test/non_initializable_prop_decorators.ts index f31f7fa0ca40619242e3fb7c4bc51ca0312fa177..b1d620a8f01b689952906c13e16c05566e070a48 100644 --- a/linter-4.2/test/non_initializable_prop_decorators.ts +++ b/linter-4.2/test/non_initializable_prop_decorators.ts @@ -24,7 +24,7 @@ let Provide: PropDecoratorWithCall; class Decorators { @Prop - p: number; // Not ok + p: number; @Link l: number; diff --git a/linter-4.2/test/non_initializable_prop_decorators.ts.relax.json b/linter-4.2/test/non_initializable_prop_decorators.ts.relax.json index f8b3e2c0fe0b384998c11b4854e4b381fe232dd8..594a2ab945918e6fcebf8c627fb55aedc7f3baef 100644 --- a/linter-4.2/test/non_initializable_prop_decorators.ts.relax.json +++ b/linter-4.2/test/non_initializable_prop_decorators.ts.relax.json @@ -39,11 +39,6 @@ "column": 3, "problem": "AnyType" }, - { - "line": 27, - "column": 3, - "problem": "StrictDiagnostic" - }, { "line": 42, "column": 3, diff --git a/linter-4.2/test/non_initializable_prop_decorators.ts.strict.json b/linter-4.2/test/non_initializable_prop_decorators.ts.strict.json index f8b3e2c0fe0b384998c11b4854e4b381fe232dd8..594a2ab945918e6fcebf8c627fb55aedc7f3baef 100644 --- a/linter-4.2/test/non_initializable_prop_decorators.ts.strict.json +++ b/linter-4.2/test/non_initializable_prop_decorators.ts.strict.json @@ -39,11 +39,6 @@ "column": 3, "problem": "AnyType" }, - { - "line": 27, - "column": 3, - "problem": "StrictDiagnostic" - }, { "line": 42, "column": 3, diff --git a/linter/src/utils/consts/NonInitializablePropertyDecorators.ts b/linter/src/utils/consts/NonInitializablePropertyDecorators.ts index ac92d80528e63af3a0bae8b7ae16c47938236fc4..0166ad0069e44aaecea6a0aae14ac3143247ca09 100644 --- a/linter/src/utils/consts/NonInitializablePropertyDecorators.ts +++ b/linter/src/utils/consts/NonInitializablePropertyDecorators.ts @@ -13,4 +13,4 @@ * limitations under the License. */ -export const NON_INITIALIZABLE_PROPERTY_DECORATORS = ['Link', 'Consume', 'ObjectLink']; +export const NON_INITIALIZABLE_PROPERTY_DECORATORS = ['Link', 'Consume', 'ObjectLink', 'Prop', 'BuilderParam']; diff --git a/linter/test/arkui_decorators.ts.relax.json b/linter/test/arkui_decorators.ts.relax.json index 7df5376061530b3e2d203c96f4a2e1705b8c411a..3f42713ea8e748739b807a7f2533420504b880c3 100644 --- a/linter/test/arkui_decorators.ts.relax.json +++ b/linter/test/arkui_decorators.ts.relax.json @@ -154,13 +154,6 @@ "suggest": "Property 'age' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'age' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 50, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor." - }, { "line": 61, "column": 3, @@ -168,13 +161,6 @@ "suggest": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 67, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'prop' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'prop' has no initializer and is not definitely assigned in the constructor." - }, { "line": 71, "column": 3, diff --git a/linter/test/arkui_decorators.ts.strict.json b/linter/test/arkui_decorators.ts.strict.json index 7df5376061530b3e2d203c96f4a2e1705b8c411a..3f42713ea8e748739b807a7f2533420504b880c3 100644 --- a/linter/test/arkui_decorators.ts.strict.json +++ b/linter/test/arkui_decorators.ts.strict.json @@ -154,13 +154,6 @@ "suggest": "Property 'age' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'age' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 50, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'builderParam' has no initializer and is not definitely assigned in the constructor." - }, { "line": 61, "column": 3, @@ -168,13 +161,6 @@ "suggest": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor.", "rule": "Property 'localStorage' has no initializer and is not definitely assigned in the constructor." }, - { - "line": 67, - "column": 3, - "problem": "StrictDiagnostic", - "suggest": "Property 'prop' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'prop' has no initializer and is not definitely assigned in the constructor." - }, { "line": 71, "column": 3, diff --git a/linter/test/non_initializable_prop_decorators.ts b/linter/test/non_initializable_prop_decorators.ts index f31f7fa0ca40619242e3fb7c4bc51ca0312fa177..b1d620a8f01b689952906c13e16c05566e070a48 100644 --- a/linter/test/non_initializable_prop_decorators.ts +++ b/linter/test/non_initializable_prop_decorators.ts @@ -24,7 +24,7 @@ let Provide: PropDecoratorWithCall; class Decorators { @Prop - p: number; // Not ok + p: number; @Link l: number; diff --git a/linter/test/non_initializable_prop_decorators.ts.relax.json b/linter/test/non_initializable_prop_decorators.ts.relax.json index f8b3e2c0fe0b384998c11b4854e4b381fe232dd8..594a2ab945918e6fcebf8c627fb55aedc7f3baef 100644 --- a/linter/test/non_initializable_prop_decorators.ts.relax.json +++ b/linter/test/non_initializable_prop_decorators.ts.relax.json @@ -39,11 +39,6 @@ "column": 3, "problem": "AnyType" }, - { - "line": 27, - "column": 3, - "problem": "StrictDiagnostic" - }, { "line": 42, "column": 3, diff --git a/linter/test/non_initializable_prop_decorators.ts.strict.json b/linter/test/non_initializable_prop_decorators.ts.strict.json index f8b3e2c0fe0b384998c11b4854e4b381fe232dd8..594a2ab945918e6fcebf8c627fb55aedc7f3baef 100644 --- a/linter/test/non_initializable_prop_decorators.ts.strict.json +++ b/linter/test/non_initializable_prop_decorators.ts.strict.json @@ -39,11 +39,6 @@ "column": 3, "problem": "AnyType" }, - { - "line": 27, - "column": 3, - "problem": "StrictDiagnostic" - }, { "line": 42, "column": 3,