Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 007757f

Browse files
Fix missing packages problem (#262)
1 parent b20aa23 commit 007757f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+55
-51
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Rules in this category aim to find places in code which have a high chance of be
1414
* Function calls should not pass extra arguments ([`no-extra-arguments`])
1515
* Related "if/else if" statements should not have the same condition ([`no-identical-conditions`])
1616
* Identical expressions should not be used on both sides of a binary operator ([`no-identical-expressions`])
17-
* Return values from functions without side effects should not be ignored ([`no-ignored-return`])
17+
* Return values from functions without side effects should not be ignored ([`no-ignored-return`]) (*uses-types*)
1818
* Loops with at most one iteration should be refactored ([`no-one-iteration-loop`])
1919
* The output of functions that don't return anything should not be used ([`no-use-of-empty-return-value`])
2020
* Non-existent operators '=+', '=-' and '=!' should not be used ([`non-existent-operator`])
@@ -27,7 +27,7 @@ Code Smells, or maintainability issues, are raised for places of code which migh
2727
* "if ... else if" constructs should end with "else" clauses ([`elseif-without-else`]) (*disabled*)
2828
* "switch" statements should not have too many "case" clauses ([`max-switch-cases`])
2929
* Collapsible "if" statements should be merged ([`no-collapsible-if`])
30-
* Collection sizes and array length comparisons should make sense ([`no-collection-size-mischeck`])
30+
* Collection sizes and array length comparisons should make sense ([`no-collection-size-mischeck`]) (*uses-types*)
3131
* String literals should not be duplicated ([`no-duplicate-string`])
3232
* Two branches in a conditional structure should not have exactly the same implementation ([`no-duplicated-branches`])
3333
* Boolean expressions should not be gratuitous ([`no-gratuitous-expressions`])
@@ -81,7 +81,8 @@ Code Smells, or maintainability issues, are raised for places of code which migh
8181

8282
## Prerequisites
8383

84-
Node.js (>=10.x).
84+
* Node.js (>=10.x).
85+
* ESLint 5.x, 6.x or 7.x (peer dependency for the plugin).
8586

8687
## Usage
8788

@@ -120,6 +121,7 @@ npm install eslint-plugin-sonarjs -g # or install globally
120121
}
121122
}
122123
```
124+
* To enable all rules of this plugin use `@typescript-eslint/parser` as a parser for ESLint ([like we do](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/6e06d59a233e07b28fbbd6398e08b9b0c63b18f9/.eslintrc.js#L4)). Thanks to it, type information is available, which is beneficial or even essential for some rules.
123125

124126
## Available Configurations
125127

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* along with this program; if not, write to the Free Software Foundation,
1818
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1919
*/
20-
import { TSESLint } from '@typescript-eslint/experimental-utils';
20+
import type { TSESLint } from '@typescript-eslint/experimental-utils';
2121

2222
const sonarjsRules: string[] = [
2323
'cognitive-complexity',

src/rules/cognitive-complexity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S3776
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { isArrowFunctionExpression, isIfStatement, isLogicalExpression } from '../utils/nodes';
2424
import {
2525
getMainFunctionTokenLocation,

src/rules/elseif-without-else.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S126
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { Rule } from '../utils/types';
2424
import docsUrl from '../utils/docs-url';
2525

src/rules/max-switch-cases.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S1479
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { Rule } from '../utils/types';
2424
import docsUrl from '../utils/docs-url';
2525

src/rules/no-all-duplicated-branches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S3923
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { Rule } from '../utils/types';
2424
import { isIfStatement } from '../utils/nodes';
2525
import { areEquivalent } from '../utils/equivalence';

src/rules/no-collapsible-if.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S1066
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { Rule } from '../utils/types';
2424
import { isIfStatement, isBlockStatement } from '../utils/nodes';
2525
import { report, issueLocation } from '../utils/locations';

src/rules/no-collection-size-mischeck.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S3981
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { Rule } from '../utils/types';
2424
import { isRequiredParserServices, RequiredParserServices } from '../utils/parser-services';
2525
import docsUrl from '../utils/docs-url';

src/rules/no-duplicate-string.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S1192
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { Rule } from '../utils/types';
2424
import docsUrl from '../utils/docs-url';
2525

src/rules/no-duplicated-branches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
// https://sonarsource.github.io/rspec/#/rspec/S1871
2121

22-
import { TSESTree } from '@typescript-eslint/experimental-utils';
22+
import type { TSESTree } from '@typescript-eslint/experimental-utils';
2323
import { Rule } from '../utils/types';
2424
import { isIfStatement, isBlockStatement } from '../utils/nodes';
2525
import { areEquivalent } from '../utils/equivalence';

0 commit comments

Comments
 (0)