Skip to content

Commit

Permalink
Astro v5 (#40)
Browse files Browse the repository at this point in the history
* chore: update packages

* chore: fix ts issue

* chore: Upgrade ESLint

* Upgrade to astro v5

* fix spellings

* update astro

* update checks
  • Loading branch information
vkbansal authored Dec 23, 2024
1 parent 8d572db commit b14c217
Show file tree
Hide file tree
Showing 59 changed files with 3,759 additions and 2,606 deletions.
26 changes: 26 additions & 0 deletions .cspell/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
reactjs
backbonejs
Laravel
codepen
gitdir
gutil
sinθ
cosθ
sinα
cosα
sinβ
cosβ
fanzeyi
pgsql
jsfiddle
AUTOCAD
Autoloads
allowtransparency
kwframeid
frontmatter
noignore
jsnext
stackoverflow
Symfony
autoload
PQRS
23 changes: 23 additions & 0 deletions .cspell/names.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Saurabh
Mukherjea
Vivek
Kumar
Bansal
Monika
Halan
Kiyosaki
Fosslien
Maggiulli
Marico
HDFC
IBAS
Technik
Abramov
Ashkenas
Otwell
Devloper
iamdevloper
Regulex
Bamford
INSEAD
vkbansal
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

89 changes: 0 additions & 89 deletions .eslintrc.cjs

This file was deleted.

10 changes: 9 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ jobs:
- name: Setup
uses: vkbansal/pnpm-setup-action@main
- name: Type Check
run: pnpm run typecheck
run: pnpm run check
spellcheck:
name: SpellCheck
runs-on: ubuntu-latest
steps:
- name: Setup
uses: vkbansal/pnpm-setup-action@main
- name: Spell Check
run: pnpm run spell
prettier:
name: Prettier
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ temp/
.hashes.json
.certificates
.astro
.vercel
8 changes: 3 additions & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint
pnpm typecheck
pnpm fmtc
pnpm check
pnpm fmt:c
pnpm spell
7 changes: 4 additions & 3 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-disable @cspell/spellchecker */
import { type RehypePlugin } from '@astrojs/markdown-remark';
import type { ThemeRegistration } from 'shiki';
import { transformerTwoslash } from '@shikijs/twoslash';
import { transformerNotationDiff, transformerNotationHighlight } from '@shikijs/transformers';
import { transformerTwoslash } from '@shikijs/twoslash';
import { defineConfig } from 'astro/config';
import rehypeExternalLinks from 'rehype-external-links';
import rehypeAttrs from 'rehype-attr';
import rehypeExternalLinks from 'rehype-external-links';
import type { ThemeRegistration } from 'shiki';

import { imagesPlugin } from './tools/images-plugin';
import shikiTheme from './tools/vscode-themes/noctis/minimus.json';
Expand Down
18 changes: 18 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dictionaries:
- node
- typescript
- html
- css
- latex
- bash
- npm
- person-names
- code
dictionaryDefinitions:
- name: person-names
path: './.cspell/names.txt'
- name: code
path: './.cspell/code.txt'
ignoreRegExpList:
- >-
src=".*"
122 changes: 122 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import fs from 'node:fs';

import cspellESLintPluginRecommended from '@cspell/eslint-plugin/recommended';
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginAstro from 'eslint-plugin-astro';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tsESLint from 'typescript-eslint';

const dirs = fs
.readdirSync('./src', { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

export default tsESLint.config(
eslint.configs.recommended,
...tsESLint.configs.recommended,
eslintConfigPrettier,
cspellESLintPluginRecommended,
...eslintPluginAstro.configs.recommended,
{
rules: {
'@cspell/spellchecker': [
'error',
{
configFile: new URL(
'./cspell.config.yaml',
import.meta.url,
).toString(),
checkScope: [
['ImportDeclaration[moduleSpecifier] StringLiteral', true],
],
},
],
},
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
'no-console': 2,
'no-unused-vars': 0,
'@typescript-eslint/no-unused-expressions': 0,
'@typescript-eslint/no-unused-vars': [
2,
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/explicit-function-return-type': [
2,
{
allowExpressions: true,
allowHigherOrderFunctions: true,
},
],
'@typescript-eslint/consistent-type-imports': [
2,
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/naming-convention': [
2,
{
selector: ['interface', 'typeAlias'],
format: ['StrictPascalCase'],
},
],
},
},
{
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
'simple-import-sort/imports': [
2,
{
groups: [
// Side effect imports.
['^\\u0000'],
// Node.js builtins prefixed with `node:`.
['^node:', '^astro:'],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
['^'],

// Custom imports.
dirs.map((dir) => `^${dir}`),
// Relative imports.
// Anything that starts with a dot.
['^\\.'],
// style files
['\\.css$', '\\.scss$'],
],
},
],
'simple-import-sort/exports': 'error',
},
},
{
files: ['src/env.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
);
47 changes: 27 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,47 @@
"prepare": "husky install",
"lint": "eslint 'src/**/*.{ts,tsx,astro}'",
"fmt": "prettier --plugin-search-dir=. --write 'src/**/*.{ts,tsx,astro}'",
"fmtc": "prettier --plugin-search-dir=. --check 'src/**/*.{ts,tsx,astro}'",
"typecheck": "astro check && tsc --noEmit",
"fmt:c": "prettier --plugin-search-dir=. --check 'src/**/*.{ts,tsx,astro}'",
"check": "astro check && tsc --noEmit",
"spell": "cspell 'src/**/*.md'",
"dev": "astro dev",
"start": "astro dev",
"prebuild": "rm -rf public",
"build": "NODE_ENV=production astro build"
},
"dependencies": {
"@astrojs/markdown-remark": "^5.1.0",
"@shikijs/transformers": "^1.6.4",
"@shikijs/twoslash": "^1.6.4",
"astro": "^4.10.2",
"@astrojs/markdown-remark": "^6.0.1",
"@shikijs/transformers": "^1.24.3",
"@shikijs/twoslash": "^1.24.3",
"astro": "^5.1.1",
"change-case": "^5.4.4",
"dayjs": "^1.11.11",
"dayjs": "^1.11.13",
"html-entities": "^2.5.2",
"normalize.css": "^8.0.1",
"reading-time": "^1.5.0",
"rehype-attr": "^3.0.3",
"rehype-external-links": "^3.0.0",
"sass": "^1.77.5",
"sharp": "^0.33.4",
"shiki": "^1.6.4",
"typescript": "^5.4.5"
"sass": "^1.83.0",
"sharp": "^0.33.5",
"shiki": "^1.24.3",
"typescript": "^5.7.2"
},
"devDependencies": {
"@astrojs/check": "^0.7.0",
"@types/node": "^20.14.2",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"eslint": "^8.57.0",
"@astrojs/check": "^0.9.4",
"@cspell/eslint-plugin": "^8.17.1",
"@eslint/js": "^9.17.0",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"cspell": "^8.17.1",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-astro": "^1.2.2",
"husky": "^9.0.11",
"prettier": "^3.3.2",
"prettier-plugin-astro": "^0.14.0"
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^15.14.0",
"husky": "^9.1.7",
"prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1",
"typescript-eslint": "^8.18.1"
}
}
Loading

0 comments on commit b14c217

Please sign in to comment.