From 3dc195d0dc38bd42da00a59237f1219f62f0fab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Felipe=20Schulle?= Date: Tue, 18 Jun 2024 15:08:53 -0300 Subject: [PATCH] =?UTF-8?q?fix(import-order):=20corre=C3=A7=C3=A3o=20ao=20?= =?UTF-8?q?ordenar=20importa=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 152 ++++++++++---------- pnpm-lock.yaml | 295 +++++++++++++++++++++++++++++++++++++- src/create-config.ts | 37 ++--- src/index.ts | 1 + src/plugins.ts | 5 +- src/presets/base.ts | 106 +++++++------- src/presets/node.ts | 48 ++++--- src/presets/typescript.ts | 145 +++++++++---------- 8 files changed, 541 insertions(+), 248 deletions(-) diff --git a/package.json b/package.json index b8a452a..ea9281d 100644 --- a/package.json +++ b/package.json @@ -1,78 +1,78 @@ { - "name": "@brainylab/eslint-config", - "version": "2.3.5", - "license": "MIT", - "type": "module", - "author": { - "name": "André Felipe Schulle", - "email": "dev@brainylab.com.br" - }, - "bugs": { - "url": "https://github.com/brainylab/eslint-config/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/brainylab/eslint-config.git" - }, - "main": "./index.js", - "module": "./index.js", - "types": "./index.d.ts", - "exports": "./index.js", - "keywords": [ - "eslint", - "config", - "preset", - "brainylab" - ], - "description": "ESLint config for BrainyLab projects", - "scripts": { - "build": "npm run build:remove && npm run build:configs && npm run build:packages && npm run build:public-archives", - "build:remove": "rm -rf ./dist", - "build:configs": "npx tsup", - "build:packages": "npx tsx ./scripts/build-packages.ts", - "build:public-archives": "cp ./README.md ./dist && cp ./LICENSE ./dist", - "commit:add": "git add .", - "commit:detail": "cz", - "commit:push": "git push", - "commit": "pnpm commit:add && pnpm commit:detail && pnpm commit:push" - }, - "dependencies": { - "@eslint/js": "9.4.0", - "eslint": "9.4.0", - "eslint-config-prettier": "9.1.0", - "eslint-define-config": "2.1.0", - "eslint-plugin-import-x": "0.5.1", - "eslint-plugin-n": "17.9.0", - "globals": "15.4.0", - "typescript-eslint": "7.13.0" - }, - "devDependencies": { - "@brainylab/prettier-config": "0.1.4", - "@types/eslint-config-prettier": "6.11.3", - "@types/eslint__js": "8.42.3", - "@types/node": "20.14.2", - "commitizen": "^4.3.0", - "cz-conventional-changelog": "^3.3.0", - "fast-glob": "3.3.2", - "tsup": "8.1.0", - "tsx": "4.15.4", - "typescript": "^5.4.5" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "eslint": ">=8.56.0", - "typescript": ">=4" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - }, - "config": { - "commitizen": { - "path": "./node_modules/cz-conventional-changelog" - } - } + "name": "@brainylab/eslint-config", + "version": "2.3.6", + "description": "ESLint config for BrainyLab projects", + "keywords": [ + "eslint", + "config", + "preset", + "brainylab" + ], + "bugs": { + "url": "https://github.com/brainylab/eslint-config/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/brainylab/eslint-config.git" + }, + "license": "MIT", + "author": { + "name": "André Felipe Schulle", + "email": "dev@brainylab.com.br" + }, + "type": "module", + "exports": "./index.js", + "main": "./index.js", + "module": "./index.js", + "types": "./index.d.ts", + "scripts": { + "build": "npm run build:remove && npm run build:configs && npm run build:packages && npm run build:public-archives", + "build:configs": "npx tsup", + "build:packages": "npx tsx ./scripts/build-packages.ts", + "build:public-archives": "cp ./README.md ./dist && cp ./LICENSE ./dist", + "build:remove": "rm -rf ./dist", + "commit": "pnpm commit:add && pnpm commit:detail && pnpm commit:push", + "commit:add": "git add .", + "commit:detail": "cz", + "commit:push": "git push" + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } + }, + "dependencies": { + "@eslint/js": "9.4.0", + "eslint": "9.4.0", + "eslint-config-prettier": "9.1.0", + "eslint-define-config": "2.1.0", + "eslint-plugin-import-x": "0.5.1", + "eslint-plugin-n": "17.9.0", + "globals": "15.4.0", + "typescript-eslint": "7.13.0" + }, + "devDependencies": { + "@brainylab/prettier-config": "0.2.4", + "@types/eslint-config-prettier": "6.11.3", + "@types/eslint__js": "8.42.3", + "@types/node": "20.14.2", + "commitizen": "^4.3.0", + "cz-conventional-changelog": "^3.3.0", + "fast-glob": "3.3.2", + "tsup": "8.1.0", + "tsx": "4.15.4", + "typescript": "^5.4.5" + }, + "peerDependencies": { + "eslint": ">=8.56.0", + "typescript": ">=4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + }, + "engines": { + "node": ">=18" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e2fbdde..ce975fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,8 +34,8 @@ importers: version: 7.13.0(eslint@9.4.0)(typescript@5.4.5) devDependencies: '@brainylab/prettier-config': - specifier: 0.1.4 - version: 0.1.4(prettier@3.3.2)(typescript@5.4.5) + specifier: 0.2.4 + version: 0.2.4(prettier@3.3.2)(typescript@5.4.5) '@types/eslint-config-prettier': specifier: 6.11.3 version: 6.11.3 @@ -74,16 +74,69 @@ packages: resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} + '@babel/code-frame@7.24.7': + resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} + engines: {node: '>=6.9.0'} + + '@babel/generator@7.24.7': + resolution: {integrity: sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-environment-visitor@7.24.7': + resolution: {integrity: sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-function-name@7.24.7': + resolution: {integrity: sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-hoist-variables@7.24.7': + resolution: {integrity: sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-split-export-declaration@7.24.7': + resolution: {integrity: sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-string-parser@7.24.7': + resolution: {integrity: sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==} + engines: {node: '>=6.9.0'} + '@babel/helper-validator-identifier@7.22.20': resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} + '@babel/helper-validator-identifier@7.24.7': + resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} + engines: {node: '>=6.9.0'} + '@babel/highlight@7.23.4': resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} engines: {node: '>=6.9.0'} - '@brainylab/prettier-config@0.1.4': - resolution: {integrity: sha512-1UsBwgNR2Y0WEqmz1t8fOecR+SDViJd6Zz/PON0fW6viCWUmzCGOl9RPjEOBwJLMxGSfPd8Zx/ekG0kFgjkx9Q==} + '@babel/highlight@7.24.7': + resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==} + engines: {node: '>=6.9.0'} + + '@babel/parser@7.24.7': + resolution: {integrity: sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==} + engines: {node: '>=6.0.0'} + hasBin: true + + '@babel/template@7.24.7': + resolution: {integrity: sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==} + engines: {node: '>=6.9.0'} + + '@babel/traverse@7.24.7': + resolution: {integrity: sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==} + engines: {node: '>=6.9.0'} + + '@babel/types@7.24.7': + resolution: {integrity: sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==} + engines: {node: '>=6.9.0'} + + '@brainylab/prettier-config@0.2.4': + resolution: {integrity: sha512-oR0wc0mbpqRcfrM3aRt5IidEIBG6diIN1tz0gtUFNh/8EnM0d+bg6eB5MtPtq5I3I8xKdr49EAiYZf70h4+x3Q==} engines: {node: '>=18'} peerDependencies: prettier: '>=3' @@ -322,6 +375,10 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} + '@pkgr/core@0.1.1': + resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@rollup/rollup-android-arm-eabi@4.18.0': resolution: {integrity: sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==} cpu: [arm] @@ -681,6 +738,15 @@ packages: supports-color: optional: true + debug@4.3.5: + resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dedent@0.7.0: resolution: {integrity: sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==} @@ -698,6 +764,14 @@ packages: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} + detect-indent@7.0.1: + resolution: {integrity: sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g==} + engines: {node: '>=12.20'} + + detect-newline@4.0.1: + resolution: {integrity: sha512-qE3Veg1YXzGHQhlA6jzebZN2qVf6NX+A7m7qlhCGG30dJixrAQhYOsJjsnBjJkCSmuOPpCk30145fr8FV0bzog==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -889,6 +963,10 @@ packages: function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + get-stdin@9.0.0: + resolution: {integrity: sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==} + engines: {node: '>=12'} + get-stream@6.0.1: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} @@ -896,6 +974,9 @@ packages: get-tsconfig@4.7.5: resolution: {integrity: sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==} + git-hooks-list@3.1.0: + resolution: {integrity: sha512-LF8VeHeR7v+wAbXqfgRlTSX/1BJR9Q1vEMR8JAz1cEg6GX07+zyj3sAdDvYjj/xnlIfVuGgj4qBei1K3hKH+PA==} + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -924,6 +1005,10 @@ packages: resolution: {integrity: sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==} engines: {node: '>=0.10.0'} + globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + globals@14.0.0: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} @@ -936,6 +1021,10 @@ packages: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} + globby@13.2.2: + resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -1032,6 +1121,10 @@ packages: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} + is-plain-obj@4.1.0: + resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} + engines: {node: '>=12'} + is-stream@2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} @@ -1069,6 +1162,11 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true + jsesc@2.5.2: + resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} + engines: {node: '>=4'} + hasBin: true + json-buffer@3.0.1: resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} @@ -1267,6 +1365,9 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + picocolors@1.0.1: + resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -1291,6 +1392,20 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-plugin-curly@0.2.1: + resolution: {integrity: sha512-BadJTlVy/nX+4sgCc5htrgej4yLVRWIMa1PwN96BqlRru4tGkj1fo2OqZE446fJWlddx9xxTMJByDKIZYc7F3Q==} + engines: {node: '>=18'} + peerDependencies: + prettier: ^2 || ^3 + + prettier-plugin-packagejson@2.5.0: + resolution: {integrity: sha512-6XkH3rpin5QEQodBSVNg+rBo4r91g/1mCaRwS1YGdQJZ6jwqrg2UchBsIG9tpS1yK1kNBvOt84OILsX8uHzBGg==} + peerDependencies: + prettier: '>= 1.16.0' + peerDependenciesMeta: + prettier: + optional: true + prettier@3.3.2: resolution: {integrity: sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==} engines: {node: '>=14'} @@ -1391,6 +1506,17 @@ packages: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + slash@4.0.0: + resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} + engines: {node: '>=12'} + + sort-object-keys@1.1.3: + resolution: {integrity: sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==} + + sort-package-json@2.10.0: + resolution: {integrity: sha512-MYecfvObMwJjjJskhxYfuOADkXp1ZMMnCFC8yhp+9HDsk7HhR336hd7eiBs96lTXfiqmUNI+WQCeCMRBhl251g==} + hasBin: true + source-map@0.8.0-beta.0: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} engines: {node: '>= 8'} @@ -1443,6 +1569,10 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + synckit@0.9.0: + resolution: {integrity: sha512-7RnqIMq572L8PeEzKeBINYEJDDxpcH8JEgLwUqBd3TkofhFRbkq4QLR0u+36avGAhCRbk2nnmjcW9SE531hPDg==} + engines: {node: ^14.18.0 || >=16.0.0} + tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} @@ -1464,6 +1594,10 @@ packages: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} + to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -1487,6 +1621,9 @@ packages: tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + tslib@2.6.3: + resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} + tsup@8.1.0: resolution: {integrity: sha512-UFdfCAXukax+U6KzeTNO2kAARHcWxmKsnvSPXUcfA1D+kU05XDccCrkffCQpFaWDsZfV0jMyTsxU39VfCp6EOg==} engines: {node: '>=18'} @@ -1599,9 +1736,42 @@ snapshots: chalk: 2.4.2 optional: true + '@babel/code-frame@7.24.7': + dependencies: + '@babel/highlight': 7.24.7 + picocolors: 1.0.1 + + '@babel/generator@7.24.7': + dependencies: + '@babel/types': 7.24.7 + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + jsesc: 2.5.2 + + '@babel/helper-environment-visitor@7.24.7': + dependencies: + '@babel/types': 7.24.7 + + '@babel/helper-function-name@7.24.7': + dependencies: + '@babel/template': 7.24.7 + '@babel/types': 7.24.7 + + '@babel/helper-hoist-variables@7.24.7': + dependencies: + '@babel/types': 7.24.7 + + '@babel/helper-split-export-declaration@7.24.7': + dependencies: + '@babel/types': 7.24.7 + + '@babel/helper-string-parser@7.24.7': {} + '@babel/helper-validator-identifier@7.22.20': optional: true + '@babel/helper-validator-identifier@7.24.7': {} + '@babel/highlight@7.23.4': dependencies: '@babel/helper-validator-identifier': 7.22.20 @@ -1609,11 +1779,53 @@ snapshots: js-tokens: 4.0.0 optional: true - '@brainylab/prettier-config@0.1.4(prettier@3.3.2)(typescript@5.4.5)': + '@babel/highlight@7.24.7': + dependencies: + '@babel/helper-validator-identifier': 7.24.7 + chalk: 2.4.2 + js-tokens: 4.0.0 + picocolors: 1.0.1 + + '@babel/parser@7.24.7': + dependencies: + '@babel/types': 7.24.7 + + '@babel/template@7.24.7': + dependencies: + '@babel/code-frame': 7.24.7 + '@babel/parser': 7.24.7 + '@babel/types': 7.24.7 + + '@babel/traverse@7.24.7': + dependencies: + '@babel/code-frame': 7.24.7 + '@babel/generator': 7.24.7 + '@babel/helper-environment-visitor': 7.24.7 + '@babel/helper-function-name': 7.24.7 + '@babel/helper-hoist-variables': 7.24.7 + '@babel/helper-split-export-declaration': 7.24.7 + '@babel/parser': 7.24.7 + '@babel/types': 7.24.7 + debug: 4.3.5 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + + '@babel/types@7.24.7': + dependencies: + '@babel/helper-string-parser': 7.24.7 + '@babel/helper-validator-identifier': 7.24.7 + to-fast-properties: 2.0.0 + + '@brainylab/prettier-config@0.2.4(prettier@3.3.2)(typescript@5.4.5)': dependencies: prettier: 3.3.2 + prettier-plugin-curly: 0.2.1(prettier@3.3.2) + prettier-plugin-packagejson: 2.5.0(prettier@3.3.2) optionalDependencies: typescript: 5.4.5 + transitivePeerDependencies: + - supports-color '@commitlint/config-validator@18.4.4': dependencies: @@ -1804,6 +2016,8 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true + '@pkgr/core@0.1.1': {} + '@rollup/rollup-android-arm-eabi@4.18.0': optional: true @@ -2164,6 +2378,10 @@ snapshots: dependencies: ms: 2.1.2 + debug@4.3.5: + dependencies: + ms: 2.1.2 + dedent@0.7.0: {} deep-is@0.1.4: {} @@ -2176,6 +2394,10 @@ snapshots: detect-indent@6.1.0: {} + detect-indent@7.0.1: {} + + detect-newline@4.0.1: {} + dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -2447,12 +2669,16 @@ snapshots: function-bind@1.1.2: {} + get-stdin@9.0.0: {} + get-stream@6.0.1: {} get-tsconfig@4.7.5: dependencies: resolve-pkg-maps: 1.0.0 + git-hooks-list@3.1.0: {} + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -2497,6 +2723,8 @@ snapshots: is-windows: 1.0.2 which: 1.3.1 + globals@11.12.0: {} + globals@14.0.0: {} globals@15.4.0: {} @@ -2510,6 +2738,14 @@ snapshots: merge2: 1.4.1 slash: 3.0.0 + globby@13.2.2: + dependencies: + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.3.1 + merge2: 1.4.1 + slash: 4.0.0 + graceful-fs@4.2.11: {} graphemer@1.4.0: {} @@ -2597,6 +2833,8 @@ snapshots: is-path-inside@3.0.3: {} + is-plain-obj@4.1.0: {} + is-stream@2.0.1: {} is-unicode-supported@0.1.0: {} @@ -2618,13 +2856,14 @@ snapshots: joycon@3.1.1: {} - js-tokens@4.0.0: - optional: true + js-tokens@4.0.0: {} js-yaml@4.1.0: dependencies: argparse: 2.0.1 + jsesc@2.5.2: {} + json-buffer@3.0.1: {} json-parse-even-better-errors@2.3.1: @@ -2807,6 +3046,8 @@ snapshots: path-type@4.0.0: {} + picocolors@1.0.1: {} + picomatch@2.3.1: {} pirates@4.0.6: {} @@ -2818,6 +3059,22 @@ snapshots: prelude-ls@1.2.1: {} + prettier-plugin-curly@0.2.1(prettier@3.3.2): + dependencies: + '@babel/generator': 7.24.7 + '@babel/parser': 7.24.7 + '@babel/traverse': 7.24.7 + prettier: 3.3.2 + transitivePeerDependencies: + - supports-color + + prettier-plugin-packagejson@2.5.0(prettier@3.3.2): + dependencies: + sort-package-json: 2.10.0 + synckit: 0.9.0 + optionalDependencies: + prettier: 3.3.2 + prettier@3.3.2: {} punycode@2.3.1: {} @@ -2916,6 +3173,21 @@ snapshots: slash@3.0.0: {} + slash@4.0.0: {} + + sort-object-keys@1.1.3: {} + + sort-package-json@2.10.0: + dependencies: + detect-indent: 7.0.1 + detect-newline: 4.0.1 + get-stdin: 9.0.0 + git-hooks-list: 3.1.0 + globby: 13.2.2 + is-plain-obj: 4.1.0 + semver: 7.6.2 + sort-object-keys: 1.1.3 + source-map@0.8.0-beta.0: dependencies: whatwg-url: 7.1.0 @@ -2970,6 +3242,11 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + synckit@0.9.0: + dependencies: + '@pkgr/core': 0.1.1 + tslib: 2.6.3 + tapable@2.2.1: {} text-table@0.2.0: {} @@ -2988,6 +3265,8 @@ snapshots: dependencies: os-tmpdir: 1.0.2 + to-fast-properties@2.0.0: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -3006,6 +3285,8 @@ snapshots: tslib@2.6.2: {} + tslib@2.6.3: {} + tsup@8.1.0(typescript@5.4.5): dependencies: bundle-require: 4.2.1(esbuild@0.21.5) diff --git a/src/create-config.ts b/src/create-config.ts index b2d557c..e7e6495 100644 --- a/src/create-config.ts +++ b/src/create-config.ts @@ -1,32 +1,33 @@ import { base } from './presets/base'; import { typescript } from './presets/typescript'; import { node } from './presets/node'; + import type { FlatESLintConfig } from 'eslint-define-config'; type ConfigParams = { - config?: FlatESLintConfig | FlatESLintConfig[]; - presets?: { - typescript?: boolean; - node?: boolean; - }; + config?: FlatESLintConfig | FlatESLintConfig[]; + presets?: { + typescript?: boolean; + node?: boolean; + }; }; export function createConfig(params: ConfigParams): FlatESLintConfig[] { - const configs: FlatESLintConfig[] = [...base]; + const configs: FlatESLintConfig[] = [...base]; - if (params.presets?.typescript) { - configs.push(...typescript); - } + if (params.presets?.typescript) { + configs.push(...typescript); + } - if (params.presets?.node) { - configs.push(...node); - } + if (params.presets?.node) { + configs.push(...node); + } - if (params.config) { - configs.push( - ...(Array.isArray(params.config) ? params.config : [params.config]), - ); - } + if (params.config) { + configs.push( + ...(Array.isArray(params.config) ? params.config : [params.config]), + ); + } - return configs; + return configs; } diff --git a/src/index.ts b/src/index.ts index b37df84..4b510ae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,3 @@ export * from './presets'; export * from './create-config'; +export * from './plugins'; diff --git a/src/plugins.ts b/src/plugins.ts index 9b9e4fa..92d2fa4 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ /* eslint-disable @typescript-eslint/consistent-type-imports */ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck @@ -6,12 +7,12 @@ export type InteropDefault = T extends { default: infer U } ? U : T; /* #__NO_SIDE_EFFECTS__ */ function interopDefault(m: T): InteropDefault { - return (m as any).default || m; + return (m as any).default || m; } import * as _pluginNode from 'eslint-plugin-n'; export const pluginNode: typeof import('eslint-plugin-n') = - interopDefault(_pluginNode); + interopDefault(_pluginNode); import * as _configPrettier from 'eslint-config-prettier'; export const configPrettier: any = interopDefault(_configPrettier); diff --git a/src/presets/base.ts b/src/presets/base.ts index 567dbfc..f4836a1 100644 --- a/src/presets/base.ts +++ b/src/presets/base.ts @@ -1,5 +1,4 @@ import pluginJs from '@eslint/js'; - import globals from 'globals'; import { pluginImport, configPrettier } from '../plugins'; @@ -7,53 +6,60 @@ import { pluginImport, configPrettier } from '../plugins'; import type { FlatESLintConfig } from 'eslint-define-config'; export const base = [ - { - files: ['**/*.{js,cjs,mjs,jsx,ts,tsx}'], - ignores: [ - '**/node_modules/**/*', - '**/build/**/*', - '**/coverage/**/*', - '**/dist/*', - '**/.next/**/*', - '**/*.d.ts', - ], - plugins: { - import: pluginImport, - }, - languageOptions: { - parserOptions: { - ecmaVersion: 'latest', - ecmaFeatures: { - jsx: true, - }, - sourceType: 'module', - }, - globals: { - ...globals.es2021, - }, - }, - rules: { - ...pluginJs.configs.recommended.rules, - 'import-x/named': 'off', - 'no-unused-vars': 'off', - 'import/order': [ - 'error', - { - groups: [ - 'builtin', - 'external', - 'internal', - 'parent', - 'sibling', - 'index', - 'object', - 'type', - ], - pathGroups: [{ group: 'internal', pattern: '{{@,~}/,#}**' }], - pathGroupsExcludedImportTypes: ['type'], - }, - ], - }, - }, - configPrettier, + { + files: ['**/*.{js,cjs,mjs,jsx,ts,tsx}'], + ignores: [ + '**/node_modules/**/*', + '**/build/**/*', + '**/coverage/**/*', + '**/dist/*', + '**/.next/**/*', + '**/*.d.ts', + ], + plugins: { + import: pluginImport, + }, + languageOptions: { + parserOptions: { + ecmaVersion: 'latest', + ecmaFeatures: { + jsx: true, + }, + sourceType: 'module', + }, + globals: { + ...globals.es2021, + }, + }, + rules: { + ...pluginJs.configs.recommended.rules, + 'no-unused-vars': 'off', + 'import-x/named': 'off', + // 'import/order': [ + // 'error', + // { + // 'newlines-between': 'always', + // groups: [ + // 'builtin', + // 'external', + // 'internal', + // 'parent', + // 'sibling', + // 'index', + // 'object', + // ['type'], + // ], + // // pathGroups: [ + // // { + // // pattern: '~/**', + // // group: 'external', + // // }, + // // ], + // // pathGroups: [{ group: 'internal', pattern: '{{@,~}/,#}**' }], + // pathGroupsExcludedImportTypes: ['type'], + // }, + // ], + }, + }, + configPrettier, ] as FlatESLintConfig[]; diff --git a/src/presets/node.ts b/src/presets/node.ts index 5239cce..aab5184 100644 --- a/src/presets/node.ts +++ b/src/presets/node.ts @@ -1,29 +1,31 @@ import globals from 'globals'; + import { pluginNode } from '../plugins'; + import type { FlatESLintConfig } from 'eslint-define-config'; export const node = [ - { - plugins: { - node: pluginNode, - }, - languageOptions: { - globals: { - ...globals.node, - }, - }, - settings: {}, - rules: { - 'no-useless-constructor': 'off', - 'node/handle-callback-err': ['error', '^(err|error)$'], - 'node/no-deprecated-api': 'error', - 'node/no-exports-assign': 'error', - 'node/no-new-require': 'error', - 'node/no-path-concat': 'error', - 'node/no-unsupported-features/es-builtins': 'error', - 'node/prefer-global/buffer': ['error', 'never'], - 'node/prefer-global/process': ['error', 'never'], - 'node/process-exit-as-throw': 'error', - }, - }, + { + plugins: { + node: pluginNode, + }, + languageOptions: { + globals: { + ...globals.node, + }, + }, + settings: {}, + rules: { + 'no-useless-constructor': 'off', + 'node/handle-callback-err': ['error', '^(err|error)$'], + 'node/no-deprecated-api': 'error', + 'node/no-exports-assign': 'error', + 'node/no-new-require': 'error', + 'node/no-path-concat': 'error', + 'node/no-unsupported-features/es-builtins': 'error', + 'node/prefer-global/buffer': ['error', 'never'], + 'node/prefer-global/process': ['error', 'never'], + 'node/process-exit-as-throw': 'error', + }, + }, ] as FlatESLintConfig[]; diff --git a/src/presets/typescript.ts b/src/presets/typescript.ts index 399f9f4..3e07287 100644 --- a/src/presets/typescript.ts +++ b/src/presets/typescript.ts @@ -1,4 +1,5 @@ import { tsEslint } from '../plugins'; + import type { FlatESLintConfig } from 'eslint-define-config'; const typeScriptExtensions = ['.ts', '.tsx'] as const; @@ -6,79 +7,79 @@ const typeScriptExtensions = ['.ts', '.tsx'] as const; const allExtensions = [...typeScriptExtensions, '.js', '.jsx'] as const; const typescriptCore = tsEslint.config({ - extends: [...tsEslint.configs.recommended], - languageOptions: { - parserOptions: { - parser: tsEslint.parser, - project: './tsconfig.json', - ecmaVersion: 'latest', - sourceType: 'module', - }, - }, - settings: { - 'import-x/extensions': allExtensions, - 'import-x/external-module-folders': ['node_modules', 'node_modules/@types'], - 'import-x/parsers': { - '@typescript-eslint/parser': [...typeScriptExtensions, '.cts', '.mts'], - }, - 'import-x/resolver': { - node: { - extensions: allExtensions, - }, - }, - }, - files: ['**/*.{ts,tsx}'], - ignores: [ - '**/node_modules/**/*', - '**/build/**/*', - '**/coverage/**/*', - '**/dist/*', - '**/.next/**/*', - '**/*.d.ts', - ], - rules: { - '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], - '@typescript-eslint/no-unused-vars': 'error', - '@typescript-eslint/consistent-type-exports': 'error', - '@typescript-eslint/consistent-type-imports': [ - 'error', - { fixStyle: 'separate-type-imports' }, - ], - }, + extends: [...tsEslint.configs.recommended], + languageOptions: { + parserOptions: { + parser: tsEslint.parser, + project: './tsconfig.json', + ecmaVersion: 'latest', + sourceType: 'module', + }, + }, + settings: { + 'import-x/extensions': allExtensions, + 'import-x/external-module-folders': ['node_modules', 'node_modules/@types'], + 'import-x/parsers': { + '@typescript-eslint/parser': [...typeScriptExtensions, '.cts', '.mts'], + }, + 'import-x/resolver': { + node: { + extensions: allExtensions, + }, + }, + }, + files: ['**/*.{ts,tsx}'], + ignores: [ + '**/node_modules/**/*', + '**/build/**/*', + '**/coverage/**/*', + '**/dist/*', + '**/.next/**/*', + '**/*.d.ts', + ], + rules: { + '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/consistent-type-exports': 'error', + '@typescript-eslint/consistent-type-imports': [ + 'error', + { fixStyle: 'separate-type-imports' }, + ], + }, }); export const typescript = [ - ...typescriptCore, - { - files: ['**/*.d.ts'], - rules: { - 'eslint-comments/no-unlimited-disable': 'off', - 'import/no-duplicates': 'off', - 'unused-imports/no-unused-vars': 'off', - }, - }, - { - files: ['**/*.{test,spec}.ts?(x)'], - rules: { - 'no-unused-expressions': 'off', - }, - }, - { - files: ['**/*.?([cm])js', '**/*.cjs'], - rules: { - '@typescript-eslint/no-require-imports': 'off', - '@typescript-eslint/no-var-requires': 'off', - }, - }, - { - files: ['**/*.d.ts'], - rules: { - 'no-restricted-syntax': [ - 'error', - 'ForInStatement', - 'LabeledStatement', - 'WithStatement', - ], - }, - }, + ...typescriptCore, + { + files: ['**/*.d.ts'], + rules: { + 'eslint-comments/no-unlimited-disable': 'off', + 'import/no-duplicates': 'off', + 'unused-imports/no-unused-vars': 'off', + }, + }, + { + files: ['**/*.{test,spec}.ts?(x)'], + rules: { + 'no-unused-expressions': 'off', + }, + }, + { + files: ['**/*.?([cm])js', '**/*.cjs'], + rules: { + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-var-requires': 'off', + }, + }, + { + files: ['**/*.d.ts'], + rules: { + 'no-restricted-syntax': [ + 'error', + 'ForInStatement', + 'LabeledStatement', + 'WithStatement', + ], + }, + }, ] as FlatESLintConfig[];