Skip to content
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
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import {fileURLToPath} from 'node:url'

const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')

export default [includeIgnoreFile(gitignorePath), ...oclif, prettier]
const configs = [includeIgnoreFile(gitignorePath), ...oclif, prettier]

export default configs
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"@types/node": "^18",
"chai": "^4.5.0",
"commitlint": "^19",
"eslint": "^9.39.5",
"eslint-config-oclif": "^6.0.179",
"eslint": "^10.8.1",
"eslint-config-oclif": "^7.1.5",
"eslint-config-prettier": "^10.1.8",
"husky": "^9.1.7",
"lint-staged": "^15",
Expand Down
7 changes: 4 additions & 3 deletions src/commands/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Command, Flags, Interfaces} from '@oclif/core'
import {Command, Flags, type Interfaces} from '@oclif/core'
import {Ansis} from 'ansis'
import {execFile} from 'node:child_process'
import {EOL} from 'node:os'
Expand Down Expand Up @@ -53,7 +53,8 @@ async function formatPlugins(
): Promise<string[]> {
const sorted = Object.entries(plugins)
.map(([name, plugin]) => ({name, ...plugin}))
.sort((a, b) => (a.name > b.name ? 1 : -1))
// eslint-disable-next-line unicorn/prefer-simple-sort-comparator
.toSorted((a, b) => (a.name > b.name ? 1 : -1))

return Promise.all(
sorted.map(async (plugin) => {
Expand Down Expand Up @@ -103,7 +104,7 @@ export default class Version extends Command {
const {pluginVersions, ...theRest} = this.config.versionDetails
const versionDetail: VersionDetail = {...theRest}

let output = `${this.config.userAgent}`
let output = this.config.userAgent
if (flags.verbose) {
const details = await getNpmDetails(this.config.pjson.name)

Expand Down
10 changes: 5 additions & 5 deletions test/commands/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {runCommand} from '@oclif/test'
import {expect} from 'chai'
import {readFileSync} from 'node:fs'
import {release, type} from 'node:os'
import {resolve} from 'node:path'
import path from 'node:path'

const pjson = JSON.parse(readFileSync(resolve('package.json'), 'utf8'))
const pjson = JSON.parse(readFileSync(path.resolve('package.json'), 'utf8')) as {version: string}

describe('version', () => {
it('runs version', async () => {
Expand Down Expand Up @@ -32,19 +32,19 @@ describe('version', () => {

it('runs version --json', async () => {
const {stdout} = await runCommand('version --json')
const json = JSON.parse(stdout)
const json = JSON.parse(stdout) as unknown
expect(json).to.have.keys(['cliVersion', 'architecture', 'nodeVersion'])
})

it('runs version --json --verbose', async () => {
const {stdout} = await runCommand('version --json --verbose')
const json = JSON.parse(stdout)
const json = JSON.parse(stdout) as unknown
expect(json).to.have.property('architecture', `${process.platform}-${process.arch}`)
expect(json).to.have.property('cliVersion', `@oclif/plugin-version/${pjson.version}`)
expect(json).to.have.property('nodeVersion', `node-${process.version}`)
expect(json).to.have.property('osVersion', `${type()} ${release()}`)
expect(json).to.have.property('pluginVersions')
expect(json.pluginVersions).to.an('array')
expect((json as {pluginVersions: unknown}).pluginVersions).to.an('array')
expect(json).to.have.property('shell')
expect(json).to.have.property('rootPath', process.cwd())
})
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"pretty": true,
"rootDirs": ["./src"],
"strict": true,
"target": "ES2022",
"target": "ES2024",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only repo to change tsconfig.target - why only here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the changes was from Array.sort to Array.toSorted, which was introduced in ES2024.

"moduleResolution": "Node16"
},
"include": ["./src/**/*"],
Expand Down
Loading
Loading