Skip to content

Commit

Permalink
Fix FP S4023 (no-empty-interface): Ignore when extending external i…
Browse files Browse the repository at this point in the history
…nterfaces (#4326)
  • Loading branch information
yassin-kammoun-sonarsource committed Oct 30, 2023
1 parent d05b83c commit 017476f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 144 deletions.
Original file line number Diff line number Diff line change
@@ -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
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"ag-grid:src/ts/filter/filter.ts": [
4
],
"ag-grid:src/ts/filter/floatingFilter.ts": [
14
],
Expand All @@ -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
]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
"console:src/mutations/UpdateRelationMutation.ts": [
17
],
"console:src/utils/classnames.ts": [
10
],
"console:src/views/CLIAuthView/CLIAuthSuccessView.tsx": [
5
],
Expand Down
101 changes: 0 additions & 101 deletions its/ruling/src/test/expected/jsts/eigen/typescript-S4023.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -31,4 +32,14 @@ public class NoEmptyInterfaceCheck implements EslintBasedCheck {
public String eslintKey() {
return "no-empty-interface";
}

@Override
public List<Object> configurations() {
return List.of(new Config());
}

private static class Config {

boolean allowSingleExtends = true;
}
}
Original file line number Diff line number Diff line change
@@ -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}]");
}
}

0 comments on commit 017476f

Please sign in to comment.