@archpublicwebsite/eslint-config
v1.0.9
Published
Reusable ESLint flat config and git-hook toolkit for Archipelago projects
Maintainers
Readme
eslint-config
Reusable ESLint + Git hooks toolkit for Nuxt/Vue projects.
Publish
cd packages/eslint-config
pnpm version patch
npm publish --access publicQuick checks before publish:
- Ensure
.npmrcpoints to public npm registry. - Run
npm pack --dry-runand verify onlyeslint.config.mjs,tools/, andREADME.mdare included.
Install
pnpm add -Dw eslint-configRequired dependencies (consumer project)
This toolkit expects these dev dependencies to exist in the project that installs it:
pnpm add -D lint-staged prettier turbolint-stagedis used by the generatedpre-commithook.prettieris used by thelint:fixflow.turbois used by the requiredlint:check/lint:fixscripts.
On install, this package automatically sets up in your project root:
.hooks/pre-commit.hooks/prepare-commit-msg.hooks/commit-msg.hooks/post-commiteslint.config.mjs(if not present).prettierrcplugin entry forprettier-plugin-tailwindcss.vscode/settings.json– ESLint flat-config settings so VS Code reads the config.vscode/extensions.json– recommended extensions (ESLint, Prettier, Volar)git config core.hooksPath .hooks(when in a git repo)
VS Code integration
On install, .vscode/settings.json is created or merged with these settings:
{
"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
}If .vscode/settings.json already exists, your existing settings are preserved — only the ESLint-related keys are added or updated.
You can also re-run it manually:
node node_modules/@archpublicwebsite/eslint-config/tools/setup/install.mjsWhat this package provides
eslint.config.mjsbuilder viacreateArchipelagoConfig- Reusable git hook handlers in
tools/git-hooks/pre-commit.mjsprepare-commit-msg.mjscommit-msg.mjspost-commit.mjsgenerate-commit-message.mjsverify-commit-message.mjstools/setup/install.mjsautomatic project bootstrap
ESLint usage
Auto-generated eslint.config.mjs uses this package directly:
import { createArchipelagoConfig } from 'eslint-config'
export default createArchipelagoConfig()Override rules
You can override any rule in your root eslint.config.mjs:
import { createArchipelagoConfig } from 'eslint-config'
export default createArchipelagoConfig({
name: 'project/overrides',
rules: {
'no-console': 'off',
'vue/max-attributes-per-line': 'off',
},
})Manual setup (optional)
Automatic setup is the default. If needed, you can still run setup manually:
node node_modules/eslint-config/tools/setup/install.mjsHook wrappers reference
Root .hooks scripts should delegate to installed package path:
.hooks/pre-commit
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/eslint-config/tools/git-hooks/pre-commit.mjs.hooks/prepare-commit-msg
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/eslint-config/tools/git-hooks/prepare-commit-msg.mjs "$@".hooks/commit-msg
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/eslint-config/tools/git-hooks/commit-msg.mjs "$1".hooks/post-commit
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
node node_modules/eslint-config/tools/git-hooks/post-commit.mjsRequired root scripts
{
"scripts": {
"lint": "pnpm lint:fix",
"lint:check": "turbo run lint",
"lint:fix": "((pnpm format || true) && turbo run lint --continue=always -- --fix) || true"
},
"lint-staged": {
"*.{js,ts,tsx,vue}": ["eslint --fix"]
}
}