Skip to content

Commit

Permalink
chore: update ESLint and Prettier (#337)
Browse files Browse the repository at this point in the history
* chore: update ESLint and Prettier

* chore: update `fix` script

* chore: add .editorconfig back

* chore: add .gitattributes

* chore: update .prettierignore
  • Loading branch information
fisker authored Mar 1, 2025
1 parent d7db51c commit 9143e2f
Show file tree
Hide file tree
Showing 7 changed files with 717 additions and 1,874 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
4 changes: 1 addition & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.nyc_output/
cjs/
tests/snapshots/
tests/snapshots/
18 changes: 18 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import globals from 'globals'
import eslintJs from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginN from 'eslint-plugin-n'
import eslintPluginPromise from 'eslint-plugin-promise'

export default [
eslintJs.configs.recommended,
eslintPluginN.configs['flat/recommended'],
eslintPluginPromise.configs['flat/recommended'],
eslintConfigPrettier,
{
languageOptions: {
globals: { ...globals.builtin, ...globals.node },
},
},
{ ignores: ['cjs'] },
]
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ 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) =>
fns.reduce((result, fn) => fn(result, ...args), x)
const onArray = (fn) => (x) => Array.isArray(x) ? fn(x) : x
const onArray = (fn) => (x) => (Array.isArray(x) ? fn(x) : x)
const onStringArray = (fn) => (x) =>
Array.isArray(x) && x.every((item) => typeof item === 'string') ? fn(x) : x
const uniq = onStringArray((xs) => [...new Set(xs)])
Expand Down
Loading

0 comments on commit 9143e2f

Please sign in to comment.