Skip to content

Commit

Permalink
chore: fix eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Mar 4, 2025
1 parent 10c02da commit 6680005
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node
import fs from 'node:fs'
// eslint-disable-next-line n/no-unsupported-features/node-builtins
import streamConsumers from 'node:stream/consumers'
import { globSync } from 'tinyglobby'
import sortPackageJson from './index.js'
Expand Down Expand Up @@ -62,7 +61,6 @@ function sortPackageJsonFiles(patterns, { ignore, ...options }) {

async function sortPackageJsonFromStdin() {
process.stdout.write(
// eslint-disable-next-line n/no-unsupported-features/node-builtins
sortPackageJson(await streamConsumers.text(process.stdin)),
)
}
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default [
languageOptions: {
globals: { ...globals.builtin, ...globals.node },
},
settings: { node: { version: '20' } },
},
{ ignores: ['index.cjs'] },
]
11 changes: 3 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import gitHooks from 'git-hooks-list'
import isPlainObject from 'is-plain-obj'
import semver from 'semver'

const hasOwn =
// eslint-disable-next-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax -- will enable later
Object.hasOwn ||
// TODO: Remove this when we drop supported for Node.js v14
((object, property) => Object.prototype.hasOwnProperty.call(object, property))
const pipe =
(fns) =>
(x, ...args) =>
Expand Down Expand Up @@ -51,7 +46,7 @@ const sortDirectories = sortObjectBy([
const overProperty =
(property, over) =>
(object, ...args) =>
hasOwn(object, property)
Object.hasOwn(object, property)
? { ...object, [property]: over(object[property], ...args) }
: object
const sortGitHooks = sortObjectBy(gitHooks)
Expand Down Expand Up @@ -218,8 +213,8 @@ const defaultNpmScripts = new Set([

const hasDevDependency = (dependency, packageJson) => {
return (
hasOwn(packageJson, 'devDependencies') &&
hasOwn(packageJson.devDependencies, dependency)
Object.hasOwn(packageJson, 'devDependencies') &&
Object.hasOwn(packageJson.devDependencies, dependency)
)
}

Expand Down

0 comments on commit 6680005

Please sign in to comment.