Skip to content

Commit

Permalink
📦 build(eslint.config.mjs): add new ESLint configuration file to stan…
Browse files Browse the repository at this point in the history
…dardize code style

🧪 test(*.spec.ts): replace 'test' with 'it' for consistency with Vitest conventions in all test files
  • Loading branch information
nyxb committed May 23, 2024
1 parent c77a6c3 commit 832d86e
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 100 deletions.
10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import nyxb from '@nyxb/eslint-config'

export default nyxb({
formatters: true,
react: true,

rules: {
'no-console': 0,
},
})
18 changes: 9 additions & 9 deletions test/nyxu/npm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxu } from '../../src/commands'

const agent = 'npm'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('empty', _('', 'npm update'))
it('empty', _('', 'npm update'))
22 changes: 11 additions & 11 deletions test/nyxu/pnpm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxu } from '../../src/commands'

const agent = 'pnpm'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('empty', _('', 'pnpm update'))
it('empty', _('', 'pnpm update'))

test('interactive', _('-i', 'pnpm update -i'))
it('interactive', _('-i', 'pnpm update -i'))

test('interactive latest', _('-i --latest', 'pnpm update -i --latest'))
it('interactive latest', _('-i --latest', 'pnpm update -i --latest'))
22 changes: 11 additions & 11 deletions test/nyxu/yarn.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxu } from '../../src/commands'

const agent = 'yarn'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('empty', _('', 'yarn upgrade'))
it('empty', _('', 'yarn upgrade'))

test('interactive', _('-i', 'yarn upgrade-interactive'))
it('interactive', _('-i', 'yarn upgrade-interactive'))

test('interactive latest', _('-i --latest', 'yarn upgrade-interactive --latest'))
it('interactive latest', _('-i --latest', 'yarn upgrade-interactive --latest'))
20 changes: 10 additions & 10 deletions test/nyxu/[email protected]
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxu } from '../../src/commands'

const agent = 'yarn@berry'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxu(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('empty', _('', 'yarn up'))
it('empty', _('', 'yarn up'))

test('interactive', _('-i', 'yarn up -i'))
it('interactive', _('-i', 'yarn up -i'))
22 changes: 11 additions & 11 deletions test/nyxun/bun.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxun } from '../../src/commands'

const agent = 'bun'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('single uninstall', _('axios', 'bun remove axios'))
it('single uninstall', _('axios', 'bun remove axios'))

test('multiple', _('eslint @types/node', 'bun remove eslint @types/node'))
it('multiple', _('eslint @types/node', 'bun remove eslint @types/node'))

test('global', _('eslint nyxi -g', 'bun remove -g eslint nyxi'))
it('global', _('eslint nyxi -g', 'bun remove -g eslint nyxi'))
24 changes: 12 additions & 12 deletions test/nyxun/npm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxun } from '../../src/commands'

const agent = 'npm'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('single uninstall', _('axios', 'npm uninstall axios'))
it('single uninstall', _('axios', 'npm uninstall axios'))

test('multiple', _('eslint @types/node', 'npm uninstall eslint @types/node'))
it('multiple', _('eslint @types/node', 'npm uninstall eslint @types/node'))

test('-D', _('eslint @types/node -D', 'npm uninstall eslint @types/node -D'))
it('-D', _('eslint @types/node -D', 'npm uninstall eslint @types/node -D'))

test('global', _('eslint -g', 'npm uninstall -g eslint'))
it('global', _('eslint -g', 'npm uninstall -g eslint'))
24 changes: 12 additions & 12 deletions test/nyxun/pnpm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxun } from '../../src/commands'

const agent = 'pnpm'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('single add', _('axios', 'pnpm remove axios'))
it('single add', _('axios', 'pnpm remove axios'))

test('multiple', _('eslint @types/node', 'pnpm remove eslint @types/node'))
it('multiple', _('eslint @types/node', 'pnpm remove eslint @types/node'))

test('-D', _('-D eslint @types/node', 'pnpm remove -D eslint @types/node'))
it('-D', _('-D eslint @types/node', 'pnpm remove -D eslint @types/node'))

test('global', _('eslint -g', 'pnpm remove --global eslint'))
it('global', _('eslint -g', 'pnpm remove --global eslint'))
24 changes: 12 additions & 12 deletions test/nyxun/yarn.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxun } from '../../src/commands'

const agent = 'yarn'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('single uninstall', _('axios', 'yarn remove axios'))
it('single uninstall', _('axios', 'yarn remove axios'))

test('multiple', _('eslint @types/node', 'yarn remove eslint @types/node'))
it('multiple', _('eslint @types/node', 'yarn remove eslint @types/node'))

test('-D', _('eslint @types/node -D', 'yarn remove eslint @types/node -D'))
it('-D', _('eslint @types/node -D', 'yarn remove eslint @types/node -D'))

test('global', _('eslint nyxi -g', 'yarn global remove eslint nyxi'))
it('global', _('eslint nyxi -g', 'yarn global remove eslint nyxi'))
24 changes: 12 additions & 12 deletions test/nyxun/[email protected]
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { expect, test } from 'vitest'
import { expect, it } from 'vitest'
import { parseNyxun } from '../../src/commands'

const agent = 'yarn@berry'
function _(arg: string, expected: string) {
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
return () => {
expect(
parseNyxun(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
}
}

test('single add', _('axios', 'yarn remove axios'))
it('single add', _('axios', 'yarn remove axios'))

test('multiple', _('eslint @types/node', 'yarn remove eslint @types/node'))
it('multiple', _('eslint @types/node', 'yarn remove eslint @types/node'))

test('-D', _('eslint @types/node -D', 'yarn remove eslint @types/node -D'))
it('-D', _('eslint @types/node -D', 'yarn remove eslint @types/node -D'))

test('global', _('eslint nyxi -g', 'npm uninstall -g eslint nyxi'))
it('global', _('eslint nyxi -g', 'npm uninstall -g eslint nyxi'))

0 comments on commit 832d86e

Please sign in to comment.