From cf0e3893dfd041f5fa62eb896ad03a6f349c023e Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Fri, 27 Dec 2024 23:21:13 +0100 Subject: [PATCH] chore: set up eslint-plugin-prettier --- .gitignore | 1 + eslint.config.mjs | 2 ++ package.json | 4 +++- pnpm-lock.yaml | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0151cec..0c91ee6 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ package-lock.json *~ *swo *swp +.eslintcache diff --git a/eslint.config.mjs b/eslint.config.mjs index 8b5c925..5fd6947 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -4,6 +4,7 @@ import jsPlugin from '@eslint/js' import tseslint from 'typescript-eslint' import astroSwGlobals from '@ayco/astro-sw/globals' import astroParser from 'astro-eslint-parser' +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' import { includeIgnoreFile } from '@eslint/compat' import path from 'node:path' @@ -25,6 +26,7 @@ export default [ }, // add more generic rule sets here, such as: jsPlugin.configs.recommended, + eslintPluginPrettierRecommended, ...tseslint.configs.recommended, ...eslintPluginAstro.configs['recommended'], ...eslintPluginAstro.configs['jsx-a11y-recommended'], diff --git a/package.json b/package.json index 879e25e..7a6ee69 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "deploy:client": "astro build && scp -r dist/client/ ayo@ayco.io:~/cozy/dist/", "test": "vitest", "prepare": "husky && husky install", - "lint": "eslint . --config eslint.config.mjs", + "lint": "eslint . --config eslint.config.mjs --cache", "format": "prettier . --write" }, "devDependencies": { @@ -38,8 +38,10 @@ "astro-eslint-parser": "^1.1.0", "astro-iconify": "^1.2.0", "eslint": "^9.17.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-astro": "^1.3.1", "eslint-plugin-jsx-a11y": "^6.10.2", + "eslint-plugin-prettier": "^5.2.1", "fastify": "^5.2.0", "globals": "^15.14.0", "husky": "^9.1.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a232736..ea1d5ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,12 +53,18 @@ importers: eslint: specifier: ^9.17.0 version: 9.17.0 + eslint-config-prettier: + specifier: ^9.1.0 + version: 9.1.0(eslint@9.17.0) eslint-plugin-astro: specifier: ^1.3.1 version: 1.3.1(eslint@9.17.0)(typescript@5.7.2) eslint-plugin-jsx-a11y: specifier: ^6.10.2 version: 6.10.2(eslint@9.17.0) + eslint-plugin-prettier: + specifier: ^5.2.1 + version: 5.2.1(eslint-config-prettier@9.1.0(eslint@9.17.0))(eslint@9.17.0)(prettier@3.4.2) fastify: specifier: ^5.2.0 version: 5.2.0 @@ -1830,6 +1836,12 @@ packages: peerDependencies: eslint: '>=6.0.0' + eslint-config-prettier@9.1.0: + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + eslint-plugin-astro@1.3.1: resolution: {integrity: sha512-2XaLCMQm8htW1UvJvy1Zcmg8l0ziskitiUfJTn/w1Mk7r4Mxj0fZeNpN6UTNrm64XBIXSa5h8UCGrg8mdu47+g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1842,6 +1854,20 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9 + eslint-plugin-prettier@5.2.1: + resolution: {integrity: sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + '@types/eslint': '>=8.0.0' + eslint: '>=8.0.0' + eslint-config-prettier: '*' + prettier: '>=3.0.0' + peerDependenciesMeta: + '@types/eslint': + optional: true + eslint-config-prettier: + optional: true + eslint-scope@8.2.0: resolution: {integrity: sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1938,6 +1964,9 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-diff@1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -2996,6 +3025,10 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-linter-helpers@1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + prettier-plugin-astro@0.14.1: resolution: {integrity: sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==} engines: {node: ^14.15.0 || >=16.0.0} @@ -5876,6 +5909,10 @@ snapshots: eslint: 9.17.0 semver: 7.6.3 + eslint-config-prettier@9.1.0(eslint@9.17.0): + dependencies: + eslint: 9.17.0 + eslint-plugin-astro@1.3.1(eslint@9.17.0)(typescript@5.7.2): dependencies: '@eslint-community/eslint-utils': 4.4.1(eslint@9.17.0) @@ -5910,6 +5947,15 @@ snapshots: safe-regex-test: 1.1.0 string.prototype.includes: 2.0.1 + eslint-plugin-prettier@5.2.1(eslint-config-prettier@9.1.0(eslint@9.17.0))(eslint@9.17.0)(prettier@3.4.2): + dependencies: + eslint: 9.17.0 + prettier: 3.4.2 + prettier-linter-helpers: 1.0.0 + synckit: 0.9.2 + optionalDependencies: + eslint-config-prettier: 9.1.0(eslint@9.17.0) + eslint-scope@8.2.0: dependencies: esrecurse: 4.3.0 @@ -6035,6 +6081,8 @@ snapshots: fast-deep-equal@3.1.3: {} + fast-diff@1.3.0: {} + fast-glob@3.3.2: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -7476,6 +7524,10 @@ snapshots: prelude-ls@1.2.1: {} + prettier-linter-helpers@1.0.0: + dependencies: + fast-diff: 1.3.0 + prettier-plugin-astro@0.14.1: dependencies: '@astrojs/compiler': 2.10.3