diff --git a/.eslintrc.json b/.eslintrc.json index 6d158a2c..5d6ad34e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,7 +30,14 @@ "@typescript-eslint/no-non-null-assertion": "error", "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", - "no-control-regex": "off" + "no-control-regex": "off", + "@typescript-eslint/consistent-type-imports": [ + "error", + { + "prefer": "type-imports", + "fixStyle": "separate-type-imports" + } + ] }, "overrides": [ { diff --git a/package-lock.json b/package-lock.json index 986aa504..47951bb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "glob": "13.0.6", "husky": "9.1.7", "lint-staged": "^17.0.0", - "mocha": "11.6.0", + "mocha": "11.8.0", "node-gyp": "^13.0.0", "prettier": "3.9.6", "react": "19.2.8", @@ -3984,9 +3984,9 @@ } }, "node_modules/mocha": { - "version": "11.6.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.6.0.tgz", - "integrity": "sha512-i0JVb+OUBqw63X/1pC3jCyJsqYisgxySBbsQa8TKvefpA1oEnw7JXxXnftfMHRsw7bEEVGRtVlHcDYXBa7FzVw==", + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.8.0.tgz", + "integrity": "sha512-VyCeUdGN3A9lmCTTgG4yuvY9ixxaDk+xt2R/7/+1AP6EqNG+G9OKkzBwhVtVYoNX8YsxNSgAl8mOv3IAeOpFbw==", "dev": true, "license": "MIT", "dependencies": { @@ -3998,6 +3998,7 @@ "find-up": "^5.0.0", "glob": "^10.4.5", "he": "^1.2.0", + "is-path-inside": "^3.0.3", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", "minimatch": "^9.0.5", @@ -4030,9 +4031,10 @@ } }, "node_modules/mocha/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", "dev": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 3d10bee0..88967d69 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "glob": "13.0.6", "husky": "9.1.7", "lint-staged": "^17.0.0", - "mocha": "11.6.0", + "mocha": "11.8.0", "node-gyp": "^13.0.0", "prettier": "3.9.6", "react": "19.2.8", diff --git a/src/gherkin/extractStepTexts.ts b/src/gherkin/extractStepTexts.ts index 574945d7..934b7898 100644 --- a/src/gherkin/extractStepTexts.ts +++ b/src/gherkin/extractStepTexts.ts @@ -1,5 +1,5 @@ import { walkGherkinDocument } from '@cucumber/gherkin-utils' -import { GherkinDocument } from '@cucumber/messages' +import type { GherkinDocument } from '@cucumber/messages' export function extractStepTexts( gherkinDocument: GherkinDocument, diff --git a/src/gherkin/parseGherkinDocument.ts b/src/gherkin/parseGherkinDocument.ts index d1fdfa50..9b894e20 100644 --- a/src/gherkin/parseGherkinDocument.ts +++ b/src/gherkin/parseGherkinDocument.ts @@ -1,5 +1,7 @@ -import { AstBuilder, Errors, GherkinClassicTokenMatcher, Parser } from '@cucumber/gherkin' -import { GherkinDocument, IdGenerator } from '@cucumber/messages' +import type { Errors } from '@cucumber/gherkin' +import { AstBuilder, GherkinClassicTokenMatcher, Parser } from '@cucumber/gherkin' +import type { GherkinDocument } from '@cucumber/messages' +import { IdGenerator } from '@cucumber/messages' const uuidFn = IdGenerator.uuid() diff --git a/src/index/bruteForceIndex.ts b/src/index/bruteForceIndex.ts index 7857ee0b..86d2b67d 100644 --- a/src/index/bruteForceIndex.ts +++ b/src/index/bruteForceIndex.ts @@ -1,5 +1,5 @@ -import { Suggestion } from '../suggestions/types.js' -import { Index } from './types' +import type { Suggestion } from '../suggestions/types.js' +import type { Index } from './types' /** * A brute force (not very performant or fuzzy-search capable) index that matches permutation expressions with string.includes() diff --git a/src/index/fuseIndex.ts b/src/index/fuseIndex.ts index 96730754..2b776e37 100644 --- a/src/index/fuseIndex.ts +++ b/src/index/fuseIndex.ts @@ -1,7 +1,7 @@ import Fuse from 'fuse.js' -import { Suggestion } from '../suggestions/types.js' -import { Index } from './types.js' +import type { Suggestion } from '../suggestions/types.js' +import type { Index } from './types.js' type Doc = { text: string diff --git a/src/index/jsSearchIndex.ts b/src/index/jsSearchIndex.ts index 6f95a591..4181982d 100644 --- a/src/index/jsSearchIndex.ts +++ b/src/index/jsSearchIndex.ts @@ -1,7 +1,7 @@ import { Search } from 'js-search' -import { Suggestion } from '../suggestions/types.js' -import { Index } from './types.js' +import type { Suggestion } from '../suggestions/types.js' +import type { Index } from './types.js' type Doc = { id: number diff --git a/src/index/types.ts b/src/index/types.ts index 63b0b470..a77b9857 100644 --- a/src/index/types.ts +++ b/src/index/types.ts @@ -4,6 +4,6 @@ * @param text a text to search for * @return results in the form of suggestions */ -import { Suggestion } from '../suggestions/types.js' +import type { Suggestion } from '../suggestions/types.js' export type Index = (text: string) => readonly Suggestion[] diff --git a/src/language/ExpressionBuilder.ts b/src/language/ExpressionBuilder.ts index 54567a06..f27d5030 100644 --- a/src/language/ExpressionBuilder.ts +++ b/src/language/ExpressionBuilder.ts @@ -1,12 +1,9 @@ -import { - ExpressionFactory, - ParameterType, - ParameterTypeRegistry, -} from '@cucumber/cucumber-expressions' +import type { ParameterType } from '@cucumber/cucumber-expressions' +import { ExpressionFactory, ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import { createLocationLink, makeParameterType, sortLinks } from './helpers.js' import { SourceAnalyzer } from './SourceAnalyzer.js' -import { +import type { ExpressionBuilderResult, ExpressionLink, LanguageName, diff --git a/src/language/SourceAnalyzer.ts b/src/language/SourceAnalyzer.ts index ce015de1..742fec60 100644 --- a/src/language/SourceAnalyzer.ts +++ b/src/language/SourceAnalyzer.ts @@ -1,9 +1,9 @@ -import { RegExps, StringOrRegExp } from '@cucumber/cucumber-expressions' -import { LocationLink } from 'vscode-languageserver-types' +import type { RegExps, StringOrRegExp } from '@cucumber/cucumber-expressions' +import type { LocationLink } from 'vscode-languageserver-types' import { createLocationLink, makeParameterType, syntaxNode } from './helpers.js' import { getLanguage } from './languages.js' -import { +import type { Language, LanguageName, ParameterTypeLink, diff --git a/src/language/csharpLanguage.ts b/src/language/csharpLanguage.ts index 15da788c..548d3c90 100644 --- a/src/language/csharpLanguage.ts +++ b/src/language/csharpLanguage.ts @@ -1,7 +1,7 @@ -import { StringOrRegExp } from '@cucumber/cucumber-expressions' +import type { StringOrRegExp } from '@cucumber/cucumber-expressions' import { childrenToString, NO_QUOTES } from './helpers.js' -import { Language, TreeSitterSyntaxNode } from './types.js' +import type { Language, TreeSitterSyntaxNode } from './types.js' export const csharpLanguage: Language = { toParameterTypeName(node: TreeSitterSyntaxNode) { diff --git a/src/language/goLanguage.ts b/src/language/goLanguage.ts index a8fbdf6a..ab6f0736 100644 --- a/src/language/goLanguage.ts +++ b/src/language/goLanguage.ts @@ -1,7 +1,7 @@ -import { StringOrRegExp } from '@cucumber/cucumber-expressions' +import type { StringOrRegExp } from '@cucumber/cucumber-expressions' import { unsupportedOperation } from './helpers.js' -import { Language, TreeSitterSyntaxNode } from './types.js' +import type { Language, TreeSitterSyntaxNode } from './types.js' export const goLanguage: Language = { toParameterTypeName: unsupportedOperation, diff --git a/src/language/helpers.ts b/src/language/helpers.ts index 8d4b6de4..aacfd200 100644 --- a/src/language/helpers.ts +++ b/src/language/helpers.ts @@ -1,7 +1,9 @@ -import { ParameterType, RegExps } from '@cucumber/cucumber-expressions' -import { DocumentUri, LocationLink, Range } from 'vscode-languageserver-types' +import type { RegExps } from '@cucumber/cucumber-expressions' +import { ParameterType } from '@cucumber/cucumber-expressions' +import type { DocumentUri, LocationLink } from 'vscode-languageserver-types' +import { Range } from 'vscode-languageserver-types' -import { Link, NodePredicate, TreeSitterQueryMatch, TreeSitterSyntaxNode } from './types' +import type { Link, NodePredicate, TreeSitterQueryMatch, TreeSitterSyntaxNode } from './types' export function syntaxNode(match: TreeSitterQueryMatch, name: string): TreeSitterSyntaxNode | null { const nodes = syntaxNodes(match, name) diff --git a/src/language/javaLanguage.ts b/src/language/javaLanguage.ts index dc76aab3..a0519cc8 100644 --- a/src/language/javaLanguage.ts +++ b/src/language/javaLanguage.ts @@ -1,4 +1,4 @@ -import { Language, TreeSitterSyntaxNode } from './types.js' +import type { Language, TreeSitterSyntaxNode } from './types.js' export const javaLanguage: Language = { toParameterTypeName(node) { diff --git a/src/language/javascriptLanguage.ts b/src/language/javascriptLanguage.ts index da2a23d7..a3d06dea 100644 --- a/src/language/javascriptLanguage.ts +++ b/src/language/javascriptLanguage.ts @@ -1,5 +1,5 @@ import { tsxLanguage } from './tsxLanguage.js' -import { Language } from './types.js' +import type { Language } from './types.js' export const javascriptLanguage: Language = { ...tsxLanguage, diff --git a/src/language/languages.ts b/src/language/languages.ts index 7b325b1b..79603df7 100644 --- a/src/language/languages.ts +++ b/src/language/languages.ts @@ -8,7 +8,7 @@ import { rubyLanguage } from './rubyLanguage.js' import { rustLanguage } from './rustLanguage.js' import { scalaLanguage } from './scalaLanguage.js' import { tsxLanguage } from './tsxLanguage.js' -import { Language, LanguageName } from './types.js' +import type { Language, LanguageName } from './types.js' const languageByName: Record = { java: javaLanguage, diff --git a/src/language/phpLanguage.ts b/src/language/phpLanguage.ts index 374b3376..6e34b9c2 100644 --- a/src/language/phpLanguage.ts +++ b/src/language/phpLanguage.ts @@ -1,5 +1,5 @@ import { unsupportedOperation } from './helpers.js' -import { Language } from './types.js' +import type { Language } from './types.js' export const phpLanguage: Language = { toParameterTypeName: unsupportedOperation, diff --git a/src/language/pythonLanguage.ts b/src/language/pythonLanguage.ts index a0955122..52193de8 100644 --- a/src/language/pythonLanguage.ts +++ b/src/language/pythonLanguage.ts @@ -1,6 +1,6 @@ -import { RegExps, StringOrRegExp } from '@cucumber/cucumber-expressions' +import type { RegExps, StringOrRegExp } from '@cucumber/cucumber-expressions' -import { Language, TreeSitterSyntaxNode } from './types.js' +import type { Language, TreeSitterSyntaxNode } from './types.js' export const pythonLanguage: Language = { toParameterTypeName(node: TreeSitterSyntaxNode): string { diff --git a/src/language/rubyLanguage.ts b/src/language/rubyLanguage.ts index 382df843..63a2c4d2 100644 --- a/src/language/rubyLanguage.ts +++ b/src/language/rubyLanguage.ts @@ -1,8 +1,8 @@ -import { StringOrRegExp } from '@cucumber/cucumber-expressions' -import { RegExps } from '@cucumber/cucumber-expressions/dist/cjs/src/ParameterType' +import type { StringOrRegExp } from '@cucumber/cucumber-expressions' +import type { RegExps } from '@cucumber/cucumber-expressions/dist/cjs/src/ParameterType' import { childrenToString, filter, NO_QUOTES } from './helpers.js' -import { Language, NodePredicate, TreeSitterSyntaxNode } from './types.js' +import type { Language, NodePredicate, TreeSitterSyntaxNode } from './types.js' export const rubyLanguage: Language = { toParameterTypeName(node) { diff --git a/src/language/rustLanguage.ts b/src/language/rustLanguage.ts index 194eadfb..1b123bc9 100644 --- a/src/language/rustLanguage.ts +++ b/src/language/rustLanguage.ts @@ -1,4 +1,4 @@ -import { Language, TreeSitterSyntaxNode } from './types.js' +import type { Language, TreeSitterSyntaxNode } from './types.js' export const rustLanguage: Language = { toParameterTypeName(node) { diff --git a/src/language/scalaLanguage.ts b/src/language/scalaLanguage.ts index 7a8577ae..cc3677d9 100644 --- a/src/language/scalaLanguage.ts +++ b/src/language/scalaLanguage.ts @@ -1,4 +1,4 @@ -import { Language, TreeSitterSyntaxNode } from './types.js' +import type { Language, TreeSitterSyntaxNode } from './types.js' export const scalaLanguage: Language = { toParameterTypeName(node) { diff --git a/src/language/tsxLanguage.ts b/src/language/tsxLanguage.ts index edd43257..8eb78b14 100644 --- a/src/language/tsxLanguage.ts +++ b/src/language/tsxLanguage.ts @@ -1,9 +1,9 @@ -import { StringOrRegExp } from '@cucumber/cucumber-expressions' -import { RegExps } from '@cucumber/cucumber-expressions' +import type { StringOrRegExp } from '@cucumber/cucumber-expressions' +import type { RegExps } from '@cucumber/cucumber-expressions' import { childrenToString, filter, NO_QUOTES } from './helpers.js' import { NO_EXPRESSION } from './SourceAnalyzer.js' -import { Language, TreeSitterSyntaxNode } from './types.js' +import type { Language, TreeSitterSyntaxNode } from './types.js' export const tsxLanguage: Language = { toParameterTypeName(node) { diff --git a/src/language/types.ts b/src/language/types.ts index 7929b75f..b29812cf 100644 --- a/src/language/types.ts +++ b/src/language/types.ts @@ -1,11 +1,11 @@ -import { +import type { Expression, ParameterType, ParameterTypeRegistry, StringOrRegExp, } from '@cucumber/cucumber-expressions' -import { RegExps } from '@cucumber/cucumber-expressions/dist/cjs/src/ParameterType' -import { DocumentUri, LocationLink } from 'vscode-languageserver-types' +import type { RegExps } from '@cucumber/cucumber-expressions/dist/cjs/src/ParameterType' +import type { DocumentUri, LocationLink } from 'vscode-languageserver-types' export type ParameterTypeName = | 'int' diff --git a/src/messages/MessagesBuilder.ts b/src/messages/MessagesBuilder.ts index dae02885..b827d779 100644 --- a/src/messages/MessagesBuilder.ts +++ b/src/messages/MessagesBuilder.ts @@ -1,14 +1,15 @@ +import type { Expression } from '@cucumber/cucumber-expressions' import { - Expression, ExpressionFactory, ParameterType, ParameterTypeRegistry, } from '@cucumber/cucumber-expressions' -import { Envelope, StepDefinitionPatternType } from '@cucumber/messages' +import type { Envelope } from '@cucumber/messages' +import { StepDefinitionPatternType } from '@cucumber/messages' import { extractStepTexts } from '../gherkin/extractStepTexts.js' import { buildSuggestions } from '../suggestions/buildSuggestions.js' -import { Suggestion } from '../suggestions/types.js' +import type { Suggestion } from '../suggestions/types.js' export type MessagesBuilderResult = { suggestions: readonly Suggestion[] diff --git a/src/service/getGenerateSnippetCodeAction.ts b/src/service/getGenerateSnippetCodeAction.ts index 7f64d861..e87608dd 100644 --- a/src/service/getGenerateSnippetCodeAction.ts +++ b/src/service/getGenerateSnippetCodeAction.ts @@ -1,17 +1,16 @@ -import { CucumberExpressionGenerator, ParameterTypeRegistry } from '@cucumber/cucumber-expressions' +import type { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' +import { CucumberExpressionGenerator } from '@cucumber/cucumber-expressions' +import type { CodeAction, Diagnostic, LocationLink } from 'vscode-languageserver-types' import { - CodeAction, CodeActionKind, CreateFile, - Diagnostic, - LocationLink, TextDocumentEdit, TextEdit, VersionedTextDocumentIdentifier, } from 'vscode-languageserver-types' import { getLanguage } from '../language/languages.js' -import { LanguageName } from '../language/types.js' +import type { LanguageName } from '../language/types.js' import { diagnosticCodeUndefinedStep } from './constants.js' import { stepDefinitionSnippet } from './snippet/stepDefinitionSnippet.js' diff --git a/src/service/getGherkinCompletionItems.ts b/src/service/getGherkinCompletionItems.ts index 7369c15a..3c099fbf 100644 --- a/src/service/getGherkinCompletionItems.ts +++ b/src/service/getGherkinCompletionItems.ts @@ -1,11 +1,7 @@ -import { - CompletionItem, - CompletionItemKind, - InsertTextFormat, - Position, -} from 'vscode-languageserver-types' +import type { CompletionItem, Position } from 'vscode-languageserver-types' +import { CompletionItemKind, InsertTextFormat } from 'vscode-languageserver-types' -import { Index } from '../index/index.js' +import type { Index } from '../index/index.js' import { getStepRange } from './helpers.js' import { lspCompletionSnippet } from './snippet/lspCompletionSnippet.js' diff --git a/src/service/getGherkinDiagnostics.ts b/src/service/getGherkinDiagnostics.ts index d5442da6..9bc9ba8b 100644 --- a/src/service/getGherkinDiagnostics.ts +++ b/src/service/getGherkinDiagnostics.ts @@ -1,8 +1,9 @@ -import { Expression } from '@cucumber/cucumber-expressions' +import type { Expression } from '@cucumber/cucumber-expressions' import { dialects, Errors } from '@cucumber/gherkin' import { walkGherkinDocument } from '@cucumber/gherkin-utils' -import * as messages from '@cucumber/messages' -import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-types' +import type * as messages from '@cucumber/messages' +import type { Diagnostic } from 'vscode-languageserver-types' +import { DiagnosticSeverity } from 'vscode-languageserver-types' import { parseGherkinDocument } from '../gherkin/parseGherkinDocument.js' import { CONTAINS_PARAMETERS, diagnosticCodeUndefinedStep } from './constants.js' diff --git a/src/service/getGherkinDocumentFeatureSymbol.ts b/src/service/getGherkinDocumentFeatureSymbol.ts index 784eaec7..b1e76ff7 100644 --- a/src/service/getGherkinDocumentFeatureSymbol.ts +++ b/src/service/getGherkinDocumentFeatureSymbol.ts @@ -1,6 +1,7 @@ import { walkGherkinDocument } from '@cucumber/gherkin-utils' -import * as messages from '@cucumber/messages' -import { DocumentSymbol, Position, Range, SymbolKind } from 'vscode-languageserver-types' +import type * as messages from '@cucumber/messages' +import type { DocumentSymbol } from 'vscode-languageserver-types' +import { Position, Range, SymbolKind } from 'vscode-languageserver-types' import { parseGherkinDocument } from '../gherkin/parseGherkinDocument.js' diff --git a/src/service/getGherkinFormattingEdits.ts b/src/service/getGherkinFormattingEdits.ts index a7e4e219..91f1531d 100644 --- a/src/service/getGherkinFormattingEdits.ts +++ b/src/service/getGherkinFormattingEdits.ts @@ -1,5 +1,5 @@ import { pretty } from '@cucumber/gherkin-utils' -import { TextEdit } from 'vscode-languageserver-types' +import type { TextEdit } from 'vscode-languageserver-types' import { parseGherkinDocument } from '../gherkin/parseGherkinDocument.js' diff --git a/src/service/getGherkinSemanticTokens.ts b/src/service/getGherkinSemanticTokens.ts index 3b5b513d..cf4f0fcb 100644 --- a/src/service/getGherkinSemanticTokens.ts +++ b/src/service/getGherkinSemanticTokens.ts @@ -1,7 +1,8 @@ -import { Expression } from '@cucumber/cucumber-expressions' +import type { Expression } from '@cucumber/cucumber-expressions' import { walkGherkinDocument } from '@cucumber/gherkin-utils' -import * as messages from '@cucumber/messages' -import { SemanticTokens, SemanticTokenTypes } from 'vscode-languageserver-types' +import type * as messages from '@cucumber/messages' +import type { SemanticTokens } from 'vscode-languageserver-types' +import { SemanticTokenTypes } from 'vscode-languageserver-types' import { parseGherkinDocument } from '../gherkin/parseGherkinDocument.js' diff --git a/src/service/getStepDefinitionLocationLinks.ts b/src/service/getStepDefinitionLocationLinks.ts index a4f31a0b..fec044aa 100644 --- a/src/service/getStepDefinitionLocationLinks.ts +++ b/src/service/getStepDefinitionLocationLinks.ts @@ -1,6 +1,6 @@ -import { LocationLink, Position } from 'vscode-languageserver-types' +import type { LocationLink, Position } from 'vscode-languageserver-types' -import { ExpressionLink } from '../language/types.js' +import type { ExpressionLink } from '../language/types.js' import { getStepRange } from './helpers.js' export function getStepDefinitionLocationLinks( diff --git a/src/service/helpers.ts b/src/service/helpers.ts index dc9305c2..303a3e9a 100644 --- a/src/service/helpers.ts +++ b/src/service/helpers.ts @@ -1,5 +1,6 @@ import { walkGherkinDocument } from '@cucumber/gherkin-utils' -import { Position, Range } from 'vscode-languageserver-types' +import type { Position } from 'vscode-languageserver-types' +import { Range } from 'vscode-languageserver-types' import { parseGherkinDocument } from '../gherkin/parseGherkinDocument.js' diff --git a/src/service/snippet/lspCompletionSnippet.ts b/src/service/snippet/lspCompletionSnippet.ts index 49219924..1a2ec449 100644 --- a/src/service/snippet/lspCompletionSnippet.ts +++ b/src/service/snippet/lspCompletionSnippet.ts @@ -3,7 +3,7 @@ * * @param expression the expression to generate the snippet from */ -import { SuggestionSegments } from '../../suggestions/types.js' +import type { SuggestionSegments } from '../../suggestions/types.js' export function lspCompletionSnippet(segments: SuggestionSegments): string { let n = 1 diff --git a/src/service/snippet/stepDefinitionSnippet.ts b/src/service/snippet/stepDefinitionSnippet.ts index 9d91f1a1..8d69d824 100644 --- a/src/service/snippet/stepDefinitionSnippet.ts +++ b/src/service/snippet/stepDefinitionSnippet.ts @@ -1,7 +1,7 @@ -import { GeneratedExpression } from '@cucumber/cucumber-expressions' +import type { GeneratedExpression } from '@cucumber/cucumber-expressions' import mustache from 'mustache' -import { ParameterTypeName, SnippetParameters } from '../../language' +import type { ParameterTypeName, SnippetParameters } from '../../language' type MustacheFunction = () => (text: string, render: (text: string) => string) => string diff --git a/src/suggestions/buildSuggestionFromCucumberExpression.ts b/src/suggestions/buildSuggestionFromCucumberExpression.ts index 194b0003..4430fa68 100644 --- a/src/suggestions/buildSuggestionFromCucumberExpression.ts +++ b/src/suggestions/buildSuggestionFromCucumberExpression.ts @@ -1,13 +1,13 @@ -import { +import type { CucumberExpression, Node, - NodeType, ParameterType, ParameterTypeRegistry, } from '@cucumber/cucumber-expressions' +import { NodeType } from '@cucumber/cucumber-expressions' import { makeKey } from './helpers.js' -import { ParameterChoices, Suggestion, SuggestionSegments } from './types.js' +import type { ParameterChoices, Suggestion, SuggestionSegments } from './types.js' export function buildSuggestionFromCucumberExpression( expression: CucumberExpression, diff --git a/src/suggestions/buildSuggestions.ts b/src/suggestions/buildSuggestions.ts index e8823ced..be4fe3da 100644 --- a/src/suggestions/buildSuggestions.ts +++ b/src/suggestions/buildSuggestions.ts @@ -1,14 +1,10 @@ -import { - CucumberExpression, - Expression, - ParameterTypeRegistry, - RegularExpression, -} from '@cucumber/cucumber-expressions' +import type { Expression, ParameterTypeRegistry } from '@cucumber/cucumber-expressions' +import { CucumberExpression, RegularExpression } from '@cucumber/cucumber-expressions' import { buildSuggestionFromCucumberExpression } from './buildSuggestionFromCucumberExpression.js' import { buildSuggestionsFromRegularExpression } from './buildSuggestionsFromRegularExpression.js' import { makeKey } from './helpers.js' -import { Suggestion } from './types.js' +import type { Suggestion } from './types.js' /** * Builds an array of {@link Suggestion} from steps and step definitions. diff --git a/src/suggestions/buildSuggestionsFromRegularExpression.ts b/src/suggestions/buildSuggestionsFromRegularExpression.ts index fd7c38a6..4c6e78c3 100644 --- a/src/suggestions/buildSuggestionsFromRegularExpression.ts +++ b/src/suggestions/buildSuggestionsFromRegularExpression.ts @@ -1,6 +1,6 @@ -import { ParameterTypeRegistry, RegularExpression } from '@cucumber/cucumber-expressions' +import type { ParameterTypeRegistry, RegularExpression } from '@cucumber/cucumber-expressions' -import { ParameterChoices, Suggestion, SuggestionSegment } from './types' +import type { ParameterChoices, Suggestion, SuggestionSegment } from './types' export function buildSuggestionsFromRegularExpression( expression: RegularExpression, diff --git a/src/suggestions/helpers.ts b/src/suggestions/helpers.ts index 13f74247..f8a25c26 100644 --- a/src/suggestions/helpers.ts +++ b/src/suggestions/helpers.ts @@ -1,4 +1,4 @@ -import { ParameterType } from '@cucumber/cucumber-expressions' +import type { ParameterType } from '@cucumber/cucumber-expressions' export function makeKey(parameterType: ParameterType): string { return parameterType.name || parameterType.regexpStrings.join('|') diff --git a/src/tree-sitter-node/NodeParserAdapter.ts b/src/tree-sitter-node/NodeParserAdapter.ts index c7c34aec..775984f3 100644 --- a/src/tree-sitter-node/NodeParserAdapter.ts +++ b/src/tree-sitter-node/NodeParserAdapter.ts @@ -19,7 +19,7 @@ import Scala from 'tree-sitter-scala' // @ts-ignore import TypeScript from 'tree-sitter-typescript' -import { LanguageName, ParserAdapter } from '../language/types.js' +import type { LanguageName, ParserAdapter } from '../language/types.js' export class NodeParserAdapter implements ParserAdapter { readonly parser = new Parser() diff --git a/src/tree-sitter-wasm/WasmParserAdapter.ts b/src/tree-sitter-wasm/WasmParserAdapter.ts index 29b26696..4d7930d7 100644 --- a/src/tree-sitter-wasm/WasmParserAdapter.ts +++ b/src/tree-sitter-wasm/WasmParserAdapter.ts @@ -1,6 +1,7 @@ import WasmParser from 'web-tree-sitter' -import { LanguageName, LanguageNames, ParserAdapter } from '../language/types.js' +import type { LanguageName, ParserAdapter } from '../language/types.js' +import { LanguageNames } from '../language/types.js' export class WasmParserAdapter implements ParserAdapter { public parser: WasmParser diff --git a/test/index/Index.test.ts b/test/index/Index.test.ts index 48d1bc8e..926bd639 100644 --- a/test/index/Index.test.ts +++ b/test/index/Index.test.ts @@ -1,8 +1,9 @@ import assert from 'assert' import * as txtgen from 'txtgen' -import { bruteForceIndex, fuseIndex, Index, jsSearchIndex } from '../../src/index/index.js' -import { Suggestion } from '../../src/suggestions/types.js' +import type { Index } from '../../src/index/index.js' +import { bruteForceIndex, fuseIndex, jsSearchIndex } from '../../src/index/index.js' +import type { Suggestion } from '../../src/suggestions/types.js' type BuildIndex = (suggestions: readonly Suggestion[]) => Index diff --git a/test/language/ExpressionBuilder.test.ts b/test/language/ExpressionBuilder.test.ts index f55608de..2e3aa745 100644 --- a/test/language/ExpressionBuilder.test.ts +++ b/test/language/ExpressionBuilder.test.ts @@ -1,11 +1,13 @@ -import { CucumberExpression, RegularExpression } from '@cucumber/cucumber-expressions' +import type { RegularExpression } from '@cucumber/cucumber-expressions' +import { CucumberExpression } from '@cucumber/cucumber-expressions' import assert from 'assert' import { readFile } from 'fs/promises' import { glob } from 'glob' import { basename, resolve } from 'path' -import { ExpressionBuilder, LanguageName } from '../../src/index.js' -import { ParserAdapter, Source } from '../../src/language/types.js' +import type { LanguageName } from '../../src/index.js' +import { ExpressionBuilder } from '../../src/index.js' +import type { ParserAdapter, Source } from '../../src/language/types.js' import { NodeParserAdapter } from '../../src/tree-sitter-node/NodeParserAdapter.js' import { WasmParserAdapter } from '../../src/tree-sitter-wasm/WasmParserAdapter.js' diff --git a/test/language/goLanguage.test.ts b/test/language/goLanguage.test.ts index d7874637..cc7fa9ef 100644 --- a/test/language/goLanguage.test.ts +++ b/test/language/goLanguage.test.ts @@ -1,7 +1,7 @@ import assert from 'assert' import { stringLiteral } from '../../src/language/goLanguage.js' -import { TreeSitterSyntaxNode } from '../../src/language/types.js' +import type { TreeSitterSyntaxNode } from '../../src/language/types.js' describe('goLanguage', () => { it('should remove enclosing string quotations and backticks', () => { diff --git a/test/language/javaLanguage.test.ts b/test/language/javaLanguage.test.ts index 00bc1989..2171e562 100644 --- a/test/language/javaLanguage.test.ts +++ b/test/language/javaLanguage.test.ts @@ -1,7 +1,7 @@ import assert from 'assert' import { stringLiteral } from '../../src/language/javaLanguage.js' -import { TreeSitterSyntaxNode } from '../../src/language/types.js' +import type { TreeSitterSyntaxNode } from '../../src/language/types.js' describe('javaLanguage', () => { it('should remove (?i) from regexp strings', () => { diff --git a/test/language/rubyLanguage.test.ts b/test/language/rubyLanguage.test.ts index 091f0cf4..c0a916a1 100644 --- a/test/language/rubyLanguage.test.ts +++ b/test/language/rubyLanguage.test.ts @@ -1,7 +1,7 @@ import assert from 'assert' import { toStringOrRegExp } from '../../src/language/rubyLanguage.js' -import { TreeSitterSyntaxNode } from '../../src/language/types.js' +import type { TreeSitterSyntaxNode } from '../../src/language/types.js' describe('rubyLanguage', () => { it('should preserve regexp flags in step definitions', () => { diff --git a/test/language/rustLanguage.test.ts b/test/language/rustLanguage.test.ts index f4f4fc2c..25447280 100644 --- a/test/language/rustLanguage.test.ts +++ b/test/language/rustLanguage.test.ts @@ -1,7 +1,7 @@ import assert from 'assert' import { stringLiteral, stripLineContinuation } from '../../src/language/rustLanguage.js' -import { TreeSitterSyntaxNode } from '../../src/language/types.js' +import type { TreeSitterSyntaxNode } from '../../src/language/types.js' describe('rustLanguage', () => { it('should extract string literal pattern', () => { diff --git a/test/language/tsxLanguage.test.ts b/test/language/tsxLanguage.test.ts index 1294392b..5bf9d0e9 100644 --- a/test/language/tsxLanguage.test.ts +++ b/test/language/tsxLanguage.test.ts @@ -2,7 +2,7 @@ import assert from 'assert' import { NO_EXPRESSION } from '../../src/language/SourceAnalyzer.js' import { toStringOrRegExp } from '../../src/language/tsxLanguage.js' -import { TreeSitterSyntaxNode } from '../../src/language/types.js' +import type { TreeSitterSyntaxNode } from '../../src/language/types.js' describe('tsxLanguage', () => { it('should preserve regexp flags in step definitions', () => { diff --git a/test/messages/MessagesBuilder.test.ts b/test/messages/MessagesBuilder.test.ts index 28025880..4bfc4c4f 100644 --- a/test/messages/MessagesBuilder.test.ts +++ b/test/messages/MessagesBuilder.test.ts @@ -4,8 +4,8 @@ import fs from 'fs' import { pipeline as pipelineCb, Writable } from 'stream' import { promisify } from 'util' -import { MessagesBuilderResult } from '../../src/messages/MessagesBuilder.js' -import { Suggestion } from '../../src/suggestions/types.js' +import type { MessagesBuilderResult } from '../../src/messages/MessagesBuilder.js' +import type { Suggestion } from '../../src/suggestions/types.js' import { MessagesBuilderStream } from './MessagesBuilderStream.js' const pipeline = promisify(pipelineCb) diff --git a/test/messages/MessagesBuilderStream.ts b/test/messages/MessagesBuilderStream.ts index ea60ed27..12030aa5 100644 --- a/test/messages/MessagesBuilderStream.ts +++ b/test/messages/MessagesBuilderStream.ts @@ -1,5 +1,6 @@ -import { Envelope } from '@cucumber/messages' -import { Transform, TransformCallback } from 'stream' +import type { Envelope } from '@cucumber/messages' +import type { TransformCallback } from 'stream' +import { Transform } from 'stream' import { MessagesBuilder } from '../../src/messages/MessagesBuilder.js' diff --git a/test/service/getGenerateSnippetCodeAction.test.ts b/test/service/getGenerateSnippetCodeAction.test.ts index 98c14af7..9e2befd4 100644 --- a/test/service/getGenerateSnippetCodeAction.test.ts +++ b/test/service/getGenerateSnippetCodeAction.test.ts @@ -1,6 +1,7 @@ import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import assert from 'assert' -import { CodeAction, LocationLink, Range } from 'vscode-languageserver-types' +import type { CodeAction, LocationLink } from 'vscode-languageserver-types' +import { Range } from 'vscode-languageserver-types' import { getGenerateSnippetCodeAction } from '../../src/service/getGenerateSnippetCodeAction.js' import { makeUndefinedStepDiagnostic } from '../../src/service/getGherkinDiagnostics.js' diff --git a/test/service/getGherkinCompletionItems.test.ts b/test/service/getGherkinCompletionItems.test.ts index 5dec04e5..1d2dd158 100644 --- a/test/service/getGherkinCompletionItems.test.ts +++ b/test/service/getGherkinCompletionItems.test.ts @@ -1,9 +1,10 @@ import assert from 'assert' -import { CompletionItem, CompletionItemKind, InsertTextFormat } from 'vscode-languageserver-types' +import type { CompletionItem } from 'vscode-languageserver-types' +import { CompletionItemKind, InsertTextFormat } from 'vscode-languageserver-types' import { bruteForceIndex } from '../../src/index/index.js' import { getGherkinCompletionItems } from '../../src/service/getGherkinCompletionItems.js' -import { Suggestion } from '../../src/suggestions/types.js' +import type { Suggestion } from '../../src/suggestions/types.js' describe('getGherkinCompletionItems', () => { it('completes matched step', () => { diff --git a/test/service/getGherkinDiagnostics.test.ts b/test/service/getGherkinDiagnostics.test.ts index 60ba6ce6..d5e8509b 100644 --- a/test/service/getGherkinDiagnostics.test.ts +++ b/test/service/getGherkinDiagnostics.test.ts @@ -1,6 +1,7 @@ import { CucumberExpression, ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import assert from 'assert' -import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-types' +import type { Diagnostic } from 'vscode-languageserver-types' +import { DiagnosticSeverity } from 'vscode-languageserver-types' import { getGherkinDiagnostics } from '../../src/service/getGherkinDiagnostics.js' diff --git a/test/service/getGherkinDocumentFeatureSymbol.test.ts b/test/service/getGherkinDocumentFeatureSymbol.test.ts index 017bf503..5933e142 100644 --- a/test/service/getGherkinDocumentFeatureSymbol.test.ts +++ b/test/service/getGherkinDocumentFeatureSymbol.test.ts @@ -1,5 +1,6 @@ import assert from 'assert' -import { DocumentSymbol, SymbolKind } from 'vscode-languageserver-types' +import type { DocumentSymbol } from 'vscode-languageserver-types' +import { SymbolKind } from 'vscode-languageserver-types' import { getGherkinDocumentFeatureSymbol } from '../../src/service/getGherkinDocumentFeatureSymbol.js' diff --git a/test/service/getGherkinFormattingEdits.test.ts b/test/service/getGherkinFormattingEdits.test.ts index 00f36960..b7aa394c 100644 --- a/test/service/getGherkinFormattingEdits.test.ts +++ b/test/service/getGherkinFormattingEdits.test.ts @@ -1,5 +1,5 @@ import assert from 'assert' -import { TextEdit } from 'vscode-languageserver-types' +import type { TextEdit } from 'vscode-languageserver-types' import { getGherkinFormattingEdits } from '../../src/service/getGherkinFormattingEdits.js' diff --git a/test/service/getGherkinSemanticTokens.test.ts b/test/service/getGherkinSemanticTokens.test.ts index afb00e10..ad03de11 100644 --- a/test/service/getGherkinSemanticTokens.test.ts +++ b/test/service/getGherkinSemanticTokens.test.ts @@ -4,7 +4,8 @@ import { RegularExpression, } from '@cucumber/cucumber-expressions' import assert from 'assert' -import { SemanticTokenTypes, uinteger } from 'vscode-languageserver-types' +import type { uinteger } from 'vscode-languageserver-types' +import { SemanticTokenTypes } from 'vscode-languageserver-types' import { getGherkinSemanticTokens, diff --git a/test/service/getStepDefinitionLocationLinks.test.ts b/test/service/getStepDefinitionLocationLinks.test.ts index 299fc6f2..b94f31c5 100644 --- a/test/service/getStepDefinitionLocationLinks.test.ts +++ b/test/service/getStepDefinitionLocationLinks.test.ts @@ -1,8 +1,9 @@ import { CucumberExpression, ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import assert from 'assert' -import { LocationLink, Range } from 'vscode-languageserver-types' +import type { LocationLink } from 'vscode-languageserver-types' +import { Range } from 'vscode-languageserver-types' -import { ExpressionLink } from '../../src/language/types.js' +import type { ExpressionLink } from '../../src/language/types.js' import { getStepDefinitionLocationLinks } from '../../src/service/getStepDefinitionLocationLinks.js' describe('getStepDefinitionLocationLinks', () => { diff --git a/test/service/snippet/lspCompletionSnippet.test.ts b/test/service/snippet/lspCompletionSnippet.test.ts index a238fd44..b585cdfb 100644 --- a/test/service/snippet/lspCompletionSnippet.test.ts +++ b/test/service/snippet/lspCompletionSnippet.test.ts @@ -1,7 +1,7 @@ import assert from 'assert' import { lspCompletionSnippet } from '../../../src/service/snippet/lspCompletionSnippet.js' -import { SuggestionSegments } from '../../../src/suggestions/types.js' +import type { SuggestionSegments } from '../../../src/suggestions/types.js' describe('lspCompletionSnippet', () => { it('converts segments to an LSP snippet', () => { diff --git a/test/service/snippet/stepDefinitionSnippet.test.ts b/test/service/snippet/stepDefinitionSnippet.test.ts index 1b4c1c93..29d7e823 100644 --- a/test/service/snippet/stepDefinitionSnippet.test.ts +++ b/test/service/snippet/stepDefinitionSnippet.test.ts @@ -3,7 +3,8 @@ import assert from 'assert' import { ExpressionBuilder } from '../../../src/language/ExpressionBuilder.js' import { getLanguage } from '../../../src/language/languages.js' -import { LanguageName, LanguageNames, Source } from '../../../src/language/types.js' +import type { LanguageName, Source } from '../../../src/language/types.js' +import { LanguageNames } from '../../../src/language/types.js' import { stepDefinitionSnippet } from '../../../src/service/snippet/stepDefinitionSnippet.js' import { NodeParserAdapter } from '../../../src/tree-sitter-node/NodeParserAdapter.js' diff --git a/test/suggestions/buildSuggestionFromCucumberExpression.test.ts b/test/suggestions/buildSuggestionFromCucumberExpression.test.ts index 87f7bc89..627eb880 100644 --- a/test/suggestions/buildSuggestionFromCucumberExpression.test.ts +++ b/test/suggestions/buildSuggestionFromCucumberExpression.test.ts @@ -6,7 +6,7 @@ import { import assert from 'assert' import { buildSuggestionFromCucumberExpression } from '../../src/suggestions/buildSuggestionFromCucumberExpression.js' -import { Suggestion } from '../../src/suggestions/types.js' +import type { Suggestion } from '../../src/suggestions/types.js' describe('buildSuggestionFromCucumberExpression', () => { let registry: ParameterTypeRegistry diff --git a/test/suggestions/buildSuggestions.test.ts b/test/suggestions/buildSuggestions.test.ts index fb88adb5..0e55c3b7 100644 --- a/test/suggestions/buildSuggestions.test.ts +++ b/test/suggestions/buildSuggestions.test.ts @@ -1,12 +1,9 @@ -import { - Expression, - ExpressionFactory, - ParameterTypeRegistry, -} from '@cucumber/cucumber-expressions' +import type { Expression } from '@cucumber/cucumber-expressions' +import { ExpressionFactory, ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import assert from 'assert' import { buildSuggestions } from '../../src/suggestions/buildSuggestions.js' -import { Suggestion } from '../../src/suggestions/types.js' +import type { Suggestion } from '../../src/suggestions/types.js' describe('buildSuggestions', () => { it('builds suggestions with choices', () => { diff --git a/test/suggestions/buildSuggestionsFromRegularExpression.test.ts b/test/suggestions/buildSuggestionsFromRegularExpression.test.ts index d8a9d708..9f5b06fe 100644 --- a/test/suggestions/buildSuggestionsFromRegularExpression.test.ts +++ b/test/suggestions/buildSuggestionsFromRegularExpression.test.ts @@ -2,7 +2,7 @@ import { ParameterTypeRegistry, RegularExpression } from '@cucumber/cucumber-exp import assert from 'assert' import { buildSuggestionsFromRegularExpression } from '../../src/suggestions/buildSuggestionsFromRegularExpression.js' -import { Suggestion } from '../../src/suggestions/types.js' +import type { Suggestion } from '../../src/suggestions/types.js' describe('buildSuggestionsFromRegularExpression', () => { let registry: ParameterTypeRegistry