Skip to content

Commit

Permalink
Merge pull request #321 from jakemulley/better-linting
Browse files Browse the repository at this point in the history
Configure ESLint and Prettier for more opinionated linting and formatting
  • Loading branch information
jakemulley authored Jan 23, 2024
2 parents 040479e + a2207a7 commit 8b1cc39
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 113 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ module.exports = {
es2021: true,
node: true,
},
extends: ["eslint:recommended", "plugin:astro/recommended"],
extends: [
"eslint:recommended",
"plugin:astro/recommended",
"plugin:astro/jsx-a11y-strict",
],
overrides: [
{
env: {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: withastro/action@v1
with:
node-version: 20
- run: npm run lint
- run: npm run ci
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
needs: build
Expand Down
20 changes: 18 additions & 2 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
/** @type {import("prettier").Config} */
/**
* @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions &
* import("@ianvs/prettier-plugin-sort-imports").PluginConfig}
*/
export default {
plugins: ["prettier-plugin-astro"],
arrowParens: "always",
printWidth: 80,
singleQuote: false,
jsxSingleQuote: false,
semi: true,
trailingComma: "all",
tabWidth: 2,
plugins: [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-astro",
"prettier-plugin-tailwindcss",
],
overrides: [
{
files: "*.astro",
Expand All @@ -9,4 +23,6 @@ export default {
},
},
],
astroAllowShorthand: false,
tailwindConfig: "./tailwind.config.mjs",
};
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config";

// https://astro.build/config
export default defineConfig({
Expand Down
Loading

0 comments on commit 8b1cc39

Please sign in to comment.