Skip to content
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

lint: error on unused vars #1928

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ 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': [error, { "argsIgnorePattern": "^_" }]
1 change: 1 addition & 0 deletions compatibility/features/parameter-types/parameter-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ Given(
function (flight: Flight, delay: number) {
expect(flight.from).to.eq('LHR')
expect(flight.to).to.eq('CDG')
expect(delay).to.eq(45)
}
)
2 changes: 0 additions & 2 deletions src/cli/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export async function getExpandedArgv({
}

interface IParseGherkinMessageStreamRequest {
cwd: string
eventBroadcaster: EventEmitter
eventDataCollector: EventDataCollector
gherkinMessageStream: Readable
Expand All @@ -50,7 +49,6 @@ interface IParseGherkinMessageStreamRequest {
export type PickleOrder = 'defined' | 'random'

export async function parseGherkinMessageStream({
cwd,
eventBroadcaster,
eventDataCollector,
gherkinMessageStream,
Expand Down
5 changes: 0 additions & 5 deletions src/cli/helpers_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const noopFunction = (): void => {
}

interface ITestParseGherkinMessageStreamRequest {
cwd: string
gherkinMessageStream: Readable
order: PickleOrder
pickleFilter: PickleFilter
Expand All @@ -49,7 +48,6 @@ async function testParseGherkinMessageStream(
eventBroadcaster.on('envelope', (e) => envelopes.push(e))
const eventDataCollector = new EventDataCollector(eventBroadcaster)
const result = await parseGherkinMessageStream({
cwd: options.cwd,
eventBroadcaster,
eventDataCollector,
gherkinMessageStream: options.gherkinMessageStream,
Expand Down Expand Up @@ -384,7 +382,6 @@ describe('helpers', () => {

// Act
const { envelopes, result } = await testParseGherkinMessageStream({
cwd,
gherkinMessageStream,
order,
pickleFilter,
Expand Down Expand Up @@ -426,7 +423,6 @@ describe('helpers', () => {

// Act
const { envelopes, result } = await testParseGherkinMessageStream({
cwd,
gherkinMessageStream,
order,
pickleFilter,
Expand Down Expand Up @@ -470,7 +466,6 @@ describe('helpers', () => {

// Act
const { envelopes, result } = await testParseGherkinMessageStream({
cwd,
gherkinMessageStream,
order,
pickleFilter,
Expand Down
2 changes: 1 addition & 1 deletion src/formatter/get_color_fns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function getColorFns(enabled: boolean): IColorFns {
}
} else {
return {
forStatus(status: TestStepResultStatus) {
forStatus(_status: TestStepResultStatus) {
return (x) => x
},
location: (x) => x,
Expand Down
3 changes: 0 additions & 3 deletions src/formatter/helpers/issue_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export function isIssue(result: messages.TestStepResult): boolean {

export interface IFormatIssueRequest {
colorFns: IColorFns
cwd: string
number: number
snippetBuilder: StepDefinitionSnippetBuilder
testCaseAttempt: ITestCaseAttempt
Expand All @@ -42,7 +41,6 @@ export interface IFormatIssueRequest {

export function formatIssue({
colorFns,
cwd,
number,
snippetBuilder,
testCaseAttempt,
Expand All @@ -52,7 +50,6 @@ export function formatIssue({
const prefix = `${number.toString()}) `
const formattedTestCaseAttempt = formatTestCaseAttempt({
colorFns,
cwd,
snippetBuilder,
testCaseAttempt,
supportCodeLibrary,
Expand Down
1 change: 0 additions & 1 deletion src/formatter/helpers/issue_helpers_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ async function testFormatIssue(
supportCodeLibrary,
})
return formatIssue({
cwd: 'project/',
colorFns: getColorFns(false),
number: 1,
snippetBuilder: await FormatterBuilder.getStepDefinitionSnippetBuilder({
Expand Down
36 changes: 15 additions & 21 deletions src/formatter/helpers/summary_helpers_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,11 @@ describe('SummaryHelpers', () => {
'Scenario: b',
'Given a passing step',
].join('\n')
const supportCodeLibrary = buildSupportCodeLibrary(
({ Given, Before }) => {
Given('a passing step', () => {
clock.tick(123)
})
}
)
const supportCodeLibrary = buildSupportCodeLibrary(({ Given }) => {
Given('a passing step', () => {
clock.tick(123)
})
})

// Act
const output = await testFormatSummary({
Expand Down Expand Up @@ -282,13 +280,11 @@ describe('SummaryHelpers', () => {
'Scenario: b',
'Given a passing step',
].join('\n')
const supportCodeLibrary = buildSupportCodeLibrary(
({ Given, Before }) => {
Given('a passing step', () => {
clock.tick(12.3 * 1000)
})
}
)
const supportCodeLibrary = buildSupportCodeLibrary(({ Given }) => {
Given('a passing step', () => {
clock.tick(12.3 * 1000)
})
})

// Act
const output = await testFormatSummary({
Expand Down Expand Up @@ -320,13 +316,11 @@ describe('SummaryHelpers', () => {
'Scenario: b',
'Given a passing step',
].join('\n')
const supportCodeLibrary = buildSupportCodeLibrary(
({ Given, Before }) => {
Given('a passing step', () => {
clock.tick(123 * 1000)
})
}
)
const supportCodeLibrary = buildSupportCodeLibrary(({ Given }) => {
Given('a passing step', () => {
clock.tick(123 * 1000)
})
})

// Act
const output = await testFormatSummary({
Expand Down
3 changes: 0 additions & 3 deletions src/formatter/helpers/test_case_attempt_formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function formatStep({

export interface IFormatTestCaseAttemptRequest {
colorFns: IColorFns
cwd: string
testCaseAttempt: ITestCaseAttempt
snippetBuilder: StepDefinitionSnippetBuilder
supportCodeLibrary: ISupportCodeLibrary
Expand All @@ -88,14 +87,12 @@ export interface IFormatTestCaseAttemptRequest {

export function formatTestCaseAttempt({
colorFns,
cwd,
snippetBuilder,
supportCodeLibrary,
testCaseAttempt,
printAttachments,
}: IFormatTestCaseAttemptRequest): string {
const parsed = parseTestCaseAttempt({
cwd,
snippetBuilder,
testCaseAttempt,
supportCodeLibrary,
Expand Down
2 changes: 0 additions & 2 deletions src/formatter/helpers/test_case_attempt_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ function parseStep({
}

export interface IParseTestCaseAttemptRequest {
cwd: string
testCaseAttempt: ITestCaseAttempt
snippetBuilder: StepDefinitionSnippetBuilder
supportCodeLibrary: ISupportCodeLibrary
Expand All @@ -126,7 +125,6 @@ export interface IParseTestCaseAttemptRequest {
// Converts a testCaseAttempt into a json object with all data needed for
// displaying it in a pretty format
export function parseTestCaseAttempt({
cwd,
testCaseAttempt,
snippetBuilder,
supportCodeLibrary,
Expand Down
3 changes: 0 additions & 3 deletions src/formatter/helpers/test_case_attempt_parser_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { getTestCaseAttempts } from '../../../test/formatter_helpers'

describe('TestCaseAttemptParser', () => {
describe('parseTestCaseAttempt', () => {
const cwd = ''
const supportCodeLibrary = getBaseSupportCodeLibrary()
const snippetSyntax = {
build: () => 'snippet',
Expand Down Expand Up @@ -42,7 +41,6 @@ describe('TestCaseAttemptParser', () => {

// Act
const output = parseTestCaseAttempt({
cwd,
testCaseAttempt,
snippetBuilder,
supportCodeLibrary,
Expand All @@ -65,7 +63,6 @@ describe('TestCaseAttemptParser', () => {

// Act
const output = parseTestCaseAttempt({
cwd,
testCaseAttempt,
snippetBuilder,
supportCodeLibrary,
Expand Down
5 changes: 1 addition & 4 deletions src/formatter/helpers/usage_helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export interface IUsage {
}

export interface IGetUsageRequest {
cwd: string
eventDataCollector: EventDataCollector
stepDefinitions: StepDefinition[]
}
Expand Down Expand Up @@ -52,7 +51,6 @@ const unexecutedStatuses: readonly messages.TestStepResultStatus[] = [
]

function buildMapping({
cwd,
stepDefinitions,
eventDataCollector,
}: IGetUsageRequest): Record<string, IUsage> {
Expand Down Expand Up @@ -125,10 +123,9 @@ function buildResult(mapping: Record<string, IUsage>): IUsage[] {
}

export function getUsage({
cwd,
stepDefinitions,
eventDataCollector,
}: IGetUsageRequest): IUsage[] {
const mapping = buildMapping({ cwd, stepDefinitions, eventDataCollector })
const mapping = buildMapping({ stepDefinitions, eventDataCollector })
return buildResult(mapping)
}
17 changes: 6 additions & 11 deletions src/formatter/helpers/usage_helpers/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe('Usage Helpers', () => {

// Act
const output = getUsage({
cwd: '/project',
eventDataCollector,
stepDefinitions: supportCodeLibrary.stepDefinitions,
})
Expand All @@ -41,23 +40,19 @@ describe('Usage Helpers', () => {
const supportCodeLibrary = buildSupportCodeLibrary(
({ Given, setDefinitionFunctionWrapper }) => {
Given('a step', code)
setDefinitionFunctionWrapper(
(fn: Function) =>
function (fn: Function) {
if (fn.length === 1) {
return fn
}
return fn
}
)
setDefinitionFunctionWrapper((fn: Function) => {
if (fn.length === 1) {
return fn
}
return fn
})
}
)
const { eventDataCollector } =
await getEnvelopesAndEventDataCollector({ supportCodeLibrary })

// Act
const output = getUsage({
cwd: '/project',
eventDataCollector,
stepDefinitions: supportCodeLibrary.stepDefinitions,
})
Expand Down
1 change: 0 additions & 1 deletion src/formatter/progress_bar_formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export default class ProgressBarFormatter extends Formatter {
this.progressBar.interrupt(
formatIssue({
colorFns: this.colorFns,
cwd: this.cwd,
number: this.issueCount,
snippetBuilder: this.snippetBuilder,
supportCodeLibrary: this.supportCodeLibrary,
Expand Down
10 changes: 5 additions & 5 deletions src/formatter/progress_bar_formatter_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe('ProgressBarFormatter', () => {

// Act
const { progressBarFormatter } = await testProgressBarFormatter({
shouldStopFn: (envelope) => false,
shouldStopFn: () => false,
sources,
supportCodeLibrary,
})
Expand Down Expand Up @@ -376,7 +376,7 @@ describe('ProgressBarFormatter', () => {
// Act
const { progressBarFormatter } = await testProgressBarFormatter({
runtimeOptions: { retry: 1 },
shouldStopFn: (envelope) => false,
shouldStopFn: () => false,
sources,
supportCodeLibrary,
})
Expand Down Expand Up @@ -414,7 +414,7 @@ describe('ProgressBarFormatter', () => {

// Act
const { output } = await testProgressBarFormatter({
shouldStopFn: (envelope) => false,
shouldStopFn: () => false,
sources,
supportCodeLibrary,
})
Expand All @@ -441,7 +441,7 @@ describe('ProgressBarFormatter', () => {

// Act
const { output } = await testProgressBarFormatter({
shouldStopFn: (envelope) => false,
shouldStopFn: () => false,
sources,
supportCodeLibrary,
})
Expand Down Expand Up @@ -473,7 +473,7 @@ describe('ProgressBarFormatter', () => {

// Act
const { output } = await testProgressBarFormatter({
shouldStopFn: (envelope) => false,
shouldStopFn: () => false,
sources,
supportCodeLibrary,
})
Expand Down
1 change: 0 additions & 1 deletion src/formatter/snippets_formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default class SnippetsFormatter extends Formatter {
const snippets: string[] = []
this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {
const parsed = parseTestCaseAttempt({
cwd: this.cwd,
snippetBuilder: this.snippetBuilder,
supportCodeLibrary: this.supportCodeLibrary,
testCaseAttempt,
Expand Down
1 change: 0 additions & 1 deletion src/formatter/summary_formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export default class SummaryFormatter extends Formatter {
this.log(
formatIssue({
colorFns: this.colorFns,
cwd: this.cwd,
number: index + 1,
snippetBuilder: this.snippetBuilder,
supportCodeLibrary: this.supportCodeLibrary,
Expand Down
1 change: 0 additions & 1 deletion src/formatter/usage_formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default class UsageFormatter extends Formatter {

logUsage(): void {
const usage = getUsage({
cwd: this.cwd,
stepDefinitions: this.supportCodeLibrary.stepDefinitions,
eventDataCollector: this.eventDataCollector,
})
Expand Down
1 change: 0 additions & 1 deletion src/formatter/usage_json_formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default class UsageJsonFormatter extends Formatter {

logUsage(): void {
const usage = getUsage({
cwd: this.cwd,
stepDefinitions: this.supportCodeLibrary.stepDefinitions,
eventDataCollector: this.eventDataCollector,
})
Expand Down
1 change: 0 additions & 1 deletion src/run/runCucumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export async function runCucumber(

if (featurePaths.length > 0) {
pickleIds = await parseGherkinMessageStream({
cwd,
eventBroadcaster,
eventDataCollector,
gherkinMessageStream,
Expand Down
Loading