Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ bun.lock
*/build/*

# IntelliJ
.idea
.idea
.eslintcache
tsconfig.tsbuildinfo
16 changes: 15 additions & 1 deletion .husky/pre-push
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
pnpm typecheck --minimumFailingSeverity warning
if git diff --cached --name-only | grep -q '\.astro$'; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git diff --cached won't actually do anything, that checks differences between staged and latest commit, but for a pre-push hook everything will have already been committed

echo "Running full astro check"
astro check --minimumFailingSeverity warning
else
if [ -n "${DEBUG}" ]; then
echo "Using TypeScript version: $(tsc --version) at $(which tsc)"
start=$(date +%s%N)
tsc --noEmit
end=$(date +%s%N)
echo "TypeScript time (approx): $(((end - start)/1000000))ms"
else
echo "Running TypeScript check"
tsc --noEmit
fi
fi
31 changes: 17 additions & 14 deletions .remarkrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ export default {
remarkPresetLintRecommended,
remarkNoInlineCodeFences,
remarkNoHtmlLinks,
[
remarkLintNoDeadUrls,
{
skipLocalhost: false,
skipOffline: true,
skipUrlPatterns: [
'https://github.com/signup',
'https://code.visualstudio.com/',
'https://www.conventionalcommits.org/en/v1.0.0/',
'https://vale.sh/',
'https://squoosh.app/',
], // Add known flaky URL patterns here
},
],
// only run dead link checker in CI to save time in dev
process.env.CI
? [
remarkLintNoDeadUrls,
{
skipLocalhost: false,
skipOffline: true,
skipUrlPatterns: [
'https://github.com/signup',
'https://code.visualstudio.com/',
'https://www.conventionalcommits.org/en/v1.0.0/',
'https://vale.sh/',
'https://squoosh.app/',
], // Add known flaky URL patterns here
},
]
: () => undefined,
],
};
7 changes: 1 addition & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import js from '@eslint/js';
import astro from 'eslint-plugin-astro';
import globals from 'globals';
import process from 'node:process';
import tseslint from 'typescript-eslint';

import { defineConfig } from 'eslint/config';
Expand All @@ -21,8 +20,7 @@ export default defineConfig([
{ argsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'error',
// ci runs `astro check` which runs a full typescript checker
'no-undef': process.env.CI ? 'off' : 'error',
'no-undef': 'off',
},
},
{
Expand All @@ -42,8 +40,5 @@ export default defineConfig([
ImageMetadata: 'readonly',
},
},
rules: {
'no-undef': 'off',
},
},
]);
21 changes: 20 additions & 1 deletion lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
const runPrettierOn =
'**/*.{' +
Comment thread
samfreund marked this conversation as resolved.
[
'js',
'mjs',
'ts',
'json',
'json5',
'jsonc',
'css',
'md',
'mdx',
'yaml',
'yml',
'astro',
].join(',') +
'}';

/** @type {import('lint-staged').Configuration} */
export default {
'**/*': (files) => `prettier --write --ignore-unknown ${files.join(' ')}`,
[runPrettierOn]: (files) =>
`prettier --write --ignore-unknown ${files.join(' ')}`,
'**/*.{astro,ts,mjs,js}': (files) => `eslint --fix ${files.join(' ')}`,
'src/content/**/*.{md,mdx}': (files) => [
`pnpm remark ${files.join(' ')} --ext mdx --frail --no-stdout --quiet`,
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"prebuild": "tsx scripts/generate-glossary.ts",
"predev": "tsx scripts/generate-glossary.ts",
"lint": "pnpm lint:eslint && pnpm lint:md && pnpm lint:regions && pnpm lint:glossary && pnpm typecheck && pnpm vale",
"lint:eslint": "eslint .",
"lint:eslint": "eslint \"src/**/*.{ts,astro,js,mjs,css}\" \"*.mjs\" --cache",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should lint scripts/ as well

"lint:md": "remark src/content/docs --ext mdx --frail",
"lint:regions": "tsx scripts/validate-regions.ts",
"vale": "pnpm vale:setup && vale sync && vale src/content",
Expand All @@ -40,12 +40,13 @@
"@eslint/js": "^10.0.1",
"@types/estree": "^1.0.9",
"@types/mdast": "^4.0.4",
"@types/node": "^26.1.2",
"astro-eslint-parser": "^1.4.0",
"eslint": "^10.5.0",
"eslint-plugin-astro": "^1.7.0",
"mdast-util-mdx": "^3.0.0",
"husky": "^9.1.7",
"lint-staged": "^17.0.8",
"mdast-util-mdx": "^3.0.0",
"mdast-util-mdx-jsx": "^3.2.0",
"mdx2vast": "^0.3.1",
"prettier": "^3.8.4",
Expand All @@ -61,6 +62,7 @@
"tsx": "^4.22.4",
"typescript": "^6.0.3",
"typescript-eslint": "^8.61.1",
"vfile": "^6.0.3"
"vfile": "^6.0.3",
"typescript-7": "npm:typescript@^7.0.2"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remind me why ts 7 is being added?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

speed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For tsc yes? I don't think ts 7 is actually being used with tsc, upon local checking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we don't need to typecheck astro files, ts7 is ~6x faster (on my machine)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For tsc yes? I don't think ts 7 is actually being used with tsc, upon local checking.

Works on my machine, maybe PATH issues? If you have a global typescript@6 that might be the issue.

}
}
Loading
Loading