Skip to content

@sv/codestyle

This package includes confugration files for different tools used to enforce a consistent code style accross projects.

Installation

Make sure your project is set up with access to the registry as described in Setup.

Terminal window
pnpm add @sv/codestyle --save-exact

Usage

The .editorconfig will be copied next to your package.json using a postinstall script — if not already present.

Automatically setup the configuration in your project by running the following command for the desired tool(s):

Manual setup

Biome

For the biome configuration to work with your editior, the biome.json file needs to be in the root of the project.

biome.json
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["@sv/codestyle/biome"]
}

Prettier

We should use Biome for js formatting but Prettier is still useful for many other files and integrations.

package.json
{
"name": "your-package",
...
"prettier": "@sv/codestyle/.prettierrc.json"
}

Prettier docs.

TypeScript

tsconfig.json
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": ["@sv/codestyle/tsconfig.json"]
}

Commitlint

commitlint.config.js
module.exports = {
extends: ["@sv/codestyle/commitlint.cjs"],
};

ESLint

.eslintrc.json
{
"extends": ["@sv/codestyle/.eslintrc.json"]
}

Stylelint

stylelint.config.cjs
module.exports = {
extends: ["@sv/codestyle/stylelint.config.cjs"],
};


Included configuration files

root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.py]
indent_style = space
indent_size = 4
[*.md]
trim_trailing_whitespace = false


Changelog


1.3.0 (2024-10-23)

Features

  • update commitlint config with sane defaults

1.2.0 (2024-07-18)

Features

  • update config schema to biome 1.8.0

1.1.1 (2024-06-15)

Fixes

  • set useExponentiationOperator to warn

1.1.0 (2024-06-04)

Features

  • enable allowComments in json parser and add css formatter config

...


Full changelog