This repository is a robust template for working with SQL files, primarily oriented towards PostgreSQL. It comes equipped with tools for code formatting and linting, spell checking, a ready-to-use devcontainer, custom VS Code settings, essential repository files, automated releasing, and extensive documentation to support effective project management and customization.
- Devcontainer: Provides an Ubuntu-based environment with Python and Node support, custom VS Code settings and extensions, and a local PostgreSQL service.
- Formatting: Ensures a consistent code style using Prettier, EditorConfig, markdownlint, and SQLFluff for SQL files.
- Spell Checking: Automatically highlights spelling errors.
- Pre-commit Hooks: Automates quality checks before each commit.
- Release Automation: Manages releases automatically.
- Dependency Updates Automation: Keeps dependencies up-to-date via Dependabot.
This setup is designed for GitHub Codespaces. Running locally has not been tested and may require additional configuration.
Most formatting tasks are automated and enforced using various tools.
Feel free to adjust these settings for your project.
The repository configurations are described in the [STYLEGUIDE.md
][STYLEGUIDE].
-
SQL Files: The project uses SQLFluff for SQL file formatting. SQLFluff automatically formats SQL files in the editor when the following settings are enabled (already configured in the devcontainer):
editor.formatOnPaste
: trueeditor.formatOnSave
: truefiles.autoSave
: onFocusChange
To check your SQL code, run:
npm run sqlfluff:check
To fix fixable issues, run:
npm run sqlfluff:write
-
Prettier-supported Files: Use Prettier to format all other files supported by Prettier.
To apply formatting to your code, run:
npm run format:write
For a formatting check without modifying files, run:
npm run format:check
To run spell checking, execute:
npm run spell:check
Adjust the cspell.json
configuration file if needed.
Contributions are welcome! Please read the Contributing Guidelines and check the Issues page.
This project is licensed under the MIT License.
For questions, reach out via evgenii.shiliaev@jekwwer.com or open an issue.
This document is based on a template by Evgenii Shiliaev, licensed under CC BY 4.0. All additional content is licensed under LICENSE.