Skip to content

Commit 9143e2f

Browse files
authored
chore: update ESLint and Prettier (#337)
* chore: update ESLint and Prettier * chore: update `fix` script * chore: add .editorconfig back * chore: add .gitattributes * chore: update .prettierignore
1 parent d7db51c commit 9143e2f

7 files changed

+717
-1874
lines changed

.eslintignore

-1
This file was deleted.

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.prettierignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
.nyc_output/
2-
cjs/
3-
tests/snapshots/
1+
tests/snapshots/

eslint.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import globals from 'globals'
2+
import eslintJs from '@eslint/js'
3+
import eslintConfigPrettier from 'eslint-config-prettier'
4+
import eslintPluginN from 'eslint-plugin-n'
5+
import eslintPluginPromise from 'eslint-plugin-promise'
6+
7+
export default [
8+
eslintJs.configs.recommended,
9+
eslintPluginN.configs['flat/recommended'],
10+
eslintPluginPromise.configs['flat/recommended'],
11+
eslintConfigPrettier,
12+
{
13+
languageOptions: {
14+
globals: { ...globals.builtin, ...globals.node },
15+
},
16+
},
17+
{ ignores: ['cjs'] },
18+
]

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import isPlainObject from 'is-plain-obj'
66
import semver from 'semver'
77

88
const hasOwn =
9+
// eslint-disable-next-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax -- will enable later
910
Object.hasOwn ||
1011
// TODO: Remove this when we drop supported for Node.js v14
1112
((object, property) => Object.prototype.hasOwnProperty.call(object, property))
1213
const pipe =
1314
(fns) =>
1415
(x, ...args) =>
1516
fns.reduce((result, fn) => fn(result, ...args), x)
16-
const onArray = (fn) => (x) => Array.isArray(x) ? fn(x) : x
17+
const onArray = (fn) => (x) => (Array.isArray(x) ? fn(x) : x)
1718
const onStringArray = (fn) => (x) =>
1819
Array.isArray(x) && x.every((item) => typeof item === 'string') ? fn(x) : x
1920
const uniq = onStringArray((xs) => [...new Set(xs)])

0 commit comments

Comments
 (0)