Skip to content

Commit

Permalink
chore lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rrd108 committed Sep 4, 2024
1 parent 892d576 commit 34f0851
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/helpers/validateOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const validateOption = <T>(value: T, flag: Flag) => {
if (!Array.isArray(validOptions) || !validOptions.includes(value as any)) {
console.error(
`\nInvalid option ${BG_ERR}${value}${BG_RESET} provided for flag ${TEXT_INFO}${flag}${TEXT_RESET}. Valid options are: ${BG_INFO}${validOptions.join(', ')}${BG_RESET}.\n`,
);
)
// eslint-disable-next-line node/prefer-global/process
process.exit(1)
}
Expand Down
9 changes: 5 additions & 4 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ describe('yarn analyze command with default configuration', () => {
expect(stdout).toContain(`Analyzing Vue, TS and JS files in`)
expect(stdout).toContain(`codeHealthOutput`)
})

it('should execute with group parameter', async () => {
const { stdout } = await execa('yarn', ['analyze', './src/rules/vue-caution', '--group=file'])
expect(stdout).toContain(`- ${TEXT_INFO} src/rules/vue-caution/elementSelectorsWithScoped.ts${TEXT_RESET}`)
})

it('should execute with sort parameter', async () => {
const { stdout } = await execa('yarn', ['analyze', '--sort=asc'])
expect(stdout).toContain(`Analyzing Vue, TS and JS files in`)
})

it('should execute with level parameter', async () => {
const { stdout } = await execa('yarn', ['analyze', '--level=error'])
expect(stdout).toContain(`Analyzing Vue, TS and JS files in`)
Expand All @@ -125,7 +125,8 @@ describe('yarn analyze command with default configuration', () => {
await execa('yarn', ['analyze', '--output=gauranga'])
// If the command doesn't throw, fail the test
expect(true).toBe(false)
} catch (error) {
}
catch (error) {
expect((error as any).stderr).toContain(`Invalid option ${BG_ERR}gauranga${BG_RESET} provided for flag ${TEXT_INFO}outputFormat${TEXT_RESET}. Valid options are: ${BG_INFO}text, json, table${BG_RESET}.`)
}
})
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import Table from 'cli-table3'
import { analyze } from './analyzer'
import { BG_ERR, BG_RESET, TEXT_INFO, TEXT_RESET } from './rules/asceeCodes'
import { RULESETS } from './rules/rules'
import type { GroupBy, SortBy, OutputFormat, OutputLevel } from './types'
import type { GroupBy, OutputFormat, OutputLevel, SortBy } from './types'
import { validateOption } from './helpers/validateOption'
import getProjectRoot from './helpers/getProjectRoot'
import coerceRules from './helpers/coerceRules'
import { FLAT_RULESETS_RULES } from './helpers/constants'
import { GROUP_BY, SORT_BY, OUTPUT_FORMATS, OUTPUT_LEVELS } from './types'
import { GROUP_BY, OUTPUT_FORMATS, OUTPUT_LEVELS, SORT_BY } from './types'
import { getPackageJson } from './helpers/getPackageJson'

// eslint-disable-next-line node/prefer-global/process
Expand Down

0 comments on commit 34f0851

Please sign in to comment.