Skip to content

Commit

Permalink
Replace devDependency @typescript-eslint/experimental-utils with `@…
Browse files Browse the repository at this point in the history
…typescript-eslint/utils` (SonarSource#453)
  • Loading branch information
yassin-kammoun-sonarsource authored Mar 22, 2024
1 parent e8d2d08 commit abcd666
Show file tree
Hide file tree
Showing 51 changed files with 52 additions and 76 deletions.
26 changes: 1 addition & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"@types/lodash": "4.14.182",
"@types/minimist": "1.2.2",
"@types/node": "14.14.31",
"@typescript-eslint/experimental-utils": "5.30.7",
"@typescript-eslint/parser": "5.30.7",
"@typescript-eslint/utils": "5.30.7",
"eslint": "8.47.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

const sonarjsRules: string[] = [
'cognitive-complexity',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/cognitive-complexity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S3776

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import { isIfStatement, isLogicalExpression } from '../utils/nodes';
import {
getFirstToken,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/elseif-without-else.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S126

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';

const rule: TSESLint.RuleModule<string, string[]> = {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/max-switch-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1479

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';

const DEFAULT_MAX_SWITCH_CASES = 30;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-all-duplicated-branches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S3923

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isIfStatement } from '../utils/nodes';
import { areEquivalent } from '../utils/equivalence';
import { collectIfBranches, collectSwitchBranches } from '../utils/conditions';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-collapsible-if.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1066

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isIfStatement, isBlockStatement } from '../utils/nodes';
import { report, issueLocation } from '../utils/locations';
import docsUrl from '../utils/docs-url';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-collection-size-mischeck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S3981

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isRequiredParserServices, RequiredParserServices } from '../utils/parser-services';
import docsUrl from '../utils/docs-url';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-duplicate-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1192

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';
import { issueLocation, report } from '../utils/locations';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-duplicated-branches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1871

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isIfStatement, isBlockStatement } from '../utils/nodes';
import { areEquivalent } from '../utils/equivalence';
import { collectIfBranches, takeWithoutBreak, collectSwitchBranches } from '../utils/conditions';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-element-overwrite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S4143

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import { areEquivalent } from '../utils/equivalence';
import {
isExpressionStatement,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-empty-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S4158

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
isIdentifier,
findFirstMatchingAncestor,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-extra-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S930

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
isArrowFunctionExpression,
isFunctionDeclaration,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-gratuitous-expressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S2589

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import { report } from '../utils/locations';
import { isIdentifier, isIfStatement } from '../utils/nodes';
import docsUrl from '../utils/docs-url';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-identical-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1862

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { areEquivalent } from '../utils/equivalence';
import { report, issueLocation } from '../utils/locations';
import docsUrl from '../utils/docs-url';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-identical-expressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1764

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isIdentifier, isLiteral } from '../utils/nodes';
import { areEquivalent } from '../utils/equivalence';
import { report, issueLocation, IssueLocation } from '../utils/locations';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-identical-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S4144

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { areEquivalent } from '../utils/equivalence';
import { getMainFunctionTokenLocation, report, issueLocation } from '../utils/locations';
import docsUrl from '../utils/docs-url';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-ignored-return.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S2201

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isRequiredParserServices, RequiredParserServices } from '../utils/parser-services';
import docsUrl from '../utils/docs-url';
import { getTypeFromTreeNode } from '../utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-inverted-boolean-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1940

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isBinaryExpression } from '../utils/nodes';
import docsUrl from '../utils/docs-url';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-nested-switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1821

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';

const rule: TSESLint.RuleModule<string, string[]> = {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-nested-template-literals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S4624

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { ancestorsChain } from '../utils';
import docsUrl from '../utils/docs-url';

Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-one-iteration-loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1751

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { Rule } from 'eslint';
import { isContinueStatement } from '../utils/nodes';
import docsUrl from '../utils/docs-url';
Expand All @@ -38,7 +38,7 @@ const rule: TSESLint.RuleModule<string, string[]> = {
url: docsUrl(__filename),
},
},
// @ts-ignore The typings of @typescript-eslint/experimental-utils does not contain the 'onX' methods.
// @ts-ignore The typings of @typescript-eslint/utils does not contain the 'onX' methods.
create(context) {
const loopingNodes: Set<TSESTree.Node> = new Set();
const loops: Set<TSESTree.Node> = new Set();
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-redundant-boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1125

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isBooleanLiteral, isIfStatement, isConditionalExpression } from '../utils/nodes';
import docsUrl from '../utils/docs-url';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-redundant-jump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S3626

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';

const loops = 'WhileStatement, ForStatement, DoWhileStatement, ForInStatement, ForOfStatement';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-same-line-conditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S3972

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';
import { issueLocation, report } from '../utils/locations';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-small-switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1301

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';

const rule: TSESLint.RuleModule<string, string[]> = {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unused-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S4030

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import { collectionConstructor, writingMethods } from '../utils/collections';
import docsUrl from '../utils/docs-url';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-use-of-empty-return-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S3699

import { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESTree, TSESLint } from '@typescript-eslint/utils';
import { isFunctionExpression, isArrowFunctionExpression, isBlockStatement } from '../utils/nodes';
import docsUrl from '../utils/docs-url';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-useless-catch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1940

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import { isThrowStatement } from '../utils/nodes';
import { areEquivalent } from '../utils/equivalence';
import docsUrl from '../utils/docs-url';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/non-existent-operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S2757

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';

const rule: TSESLint.RuleModule<string, string[]> = {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-immediate-return.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1488

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
isReturnStatement,
isThrowStatement,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-object-literal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S2428

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
isModuleDeclaration,
isVariableDeclaration,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-single-boolean-return.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// https://sonarsource.github.io/rspec/#/rspec/S1126
import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';
import {
isReturnStatement,
isBlockStatement,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-while.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
// https://sonarsource.github.io/rspec/#/rspec/S1264

import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import docsUrl from '../utils/docs-url';

const rule: TSESLint.RuleModule<string, string[]> = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import type { TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { isIfStatement } from './nodes';

/** Returns a list of statements corresponding to a `if - else if - else` chain */
Expand Down
2 changes: 1 addition & 1 deletion src/utils/equivalence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';

/**
* Equivalence is implemented by comparing node types and their tokens.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

import type { TSESTree } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/utils';

export function getJsxShortCircuitNodes(logicalExpression: TSESTree.LogicalExpression) {
if (logicalExpression.parent?.type !== 'JSXExpressionContainer') {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

import type { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree, TSESLint } from '@typescript-eslint/utils';

type Writeable<T> = { -readonly [P in keyof T]: T[P] };
export type MutableReportDescriptor = Writeable<TSESLint.ReportDescriptor<string>>;
Expand Down
Loading

0 comments on commit abcd666

Please # to comment.