Skip to content

Commit

Permalink
Activate eslint-plugin-simple-import-sort
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelien-reeves committed Dec 7, 2021
1 parent c28f61b commit a0075e7
Show file tree
Hide file tree
Showing 124 changed files with 539 additions and 426 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ rules:
"@typescript-eslint/no-inferrable-types": off
"@typescript-eslint/no-empty-function": off
"@typescript-eslint/ban-types": off
"@typescript-eslint/no-unused-vars": off
"@typescript-eslint/no-unused-vars": off
"simple-import-sort/imports": "error"
"simple-import-sort/exports": "error"
13 changes: 7 additions & 6 deletions compatibility/cck_spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { describe, it } from 'mocha'
import * as messageStreams from '@cucumber/message-streams'
import * as messages from '@cucumber/messages'
import { config, expect, use } from 'chai'
import chaiExclude from 'chai-exclude'
import glob from 'glob'
import fs from 'fs'
import glob from 'glob'
import { describe, it } from 'mocha'
import path from 'path'
import { PassThrough, pipeline, Writable } from 'stream'
import { Cli } from '../src'
import toString from 'stream-to-string'
import util from 'util'

import {
ignorableKeys,
normalizeMessageOutput,
} from '../features/support/formatter_output_helpers'
import * as messages from '@cucumber/messages'
import * as messageStreams from '@cucumber/message-streams'
import util from 'util'
import { Cli } from '../src'

const asyncPipeline = util.promisify(pipeline)
const PROJECT_PATH = path.join(__dirname, '..')
Expand Down
5 changes: 3 additions & 2 deletions compatibility/features/attachments/attachments.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Before, When, World } from '../../../src'
import { ReadableStreamBuffer } from 'stream-buffers'
import fs from 'fs'
import path from 'path'
import { ReadableStreamBuffer } from 'stream-buffers'

import { Before, When, World } from '../../../src'

Before((): void => undefined)

Expand Down
3 changes: 2 additions & 1 deletion compatibility/features/data-tables/data-tables.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { When, Then, DataTable } from '../../../src'
import { expect } from 'chai'

import { DataTable, Then, When } from '../../../src'

