@averay/codeformat
A very opinionated collection of configurations for a number of code formatting tools.
Default Usage
-
Install the package with
npm 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
npx codeformat check
, or apply automatic fixes withnpx 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)