Skip to content

Commit

Permalink
Add prettier and ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
solomonhawk committed Oct 19, 2023
1 parent 3080685 commit 0652d93
Show file tree
Hide file tree
Showing 25 changed files with 4,609 additions and 354 deletions.
35 changes: 35 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
root: true,
env: {
es6: true,
},
extends: [
'plugin:astro/recommended',
'plugin:astro/jsx-a11y-strict',
'plugin:prettier/recommended',
],
plugins: ['simple-import-sort'],
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
overrides: [
{
files: ['*.astro'],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
},
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
],
};
23 changes: 22 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Github Pages Astro CI

on:
pull_request:
push:
branches: [ main ]
workflow_dispatch:
Expand All @@ -12,11 +13,31 @@ permissions:
id-token: write

jobs:
lint-format:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v2

- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'

- name: Install NPM dependencies
run: npm ci

- name: Lint and format
run: npm run lint:ci

build:
needs: lint-format
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v2

- name: Install, build, and upload your site
uses: withastro/action@v0

Expand All @@ -29,4 +50,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v1
23 changes: 23 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/** @type {import('prettier').Config} */
module.exports = {
arrowParens: 'always',
bracketSameLine: false,
bracketSpacing: true,
htmlWhitespaceSensitivity: 'css',
printWidth: 80,
proseWrap: 'preserve',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
plugins: ['prettier-plugin-astro', 'prettier-plugin-tailwindcss'],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
],
};
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 16.13.1
nodejs 18.17.1
Loading

0 comments on commit 0652d93

Please sign in to comment.