When(
'the following table is transposed:',
function (this: any, table: DataTable) {
Expand Down
3 changes: 2 additions & 1 deletion compatibility/features/examples-tables/examples-tables.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from 'assert'
import { Given, When, Then } from '../../../src'

import { Given, Then, When } from '../../../src'

Given('there are {int} cucumbers', function (this: any, initialCount: number) {
this.count = initialCount
Expand Down
3 changes: 2 additions & 1 deletion compatibility/features/hooks/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { When, Before, After, World } from '../../../src'
import fs from 'fs'
import path from 'path'

import { After, Before, When, World } from '../../../src'

Before(function () {
// no-op
})
Expand Down
3 changes: 2 additions & 1 deletion compatibility/features/markdown/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from 'assert'
import { Given, DataTable, Then, When, World } from '../../../src'

import { DataTable, Given, Then, When, World } from '../../../src'

Given('some TypeScript code:', function (dataTable: DataTable) {
assert(dataTable)
Expand Down
1 change: 1 addition & 0 deletions compatibility/features/minimal/minimal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from 'assert'

import { Given } from '../../../src'

Given('I have {int} cukes in my belly', function (cukeCount: number) {
Expand Down
3 changes: 2 additions & 1 deletion compatibility/features/parameter-types/parameter-types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Given, defineParameterType } from '../../../src'
import { expect } from 'chai'

import { defineParameterType, Given } from '../../../src'

class Flight {
constructor(public readonly from: string, public readonly to: string) {}
}
Expand Down
3 changes: 2 additions & 1 deletion compatibility/features/rules/rules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from 'assert'
import { Given, When, Then } from '../../../src'

import { Given, Then, When } from '../../../src'

Given(
'there are {int} {float} coins inside',
Expand Down
7 changes: 4 additions & 3 deletions features/step_definitions/cli_steps.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { DataTable, Then, When } from '../../'
import { expect } from 'chai'
import { normalizeText } from '../support/helpers'
import stringArgv from 'string-argv'
import Mustache from 'mustache'
import stringArgv from 'string-argv'

import { DataTable, Then, When } from '../../'
import {
doesHaveValue,
doesNotHaveValue,
valueOrDefault,
} from '../../src/value_checker'
import { normalizeText } from '../support/helpers'
import { World } from '../support/world'

const { version } = require('../../package.json') // eslint-disable-line @typescript-eslint/no-var-requires
Expand Down
9 changes: 5 additions & 4 deletions features/step_definitions/file_steps.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Given, Then } from '../../'
import { expect } from 'chai'
import { normalizeText } from '../support/helpers'
import fs from 'mz/fs'
import fsExtra from 'fs-extra'
import path from 'path'
import Mustache from 'mustache'
import fs from 'mz/fs'
import path from 'path'

import { Given, Then } from '../../'
import { normalizeText } from '../support/helpers'
import { World } from '../support/world'

Given(
Expand Down
7 changes: 4 additions & 3 deletions features/step_definitions/formatter_steps.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Then } from '../../'
import { expect, use } from 'chai'
import chaiExclude from 'chai-exclude'
import fs from 'mz/fs'
import path from 'path'

import { Then } from '../../'
import {
ignorableKeys,
normalizeJsonOutput,
normalizeMessageOutput,
stripMetaMessages,
} from '../support/formatter_output_helpers'
import fs from 'mz/fs'
import path from 'path'
import { World } from '../support/world'

use(chaiExclude)
Expand Down
7 changes: 4 additions & 3 deletions features/step_definitions/message_steps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Then } from '../../'
import * as messages from '@cucumber/messages'
import { expect } from 'chai'
import semver from 'semver'

import { Then } from '../../'
import DataTable from '../../src/models/data_table'
import {
getPickleNamesInOrderOfExecution,
Expand All @@ -9,9 +12,7 @@ import {
getTestStepAttachmentsForStep,
getTestStepResults,
} from '../support/message_helpers'
import * as messages from '@cucumber/messages'
import { World } from '../support/world'
import semver from 'semver'

const ENCODING_MAP: { [key: string]: messages.AttachmentContentEncoding } = {
IDENTITY: messages.AttachmentContentEncoding.IDENTITY,
Expand Down
7 changes: 4 additions & 3 deletions features/step_definitions/report_server_steps.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Given, Then, DataTable } from '../..'
import { World } from '../support/world'
import assert from 'assert'
import { expect } from 'chai'
import { URL } from 'url'

import { DataTable, Given, Then } from '../..'
import FakeReportServer from '../../test/fake_report_server'
import assert from 'assert'
import { World } from '../support/world'

Given(
'a report server is running on {string}',
Expand Down
5 changes: 3 additions & 2 deletions features/step_definitions/usage_json_steps.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { DataTable, Then } from '../../'
import { expect } from 'chai'
import path from 'path'
import { World } from '../support/world'

import { DataTable, Then } from '../../'
import { IUsage } from '../../src/formatter/helpers/usage_helpers'
import { World } from '../support/world'

Then('it outputs the usage data:', function (this: World, table: DataTable) {
const usageData: IUsage[] = JSON.parse(this.lastRun.output)
Expand Down
13 changes: 7 additions & 6 deletions features/support/formatter_output_helpers.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {
doesHaveValue,
doesNotHaveValue,
valueOrDefault,
} from '../../src/value_checker'
import * as messages from '@cucumber/messages'

import {
IJsonFeature,
IJsonScenario,
IJsonStep,
} from '../../src/formatter/json_formatter'
import * as messages from '@cucumber/messages'
import {
doesHaveValue,
doesNotHaveValue,
valueOrDefault,
} from '../../src/value_checker'

// Converting windows stack trace to posix and removing cwd
// C:\\project\\path\\features\\support/code.js
Expand Down
3 changes: 2 additions & 1 deletion features/support/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path'
import figures from 'figures'
import path from 'path'

import { normalizeSummaryDuration } from '../../test/formatter_helpers'

export function normalizeText(text: string): string {
Expand Down
7 changes: 4 additions & 3 deletions features/support/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { After, Before, formatterHelpers } from '../../'
import fs from 'fs'
import fsExtra from 'fs-extra'
import path from 'path'
import tmp from 'tmp'
import { doesHaveValue } from '../../src/value_checker'
import { World } from './world'

import { After, Before, formatterHelpers } from '../../'
import { ITestCaseHookParameter } from '../../src/support_code_library_builder/types'
import { doesHaveValue } from '../../src/value_checker'
import { warnUserAboutEnablingDeveloperMode } from './warn_user_about_enabling_developer_mode'
import { World } from './world'

const projectPath = path.join(__dirname, '..', '..')

Expand Down
9 changes: 5 additions & 4 deletions features/support/message_helpers.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as messages from '@cucumber/messages'
import { getWorstTestStepResult } from '@cucumber/messages'
import { Query } from '@cucumber/query'
import util from 'util'

import { getGherkinStepMap } from '../../src/formatter/helpers/gherkin_document_parser'
import {
getPickleStepMap,
getStepKeyword,
} from '../../src/formatter/helpers/pickle_parser'
import util from 'util'
import * as messages from '@cucumber/messages'
import { Query } from '@cucumber/query'
import { doesHaveValue, doesNotHaveValue } from '../../src/value_checker'
import { getWorstTestStepResult } from '@cucumber/messages'

export interface IStepTextAndResult {
text: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reindent } from 'reindent-template-literals'
import colors from 'colors/safe'
import { reindent } from 'reindent-template-literals'

export function warnUserAboutEnablingDeveloperMode(error: any): void {
if (!(error?.code === 'EPERM')) {
Expand Down
17 changes: 9 additions & 8 deletions features/support/world.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Cli, setWorldConstructor } from '../../'
import { execFile } from 'child_process'
import * as messageStreams from '@cucumber/message-streams'
import * as messages from '@cucumber/messages'
import { expect } from 'chai'
import toString from 'stream-to-string'
import { PassThrough, pipeline, Writable } from 'stream'
import { execFile } from 'child_process'
import colors from 'colors/safe'
import fs from 'fs'
import path from 'path'
import { PassThrough, pipeline, Writable } from 'stream'
import toString from 'stream-to-string'
import util from 'util'
import VError from 'verror'
import * as messages from '@cucumber/messages'
import * as messageStreams from '@cucumber/message-streams'
import FakeReportServer from '../../test/fake_report_server'

import { Cli, setWorldConstructor } from '../../'
import { doesHaveValue } from '../../src/value_checker'
import util from 'util'
import FakeReportServer from '../../test/fake_report_server'

const asyncPipeline = util.promisify(pipeline)

Expand Down
5 changes: 3 additions & 2 deletions src/cli/argv_parser.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { dialects } from '@cucumber/gherkin'
import { Command } from 'commander'
import path from 'path'
import { dialects } from '@cucumber/gherkin'
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax'

import Formatters from '../formatter/helpers/formatters'
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax'

// Using require instead of import so compiled typescript will have the desired folder structure
const { version } = require('../../package.json') // eslint-disable-line @typescript-eslint/no-var-requires
Expand Down
13 changes: 7 additions & 6 deletions src/cli/configuration_builder.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import ArgvParser, {
IParsedArgvFormatOptions,
IParsedArgvOptions,
} from './argv_parser'
import glob from 'glob'
import fs from 'mz/fs'
import path from 'path'
import OptionSplitter from './option_splitter'
import glob from 'glob'
import { promisify } from 'util'

import { IPickleFilterOptions } from '../pickle_filter'
import { IRuntimeOptions } from '../runtime'
import { valueOrDefault } from '../value_checker'
import ArgvParser, {
IParsedArgvFormatOptions,
IParsedArgvOptions,
} from './argv_parser'
import OptionSplitter from './option_splitter'

export interface IConfigurationFormat {
outputTo: string
Expand Down
5 changes: 3 additions & 2 deletions src/cli/configuration_builder_spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { describe, it } from 'mocha'
import { expect } from 'chai'
import ConfigurationBuilder from './configuration_builder'
import fsExtra from 'fs-extra'
import { describe, it } from 'mocha'
import path from 'path'
import tmp, { DirOptions } from 'tmp'
import { promisify } from 'util'

import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax'
import ConfigurationBuilder from './configuration_builder'

async function buildTestWorkingDirectory(): Promise<string> {
const cwd = await promisify<DirOptions, string>(tmp.dir)({
Expand Down
23 changes: 12 additions & 11 deletions src/cli/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import ArgvParser from './argv_parser'
import ProfileLoader from './profile_loader'
import shuffle from 'knuth-shuffle-seeded'
import { EventEmitter } from 'events'
import PickleFilter from '../pickle_filter'
import { EventDataCollector } from '../formatter/helpers'
import { doesHaveValue } from '../value_checker'
import OptionSplitter from './option_splitter'
import { Readable } from 'stream'
import createMeta from '@cucumber/create-meta'
import { IdGenerator } from '@cucumber/messages'
import * as messages from '@cucumber/messages'
import createMeta from '@cucumber/create-meta'
import { ISupportCodeLibrary } from '../support_code_library_builder/types'
import { EventEmitter } from 'events'
import shuffle from 'knuth-shuffle-seeded'
import { Readable } from 'stream'

import { EventDataCollector } from '../formatter/helpers'
import TestCaseHookDefinition from '../models/test_case_hook_definition'
import TestRunHookDefinition from '../models/test_run_hook_definition'
import PickleFilter from '../pickle_filter'
import { builtinParameterTypes } from '../support_code_library_builder'
import { ISupportCodeLibrary } from '../support_code_library_builder/types'
import { doesHaveValue } from '../value_checker'
import ArgvParser from './argv_parser'
import OptionSplitter from './option_splitter'
import ProfileLoader from './profile_loader'

export interface IGetExpandedArgvRequest {
argv: string[]
Expand Down
Loading

0 comments on commit a0075e7

Please sign in to comment.