0.1.14 • Published 1 year ago

@averay/codeformat v0.1.14

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

@averay/codeformat

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

Default Usage

  1. Install the package with npm 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 npx codeformat check, or apply automatic fixes with npx 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)