From: Jérôme Benoit Date: Wed, 21 Aug 2024 20:37:49 +0000 (+0200) Subject: refactor: switch to eslint-plugin-perfectionist X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b7e08e92e7f9fecee903ccf5cece77ec028b14b2;p=benchmarks-js.git refactor: switch to eslint-plugin-perfectionist Signed-off-by: Jérôme Benoit --- diff --git a/.lintstagedrc.js b/.lintstagedrc.js index ee8d109..e4d94c7 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,5 +1,5 @@ export default { '*.{js,jsx,cjs,mjs}': ['biome format --write', 'eslint --cache --fix'], - '*.json': ['biome format --write'], '*.{md,yml,yaml}': ['prettier --cache --write'], + '*.json': ['biome format --write'], } diff --git a/eslint.config.js b/eslint.config.js index c17ca10..a1f1e2e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,7 +2,7 @@ import js from '@eslint/js' import { defineFlatConfig } from 'eslint-define-config' import jsdoc from 'eslint-plugin-jsdoc' -import simpleImportSort from 'eslint-plugin-simple-import-sort' +import perfectionist from 'eslint-plugin-perfectionist' import neostandard, { plugins } from 'neostandard' export default defineFlatConfig([ @@ -10,14 +10,6 @@ export default defineFlatConfig([ plugins.promise.configs['flat/recommended'], plugins.n.configs['flat/recommended'], jsdoc.configs['flat/recommended'], - { - plugins: { - 'simple-import-sort': simpleImportSort, - }, - rules: { - 'simple-import-sort/imports': 'error', - 'simple-import-sort/exports': 'error', - }, - }, + perfectionist.configs['recommended-natural'], ...neostandard(), ]) diff --git a/json-stringify.mjs b/json-stringify.mjs index ce58552..2e44e30 100644 --- a/json-stringify.mjs +++ b/json-stringify.mjs @@ -1,14 +1,14 @@ import { bench, group, run } from 'tatami-ng' const sampleObj = { - name: 'Sid', - age: 29, - engineer: true, - expertise: ['html', 'css', 'react'], address: { city: 'New york', state: 'NY', }, + age: 29, + engineer: true, + expertise: ['html', 'css', 'react'], + name: 'Sid', } group('JSON stringify', () => { diff --git a/package.json b/package.json index 97b4358..77b29b2 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "eslint": "^9.9.0", "eslint-define-config": "^2.1.0", "eslint-plugin-jsdoc": "^50.2.2", - "eslint-plugin-simple-import-sort": "^12.1.1", + "eslint-plugin-perfectionist": "^3.2.0", "husky": "^9.1.5", "lint-staged": "^15.2.9", "neostandard": "^0.11.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7eaff57..35fc158 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,7 +47,7 @@ importers: version: 1.8.3 '@commitlint/cli': specifier: ^19.4.0 - version: 19.4.0(@types/node@22.4.1)(typescript@5.5.4) + version: 19.4.0(@types/node@22.5.0)(typescript@5.5.4) '@commitlint/config-conventional': specifier: ^19.2.2 version: 19.2.2 @@ -63,9 +63,9 @@ importers: eslint-plugin-jsdoc: specifier: ^50.2.2 version: 50.2.2(eslint@9.9.0(jiti@1.21.6)) - eslint-plugin-simple-import-sort: - specifier: ^12.1.1 - version: 12.1.1(eslint@9.9.0(jiti@1.21.6)) + eslint-plugin-perfectionist: + specifier: ^3.2.0 + version: 3.2.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) husky: specifier: ^9.1.5 version: 9.1.5 @@ -313,8 +313,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/node@22.4.1': - resolution: {integrity: sha512-1tbpb9325+gPnKK0dMm+/LMriX0vKxf6RnB0SZUqfyVkQ4fMgUSySqhxE/y8Jvs4NyF1yHzTfG9KlnkIODxPKg==} + '@types/node@22.5.0': + resolution: {integrity: sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==} '@typescript-eslint/eslint-plugin@8.2.0': resolution: {integrity: sha512-02tJIs655em7fvt9gps/+4k4OsKULYGtLBPJfOsmOq1+3cdClYiF0+d6mHu6qDnTcg88wJBkcPLpQhq7FyDz0A==} @@ -726,6 +726,25 @@ packages: peerDependencies: eslint: '>=8.23.0' + eslint-plugin-perfectionist@3.2.0: + resolution: {integrity: sha512-cX1aztMbSfRWPKJH8CD+gadrbkS+RNH1OGWuNGws8J6rHzYYhawxWTU/yzMYjq2IRJCpBCfhgfa7BHRXQYxLHA==} + engines: {node: ^18.0.0 || >=20.0.0} + peerDependencies: + astro-eslint-parser: ^1.0.2 + eslint: '>=8.0.0' + svelte: '>=3.0.0' + svelte-eslint-parser: ^0.41.0 + vue-eslint-parser: '>=9.0.0' + peerDependenciesMeta: + astro-eslint-parser: + optional: true + svelte: + optional: true + svelte-eslint-parser: + optional: true + vue-eslint-parser: + optional: true + eslint-plugin-promise@7.1.0: resolution: {integrity: sha512-8trNmPxdAy3W620WKDpaS65NlM5yAumod6XeC4LOb+jxlkG4IVcp68c6dXY2ev+uT4U1PtG57YDV6EGAXN0GbQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -738,11 +757,6 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 - eslint-plugin-simple-import-sort@12.1.1: - resolution: {integrity: sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==} - peerDependencies: - eslint: '>=5.0.0' - eslint-scope@8.0.2: resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1000,8 +1014,8 @@ packages: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} - is-core-module@2.15.0: - resolution: {integrity: sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==} + is-core-module@2.15.1: + resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} engines: {node: '>= 0.4'} is-data-view@1.0.1: @@ -1256,6 +1270,10 @@ packages: resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} engines: {node: '>=18'} + minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -1269,6 +1287,9 @@ packages: ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + natural-compare-lite@1.4.0: + resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} + natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -1538,8 +1559,8 @@ packages: spdx-expression-parse@4.0.0: resolution: {integrity: sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==} - spdx-license-ids@3.0.18: - resolution: {integrity: sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==} + spdx-license-ids@3.0.20: + resolution: {integrity: sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==} split2@4.2.0: resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} @@ -1803,11 +1824,11 @@ snapshots: '@biomejs/cli-win32-x64@1.8.3': optional: true - '@commitlint/cli@19.4.0(@types/node@22.4.1)(typescript@5.5.4)': + '@commitlint/cli@19.4.0(@types/node@22.5.0)(typescript@5.5.4)': dependencies: '@commitlint/format': 19.3.0 '@commitlint/lint': 19.2.2 - '@commitlint/load': 19.4.0(@types/node@22.4.1)(typescript@5.5.4) + '@commitlint/load': 19.4.0(@types/node@22.5.0)(typescript@5.5.4) '@commitlint/read': 19.4.0 '@commitlint/types': 19.0.3 execa: 8.0.1 @@ -1854,7 +1875,7 @@ snapshots: '@commitlint/rules': 19.0.3 '@commitlint/types': 19.0.3 - '@commitlint/load@19.4.0(@types/node@22.4.1)(typescript@5.5.4)': + '@commitlint/load@19.4.0(@types/node@22.5.0)(typescript@5.5.4)': dependencies: '@commitlint/config-validator': 19.0.3 '@commitlint/execute-rule': 19.0.0 @@ -1862,7 +1883,7 @@ snapshots: '@commitlint/types': 19.0.3 chalk: 5.3.0 cosmiconfig: 9.0.0(typescript@5.5.4) - cosmiconfig-typescript-loader: 5.0.0(@types/node@22.4.1)(cosmiconfig@9.0.0(typescript@5.5.4))(typescript@5.5.4) + cosmiconfig-typescript-loader: 5.0.0(@types/node@22.5.0)(cosmiconfig@9.0.0(typescript@5.5.4))(typescript@5.5.4) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 @@ -2020,7 +2041,7 @@ snapshots: '@types/conventional-commits-parser@5.0.0': dependencies: - '@types/node': 22.4.1 + '@types/node': 22.5.0 '@types/eslint@9.6.0': dependencies: @@ -2031,7 +2052,7 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/node@22.4.1': + '@types/node@22.5.0': dependencies: undici-types: 6.19.8 @@ -2320,9 +2341,9 @@ snapshots: meow: 12.1.1 split2: 4.2.0 - cosmiconfig-typescript-loader@5.0.0(@types/node@22.4.1)(cosmiconfig@9.0.0(typescript@5.5.4))(typescript@5.5.4): + cosmiconfig-typescript-loader@5.0.0(@types/node@22.5.0)(cosmiconfig@9.0.0(typescript@5.5.4))(typescript@5.5.4): dependencies: - '@types/node': 22.4.1 + '@types/node': 22.5.0 cosmiconfig: 9.0.0(typescript@5.5.4) jiti: 1.21.6 typescript: 5.5.4 @@ -2558,6 +2579,17 @@ snapshots: minimatch: 9.0.5 semver: 7.6.3 + eslint-plugin-perfectionist@3.2.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4): + dependencies: + '@typescript-eslint/types': 8.2.0 + '@typescript-eslint/utils': 8.2.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4) + eslint: 9.9.0(jiti@1.21.6) + minimatch: 10.0.1 + natural-compare-lite: 1.4.0 + transitivePeerDependencies: + - supports-color + - typescript + eslint-plugin-promise@7.1.0(eslint@9.9.0(jiti@1.21.6)): dependencies: eslint: 9.9.0(jiti@1.21.6) @@ -2584,10 +2616,6 @@ snapshots: string.prototype.matchall: 4.0.11 string.prototype.repeat: 1.0.0 - eslint-plugin-simple-import-sort@12.1.1(eslint@9.9.0(jiti@1.21.6)): - dependencies: - eslint: 9.9.0(jiti@1.21.6) - eslint-scope@8.0.2: dependencies: esrecurse: 4.3.0 @@ -2873,7 +2901,7 @@ snapshots: is-callable@1.2.7: {} - is-core-module@2.15.0: + is-core-module@2.15.1: dependencies: hasown: 2.0.2 @@ -3100,6 +3128,10 @@ snapshots: mimic-function@5.0.1: {} + minimatch@10.0.1: + dependencies: + brace-expansion: 2.0.1 + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -3112,6 +3144,8 @@ snapshots: ms@2.1.2: {} + natural-compare-lite@1.4.0: {} + natural-compare@1.4.0: {} neostandard@0.11.3(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4): @@ -3291,7 +3325,7 @@ snapshots: resolve@2.0.0-next.5: dependencies: - is-core-module: 2.15.0 + is-core-module: 2.15.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 @@ -3377,9 +3411,9 @@ snapshots: spdx-expression-parse@4.0.0: dependencies: spdx-exceptions: 2.5.0 - spdx-license-ids: 3.0.18 + spdx-license-ids: 3.0.20 - spdx-license-ids@3.0.18: {} + spdx-license-ids@3.0.20: {} split2@4.2.0: {} diff --git a/quick-select.mjs b/quick-select.mjs index 5fc3ef3..411c897 100644 --- a/quick-select.mjs +++ b/quick-select.mjs @@ -1,5 +1,4 @@ import { randomInt } from 'node:crypto' - import { bench, group, run } from 'tatami-ng' /** diff --git a/random.mjs b/random.mjs index e3bd25f..b616a7a 100644 --- a/random.mjs +++ b/random.mjs @@ -1,5 +1,4 @@ import { randomInt } from 'node:crypto' - import { bench, group, run } from 'tatami-ng' import { diff --git a/uuid-generator.mjs b/uuid-generator.mjs index e48d244..029940f 100644 --- a/uuid-generator.mjs +++ b/uuid-generator.mjs @@ -1,5 +1,4 @@ import { randomUUID } from 'node:crypto' - import { bench, group, run } from 'tatami-ng' import { v4 as uuid } from 'uuid'