A very opinionated collection of configurations for a number of code formatting tools.
-
Install the package with
bun i -D @averay/codeformat
-
Symlink the static configuration files to the project root:
ln -s node_modules/@averay/codeformat/.editorconfig node_modules/@averay/codeformat/.prettierrc.json ./
-
Import and call the relevant configuration builders for specific tools
-
Lint the codebase with
bun x codeformat check
, or apply automatic fixes withbun x codeformat fix
Create an eslint.config.js
file with the following configuration:
// eslint.config.js
import { makeEslintConfig } from '@averay/codeformat';
export default [
{
ignores: ['dist/**/*'],
},
...makeEslintConfig({ tsconfigPath: './tsconfig.json' }),
// Custom overrides can be added here
];
Create a stylelint.config.js
file with the following configuration:
// stylelint.config.js
import { makeStylelintConfig } from '@averay/codeformat';
export default makeStylelintConfig();
Create a knip.config.js
with
// knip.config.js
import { makeStylelintConfig } from '@averay/codeformat';
export default makeStylelintConfig();
Create a .php-cs-fixer.php
file with the following configuration:
<?php
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/node_modules/@averay/codeformat/src/php/PhpCsFixerConfig.php';
$finder = (new PhpCsFixer\Finder())->in([__DIR__]);
return PhpCsFixerConfig::default($finder);