diff --git a/its/ruling/src/test/expected/jsts/TypeScript/typescript-S4023.json b/its/ruling/src/test/expected/jsts/TypeScript/typescript-S4023.json index 9022a2342e..c65fa7a20b 100644 --- a/its/ruling/src/test/expected/jsts/TypeScript/typescript-S4023.json +++ b/its/ruling/src/test/expected/jsts/TypeScript/typescript-S4023.json @@ -1,29 +1,9 @@ { "TypeScript:scripts/word2md.ts": [ 57, -60, -67, -81, -99, -112 -], -"TypeScript:src/compiler/types.ts": [ -3161 +99 ], "TypeScript:src/harness/loggedIO.ts": [ 12 -], -"TypeScript:src/server/protocol.ts": [ -1027, -1101, -1108, -1133, -1210, -1678, -1936, -2223 -], -"TypeScript:src/services/types.ts": [ -366 ] } diff --git a/its/ruling/src/test/expected/jsts/ag-grid/typescript-S4023.json b/its/ruling/src/test/expected/jsts/ag-grid/typescript-S4023.json index 1cb949d771..58e5f5f6d3 100644 --- a/its/ruling/src/test/expected/jsts/ag-grid/typescript-S4023.json +++ b/its/ruling/src/test/expected/jsts/ag-grid/typescript-S4023.json @@ -1,7 +1,4 @@ { -"ag-grid:src/ts/filter/filter.ts": [ -4 -], "ag-grid:src/ts/filter/floatingFilter.ts": [ 14 ], @@ -14,9 +11,6 @@ "ag-grid:src/ts/interfaces/iEnterpriseCache.ts": [ 2 ], -"ag-grid:src/ts/interfaces/iExcelCreator.ts": [ -105 -], "ag-grid:src/ts/interfaces/iMenu.ts": [ 2 ] diff --git a/its/ruling/src/test/expected/jsts/ant-design/typescript-S4023.json b/its/ruling/src/test/expected/jsts/ant-design/typescript-S4023.json deleted file mode 100644 index a566acdbbe..0000000000 --- a/its/ruling/src/test/expected/jsts/ant-design/typescript-S4023.json +++ /dev/null @@ -1,5 +0,0 @@ -{ -"ant-design:components/tree/Tree.tsx": [ -54 -] -} diff --git a/its/ruling/src/test/expected/jsts/console/typescript-S4023.json b/its/ruling/src/test/expected/jsts/console/typescript-S4023.json index fdc0c054d0..dff803efcf 100644 --- a/its/ruling/src/test/expected/jsts/console/typescript-S4023.json +++ b/its/ruling/src/test/expected/jsts/console/typescript-S4023.json @@ -44,9 +44,6 @@ "console:src/mutations/UpdateRelationMutation.ts": [ 17 ], -"console:src/utils/classnames.ts": [ -10 -], "console:src/views/CLIAuthView/CLIAuthSuccessView.tsx": [ 5 ], diff --git a/its/ruling/src/test/expected/jsts/eigen/typescript-S4023.json b/its/ruling/src/test/expected/jsts/eigen/typescript-S4023.json deleted file mode 100644 index 28f8970f82..0000000000 --- a/its/ruling/src/test/expected/jsts/eigen/typescript-S4023.json +++ /dev/null @@ -1,101 +0,0 @@ -{ -"eigen:src/app/Components/ArtworkFilter/Filters/AdditionalGeneIDsOptions.tsx": [ -15 -], -"eigen:src/app/Components/ArtworkFilter/Filters/ArtistIDsArtworksOptions.tsx": [ -20 -], -"eigen:src/app/Components/ArtworkFilter/Filters/ArtistIDsSaleArtworksOptionsScreen.tsx": [ -17 -], -"eigen:src/app/Components/ArtworkFilter/Filters/ArtistNationalitiesOptions.tsx": [ -12 -], -"eigen:src/app/Components/ArtworkFilter/Filters/AttributionClassOptions.tsx": [ -12 -], -"eigen:src/app/Components/ArtworkFilter/Filters/AuctionHouseOptions.tsx": [ -30 -], -"eigen:src/app/Components/ArtworkFilter/Filters/CategoriesOptions.tsx": [ -12 -], -"eigen:src/app/Components/ArtworkFilter/Filters/ColorsOptions.tsx": [ -44 -], -"eigen:src/app/Components/ArtworkFilter/Filters/EstimateRangeOptions.tsx": [ -12 -], -"eigen:src/app/Components/ArtworkFilter/Filters/GalleriesAndInstitutionsOptions.tsx": [ -13 -], -"eigen:src/app/Components/ArtworkFilter/Filters/LocationCitiesOptions.tsx": [ -13 -], -"eigen:src/app/Components/ArtworkFilter/Filters/MaterialsTermsOptions.tsx": [ -15 -], -"eigen:src/app/Components/ArtworkFilter/Filters/MediumOptions.tsx": [ -19 -], -"eigen:src/app/Components/ArtworkFilter/Filters/PriceRangeOptions.tsx": [ -21 -], -"eigen:src/app/Components/ArtworkFilter/Filters/SizesOptionsScreen.tsx": [ -18 -], -"eigen:src/app/Components/ArtworkFilter/Filters/SortOptions.tsx": [ -15 -], -"eigen:src/app/Components/ArtworkFilter/Filters/TimePeriodOptions.tsx": [ -15 -], -"eigen:src/app/Components/ArtworkFilter/Filters/ViewAsOptions.tsx": [ -17 -], -"eigen:src/app/Components/ArtworkFilter/Filters/WaysToBuyOptions.tsx": [ -15 -], -"eigen:src/app/Components/ArtworkFilter/Filters/YearOptions.tsx": [ -21 -], -"eigen:src/app/Scenes/Onboarding/ForgotPassword.tsx": [ -20 -], -"eigen:src/app/Scenes/Onboarding/OnboardingCreateAccount/OnboardingCreateAccount.tsx": [ -24 -], -"eigen:src/app/Scenes/Onboarding/OnboardingCreateAccount/OnboardingCreateAccountEmail.tsx": [ -17 -], -"eigen:src/app/Scenes/Onboarding/OnboardingCreateAccount/OnboardingCreateAccountName.tsx": [ -15 -], -"eigen:src/app/Scenes/Onboarding/OnboardingCreateAccount/OnboardingCreateAccountPassword.tsx": [ -12 -], -"eigen:src/app/Scenes/Onboarding/OnboardingLogin.tsx": [ -19 -], -"eigen:src/app/Scenes/Onboarding/OnboardingPersonalization/OnboardingPersonalization.tsx": [ -54 -], -"eigen:src/app/Scenes/Onboarding/OnboardingPersonalization/OnboardingPersonalizationModal.tsx": [ -20 -], -"eigen:src/app/Scenes/Onboarding/OnboardingWebView.tsx": [ -5 -], -"eigen:src/app/Scenes/Onboarding/OnboardingWelcome.tsx": [ -13 -], -"eigen:src/app/Scenes/SellWithArtsy/SubmitArtwork/ArtworkSubmitted.tsx": [ -15 -], -"eigen:src/app/Scenes/SellWithArtsy/SubmitArtwork/SubmitArtwork.tsx": [ -24 -], -"eigen:src/app/utils/track/index.tsx": [ -59 -] -} diff --git a/its/ruling/src/test/expected/jsts/postgraphql/typescript-S4023.json b/its/ruling/src/test/expected/jsts/postgraphql/typescript-S4023.json deleted file mode 100644 index 929f10e080..0000000000 --- a/its/ruling/src/test/expected/jsts/postgraphql/typescript-S4023.json +++ /dev/null @@ -1,8 +0,0 @@ -{ -"postgraphql:src/postgres/inventory/collection/PgCollectionKey.ts": [ -292 -], -"postgraphql:src/postgres/inventory/type/PgClassType.ts": [ -8 -] -} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/NoEmptyInterfaceCheck.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/NoEmptyInterfaceCheck.java index 5477e6f663..b4056407d2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/NoEmptyInterfaceCheck.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/NoEmptyInterfaceCheck.java @@ -19,6 +19,7 @@ */ package org.sonar.javascript.checks; +import java.util.List; import org.sonar.check.Rule; import org.sonar.plugins.javascript.api.EslintBasedCheck; import org.sonar.plugins.javascript.api.TypeScriptRule; @@ -31,4 +32,14 @@ public class NoEmptyInterfaceCheck implements EslintBasedCheck { public String eslintKey() { return "no-empty-interface"; } + + @Override + public List configurations() { + return List.of(new Config()); + } + + private static class Config { + + boolean allowSingleExtends = true; + } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/NoEmptyInterfaceCheckTest.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/NoEmptyInterfaceCheckTest.java new file mode 100644 index 0000000000..99c8e52352 --- /dev/null +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/NoEmptyInterfaceCheckTest.java @@ -0,0 +1,34 @@ +/* + * SonarQube JavaScript Plugin + * Copyright (C) 2011-2023 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.javascript.checks; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.gson.Gson; +import org.junit.jupiter.api.Test; + +class NoEmptyInterfaceCheckTest { + + @Test + void configurations() { + String configAsString = new Gson().toJson(new NoEmptyInterfaceCheck().configurations()); + assertThat(configAsString).isEqualTo("[{\"allowSingleExtends\":true}]"); + } +}