Package Exports
- @archpublicwebsite/eslint-config
- @archpublicwebsite/eslint-config/tools/git-hooks/commit-msg.mjs
- @archpublicwebsite/eslint-config/tools/git-hooks/generate-commit-message.mjs
- @archpublicwebsite/eslint-config/tools/git-hooks/post-commit.mjs
- @archpublicwebsite/eslint-config/tools/git-hooks/pre-commit.mjs
- @archpublicwebsite/eslint-config/tools/git-hooks/pre-push.mjs
- @archpublicwebsite/eslint-config/tools/git-hooks/prepare-commit-msg.mjs
- @archpublicwebsite/eslint-config/tools/git-hooks/shared.mjs
- @archpublicwebsite/eslint-config/tools/git-hooks/verify-commit-message.mjs
- @archpublicwebsite/eslint-config/tools/security/patterns.mjs
- @archpublicwebsite/eslint-config/tools/security/risks.mjs
- @archpublicwebsite/eslint-config/tools/security/safe-reinstall.sh
- @archpublicwebsite/eslint-config/tools/security/scan-global.sh
- @archpublicwebsite/eslint-config/tools/security/scan.mjs
- @archpublicwebsite/eslint-config/tools/security/scanner.mjs
- @archpublicwebsite/eslint-config/tools/security/test-patterns.mjs
- @archpublicwebsite/eslint-config/tools/setup/install.mjs
- @archpublicwebsite/eslint-config/tools/setup/vscode.mjs
Readme
@archpublicwebsite/eslint-config
Reusable ESLint flat config and git-hook toolkit for Archipelago projects.
What this package includes
This package ships a ready-to-use flat config plus setup scripts for local project automation:
createArchipelagoConfig()for building an ESLint flat config- Git hook scripts for pre-commit and commit-message enforcement
- Setup automation that bootstraps the consumer project
- VS Code settings updates for the recommended linting workflow
Features
- Flat config based on
@antfu/eslint-config - Vue, TypeScript, Tailwind, and Nuxt-friendly defaults
- Git hooks for consistent formatting and commit validation
- Prettier remains available for editor guidance, but the global
format/prettierbridge is disabled to avoid flat-config parser conflicts - Automatic project setup on install
- Works with the Archipelago repo style rules
Requirements
Consumer projects should have these tools available when using the full setup:
pnpm add -D eslint prettier lint-staged turboInstallation
pnpm add -D @archpublicwebsite/eslint-configUsage
Create or update the root eslint.config.mjs:
import { createArchipelagoConfig } from '@archpublicwebsite/eslint-config'
export default createArchipelagoConfig()Override rules when your project needs to diverge from the shared defaults:
import { createArchipelagoConfig } from '@archpublicwebsite/eslint-config'
export default createArchipelagoConfig({
name: 'project/overrides',
rules: {
'no-console': 'off',
'vue/max-attributes-per-line': 'off',
},
})What the setup does
On install or when you run the setup script manually, the package prepares the consumer project with:
.hooks/pre-commit.hooks/prepare-commit-msg.hooks/commit-msg.hooks/post-commitsafe-reinstall.sh(supports--check-onlyfor pre-commit safety checks)scan-global.sh(global IOC scanner)eslint.config.mjswhen one does not already exist.prettierrcplugin entry forprettier-plugin-tailwindcss.vscode/settings.jsonwith ESLint flat-config settings.vscode/extensions.jsonwith recommended extensionsgit config core.hooksPath .hookswhen the project is a Git repository
VS Code integration
The setup merges ESLint-related settings into .vscode/settings.json:
{
"eslint.useFlatConfig": true,
"eslint.validate": [
"javascript", "javascriptreact",
"typescript", "typescriptreact",
"vue", "json", "jsonc", "markdown"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"editor.formatOnSave": true
}Existing settings are preserved. Only the ESLint-related keys are added or updated.
Public API
The package exports:
createArchipelagoConfig- setup scripts under
tools/
AI Implementation Guide
If you are extending or regenerating this package, keep the workflow explicit:
- Update
eslint.config.mjswhen shared lint rules change. - Update
tools/setup/install.mjswhen install-time bootstrap behavior changes. - Update
tools/git-hooks/when hook behavior changes. - Keep the package export map aligned with the public API.
- Document any new consumer dependency that the setup expects.
AI-friendly implementation notes
- Use
createArchipelagoConfig()in the consumer project, not the internal setup scripts. - Keep root scripts in sync with the hook and lint expectations.
- Re-run the package setup flow when changing VS Code or hook behavior.
- Prefer explicit examples that show what the consumer project should add.
Manual setup
If you need to rerun the bootstrap manually:
node node_modules/@archpublicwebsite/eslint-config/tools/setup/install.mjsHook wrappers reference
Root .hooks scripts should delegate to the installed package path:
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/@archpublicwebsite/eslint-config/tools/git-hooks/pre-commit.mjs#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/@archpublicwebsite/eslint-config/tools/git-hooks/prepare-commit-msg.mjs "$@"#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/@archpublicwebsite/eslint-config/tools/git-hooks/commit-msg.mjs "$1"#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/@archpublicwebsite/eslint-config/tools/git-hooks/post-commit.mjsPublish
cd packages/eslint-config
pnpm version patch
npm publish --access publicBefore publish, run:
npm pack --dry-runMake sure the tarball contains only the intended public files: eslint.config.mjs, tools/, and README.md.
Required root scripts
{
"scripts": {
"lint": "pnpm lint:fix",
"lint:check": "turbo run lint",
"lint:fix": "((pnpm format || true) && turbo run lint --continue=always -- --fix) || true",
"precommit": "node node_modules/@archpublicwebsite/eslint-config/tools/git-hooks/pre-commit.mjs",
"security:global-scan": "bash ./node_modules/@archpublicwebsite/eslint-config/tools/security/scan-global.sh",
"security:safe-check": "bash ./node_modules/@archpublicwebsite/eslint-config/tools/security/safe-reinstall.sh --check-only"
},
"lint-staged": {
"*.{js,ts,tsx,vue}": ["eslint --fix"]
}
}Pre-commit now runs in this order:
node tools/security/scan.mjsbash ./safe-reinstall.sh --check-only(if present)bash ./scan-global.sh(if present)pnpm lint-staged
If you need to skip the global machine scan in CI or emergency situations, set:
SKIP_GLOBAL_SCAN=1Verification
After making config changes, validate the package by checking the installed consumer workflow or by running the setup script in a test project.
License
MIT