Mantine oxc config

oxc-config-mantine is a set of oxlint (linter) and oxfmt (formatter) configurations used in Mantine projects. Use it to follow the same code style and conventions as Mantine.

Installation

Install oxc-config-mantine together with oxlint and oxfmt:

yarn add --dev oxlint oxfmt oxc-config-mantine

oxlint configuration

Create an oxlint.config.ts file in the root of your project and extend the shared configuration:

import { defineConfig } from 'oxlint';
import { oxlint } from 'oxc-config-mantine';

export default defineConfig({
  extends: [oxlint],
  ignorePatterns: ['**/*.{mjs,cjs,js,d.ts,d.mts}'],
});

oxfmt configuration

Create an oxfmt.config.ts file in the root of your project:

import { defineConfig } from 'oxfmt';
import { oxfmt } from 'oxc-config-mantine';

export default defineConfig(oxfmt);

To customize the formatter, spread the base configuration and add your settings, for example, extra ignore patterns:

import { defineConfig } from 'oxfmt';
import { oxfmt } from 'oxc-config-mantine';

export default defineConfig({
  ...oxfmt,
  ignorePatterns: [...oxfmt.ignorePatterns, 'dist'],
});

Running oxlint and oxfmt

Add scripts to your package.json to lint and format the code:

{
  "scripts": {
    "lint": "oxlint",
    "format": "oxfmt --write \"**/*.{ts,tsx,css}\""
  }
}

Then run them with your package manager:

npm run lint
npm run format

Rules and source code

Mantine oxlint config extends the recommended oxlint rules and adds rules for the react, typescript, jsx-a11y and jest plugins. The full list of rules is in the oxc-config-mantine repository.