Skip to content

Commit

Permalink
build: automatic formatting and linting (#4)
Browse files Browse the repository at this point in the history
* build: automatic formatting and linting

* chore: lint and format
  • Loading branch information
AriPerkkio committed Jul 24, 2023
1 parent 8e1895b commit 3247e6c
Show file tree
Hide file tree
Showing 20 changed files with 1,180 additions and 472 deletions.
29 changes: 29 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/** @type {import('eslint/lib/shared/types').ConfigData} */
module.exports = {
root: true,
env: {
node: true,
es6: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:astro/recommended',
],
overrides: [
{
files: ['*.astro'],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
},
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
};
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2

- run: |
pnpm install
pnpm build
- name: Install
run: pnpm install

- name: Build
run: pnpm build

- name: Lint
run: pnpm lint
14 changes: 14 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('prettier').Config} */
module.exports = {
plugins: [require.resolve('prettier-plugin-astro')],
singleQuote: true,
htmlWhitespaceSensitivity: 'ignore',
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
],
};
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"astro",
"typescript",
"typescriptreact"
]
}
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "astro build",
"deploy": "touch dist/.nojekyll && gh-pages --dist dist --dotfiles true",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"lint": "eslint . --max-warnings 0 --ext .astro,.ts,.js"
},
"dependencies": {
"@astrojs/mdx": "^0.19.7",
Expand All @@ -21,6 +22,13 @@
"tailwindcss": "^3.3.3"
},
"devDependencies": {
"gh-pages": "^5.0.0"
"@typescript-eslint/parser": "^6.1.0",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-astro": "^0.27.2",
"eslint-plugin-prettier": "^5.0.0",
"gh-pages": "^5.0.0",
"prettier": "^3.0.0",
"prettier-plugin-astro": "^0.11.0"
}
}
Loading

0 comments on commit 3247e6c

Please sign in to comment.