0.2.0 • Published 5 months ago

@averay/codeformat v0.2.0

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

@averay/codeformat

A very opinionated collection of configurations for a number of code formatting tools.

Default Usage

  1. Install the package with bun i -D @averay/codeformat

  2. Symlink the static configuration files to the project root:

    ln -s node_modules/@averay/codeformat/.editorconfig node_modules/@averay/codeformat/.prettierrc.json ./
  3. Import and call the relevant configuration builders for specific tools

  4. Lint the codebase with bun x codeformat check, or apply automatic fixes with bun x codeformat fix

ESLint

Create an eslint.config.js file and create the configuration:

// eslint.config.js
import { makeEslintConfig } from '@averay/codeformat';

export default [
  {
    ignores: ['dist/**/*'],
  },
  ...makeEslintConfig({ tsconfigPath: './tsconfig.json' }),
  // Custom overrides can be added here
];

Stylelint

Create a stylelint.config.cjs file and create the configuration:

// stylelint.config.cjs
const { makeStylelintConfig } = require('@averay/codeformat');

module.exports = makeStylelintConfig();

(Stylelint does not currently support ESM so a .cjs file with CommonJS import & export syntax must be used)