Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate S2814 (no-redeclare) for TypeScript #3635

Merged
merged 2 commits into from
Jan 11, 2023
Merged

Conversation

victor-diez-sonarsource
Copy link
Contributor

@victor-diez-sonarsource victor-diez-sonarsource commented Jan 10, 2023

Fixes #3580

Note: we failed to add Deprecated section to the rule description

Copy link
Contributor

@vilchik-elena vilchik-elena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And won't fix the issue in Next

@@ -49,7 +50,10 @@ public void define(Context context) {
NewRule commentRegularExpression = repository.rule("S124");
commentRegularExpression.setTemplate(true);

// deprecated for Typescript: https://github.com/SonarSource/SonarJS/issues/3580
NewRule redeclaredVariables = repository.rule("S2814");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the variable name use eslint key or java class name

@@ -95,6 +95,7 @@ void sonar_way_ts() {
assertThat(profile.rules()).extracting("repoKey").containsOnly(CheckList.TS_REPOSITORY_KEY);
assertThat(profile.rules().size()).isGreaterThan(100);
assertThat(profile.rules()).extracting(BuiltInQualityProfilesDefinition.BuiltInActiveRule::ruleKey).contains("S5122");
assertThat(profile.rules()).extracting(BuiltInQualityProfilesDefinition.BuiltInActiveRule::ruleKey).doesNotContain("S2814");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert that JS profile has it

@@ -49,7 +50,10 @@ public void define(Context context) {
NewRule commentRegularExpression = repository.rule("S124");
commentRegularExpression.setTemplate(true);

// deprecated for Typescript: https://github.com/SonarSource/SonarJS/issues/3580
NewRule redeclaredVariables = repository.rule("S2814");
redeclaredVariables.setStatus(RuleStatus.DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we unit test it?

@sonarsource-next
Copy link

sonarsource-next bot commented Jan 11, 2023

@vilchik-elena vilchik-elena changed the title Deprecate S2814 for TypeScript Deprecate S2814 (no-redeclare) for TypeScript Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S2814 might not be needed in TypeScript
3 participants