-
Notifications
You must be signed in to change notification settings - Fork 101
Add SonarTS converters. #1085
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
Merged
Merged
Add SonarTS converters. #1085
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
08ece68
Add SonarTS converters.
Res42 3b9deac
Fix plugin name.
Res42 6e02891
Add no-empty merger.
Res42 e3e2138
Add no-use-before-define merger.
Res42 f26db32
Fix no-extra-semicolon converter.
Res42 60f14d8
Add no-return-type-any converter.
Res42 4462691
Add no-alphabetical-sort converter.
Res42 0656cb9
Remove no-return-type-any converter.
Res42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...converters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/cognitive-complexity.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertCognitiveComplexity: RuleConverter = (tslintRule) => { | ||
return { | ||
rules: [ | ||
{ | ||
...(tslintRule.ruleArguments.length !== 0 && { | ||
ruleArguments: tslintRule.ruleArguments, | ||
}), | ||
ruleName: "sonarjs/cognitive-complexity", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
11 changes: 11 additions & 0 deletions
11
...onverters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/consecutive-overloads.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertConsecutiveOverloads: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleName: "@typescript-eslint/adjacent-overload-signatures", | ||
}, | ||
], | ||
}; | ||
}; |
15 changes: 15 additions & 0 deletions
15
src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/max-switch-cases.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertMaxSwitchCases: RuleConverter = (tslintRule) => { | ||
return { | ||
rules: [ | ||
{ | ||
...(tslintRule.ruleArguments.length !== 0 && { | ||
ruleArguments: tslintRule.ruleArguments, | ||
}), | ||
ruleName: "sonarjs/max-switch-cases", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
...ters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-all-duplicated-branches.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoAllDuplicatedBranches: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleName: "sonarjs/no-all-duplicated-branches", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
...converters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-alphabetical-sort.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoAlphabeticalSort: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleArguments: [{ ignoreStringArrays: true }], | ||
ruleName: "@typescript-eslint/require-array-sort-compare", | ||
}, | ||
], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-big-function.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoBigFunction: RuleConverter = (tslintRule) => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleArguments: [{ max: tslintRule.ruleArguments[0] ?? 200 }], | ||
ruleName: "max-lines-per-function", | ||
}, | ||
], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-collapsible-if.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoCollapsibleIf: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleName: "sonarjs/no-collapsible-if", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
...ers/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-collection-size-mischeck.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoCollectionSizeMischeck: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleName: "sonarjs/no-collection-size-mischeck", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
15 changes: 15 additions & 0 deletions
15
src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-duplicate-string.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoDuplicateString: RuleConverter = (tslintRule) => { | ||
return { | ||
rules: [ | ||
{ | ||
...(tslintRule.ruleArguments.length !== 0 && { | ||
ruleArguments: tslintRule.ruleArguments, | ||
}), | ||
ruleName: "sonarjs/no-duplicate-string", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
...nverters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-duplicated-branches.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoDuplicatedBranches: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleName: "sonarjs/no-duplicated-branches", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
...converters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-element-overwrite.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoElementOverwrite: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleName: "sonarjs/no-element-overwrite", | ||
}, | ||
], | ||
plugins: ["sonarjs"], | ||
}; | ||
}; |
11 changes: 11 additions & 0 deletions
11
...nverters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-empty-destructuring.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoEmptyDestructuring: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleName: "no-empty-pattern", | ||
}, | ||
], | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
...nverters/lintConfigs/rules/ruleConverters/eslint-plugin-sonarjs/no-empty-nested-blocks.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RuleConverter } from "../../ruleConverter"; | ||
|
||
export const convertNoEmptyNestedBlocks: RuleConverter = () => { | ||
return { | ||
rules: [ | ||
{ | ||
ruleArguments: [{ allowEmptyCatch: true }], | ||
ruleName: "no-empty", | ||
}, | ||
], | ||
}; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.