diff --git a/.eslintrc.json b/.eslintrc.json index ef52c89..82199ab 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -26,12 +26,19 @@ "plugin:react/jsx-runtime", "plugin:jsx-a11y/recommended", "plugin:react-hooks/recommended", - "plugin:astro/recommended" + "plugin:astro/recommended", + "prettier" ], - "plugins": ["@typescript-eslint", "sort-keys-fix", "sort-destructure-keys"], + "plugins": [ + "@typescript-eslint", + "sort-keys-fix", + "sort-destructure-keys", + "prettier" + ], "rules": { + "prettier/prettier": "error", "sort-keys-fix/sort-keys-fix": ["warn", "asc"], "sort-destructure-keys/sort-destructure-keys": "warn", "react/jsx-sort-props": [ diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..e1a0496 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +node_modules/ +dist/ +.output/ diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..e188e16 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "plugins": ["prettier-plugin-astro"], + "singleQuote": true, + "arrowParens": "avoid", + "endOfLine": "lf", + "tabWidth": 2, + "semi": true +} diff --git a/package-lock.json b/package-lock.json index d2dd7dc..945a7fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,15 +20,19 @@ "@typescript-eslint/parser": "6.7.4", "astro-eslint-parser": "0.16.0", "eslint": "8.50.0", + "eslint-config-prettier": "9.0.0", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-astro": "0.29.1", "eslint-plugin-import": "2.28.1", "eslint-plugin-jsx-a11y": "6.7.1", + "eslint-plugin-prettier": "5.0.0", "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-sort-destructure-keys": "1.5.0", "eslint-plugin-sort-keys-fix": "1.1.2", "postcss-html": "1.5.0", + "prettier": "3.0.3", + "prettier-plugin-astro": "0.12.0", "stylelint": "15.10.3", "stylelint-config-html": "1.1.0", "stylelint-config-idiomatic-order": "9.0.0", @@ -3288,6 +3292,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz", + "integrity": "sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -3501,6 +3517,35 @@ "semver": "bin/semver.js" } }, + "node_modules/eslint-plugin-prettier": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", + "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.5" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, "node_modules/eslint-plugin-react": { "version": "7.33.2", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", @@ -7582,7 +7627,6 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true, - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -7605,6 +7649,26 @@ "node": ">=6.0.0" } }, + "node_modules/prettier-plugin-astro": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.12.0.tgz", + "integrity": "sha512-8E+9YQR6/5CPZJs8XsfBw579zrwZkc0Wb7x0fRVm/51JC8Iys4lBw4ecV8fHwpbQnzve86TUa4fJ08BJzqfWnA==", + "dev": true, + "dependencies": { + "@astrojs/compiler": "^1.5.5", + "prettier": "^3.0.0", + "sass-formatter": "^0.7.6" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + } + }, + "node_modules/prettier-plugin-astro/node_modules/@astrojs/compiler": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-1.8.2.tgz", + "integrity": "sha512-o/ObKgtMzl8SlpIdzaxFnt7SATKPxu4oIP/1NL+HDJRzxfJcAkOTAb/ZKMRyULbz4q+1t2/DAebs2Z1QairkZw==", + "dev": true + }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", @@ -8403,6 +8467,12 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/s.color": { + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/s.color/-/s.color-0.0.15.tgz", + "integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==", + "dev": true + }, "node_modules/sade": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", @@ -8470,6 +8540,15 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/sass-formatter": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/sass-formatter/-/sass-formatter-0.7.8.tgz", + "integrity": "sha512-7fI2a8THglflhhYis7k06eUf92VQuJoXzEs2KRP0r1bluFxKFvLx0Ns7c478oYGM0fPfrr846ZRWVi2MAgHt9Q==", + "dev": true, + "dependencies": { + "suf-log": "^2.5.3" + } + }, "node_modules/sax": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", @@ -9213,6 +9292,15 @@ "node": ">=8" } }, + "node_modules/suf-log": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz", + "integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==", + "dev": true, + "dependencies": { + "s.color": "0.0.15" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", diff --git a/package.json b/package.json index e61cee8..d987008 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.astro", "lint:fix": "npm run lint -- --fix", "lint:style": "stylelint ./**/*.{css,astro,html}", - "lint:style:fix": "npm run lint:style -- --fix" + "lint:style:fix": "npm run lint:style -- --fix", + "format": "prettier . --write" }, "dependencies": { "@astrojs/react": "^3.0.3", @@ -26,15 +27,19 @@ "@typescript-eslint/parser": "6.7.4", "astro-eslint-parser": "0.16.0", "eslint": "8.50.0", + "eslint-config-prettier": "9.0.0", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-astro": "0.29.1", "eslint-plugin-import": "2.28.1", "eslint-plugin-jsx-a11y": "6.7.1", + "eslint-plugin-prettier": "5.0.0", "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-sort-destructure-keys": "1.5.0", "eslint-plugin-sort-keys-fix": "1.1.2", "postcss-html": "1.5.0", + "prettier": "3.0.3", + "prettier-plugin-astro": "0.12.0", "stylelint": "15.10.3", "stylelint-config-html": "1.1.0", "stylelint-config-idiomatic-order": "9.0.0",