@switz/eslint-config
v13.0.0
Published
``` $ yarn add -D eslint @switz/eslint-config # or $ pnpm install -D eslint @switz/eslint-config ```
Downloads
1,333
Readme
switz's eslint-config
Installation
$ yarn add -D eslint @switz/eslint-config
# or
$ pnpm install -D eslint @switz/eslint-configUpdate your eslint config (eslint.config.mjs)
import main from '@switz/eslint-config';
export default [...main];If you need React support, use
import main from '@switz/eslint-config';
import react from '@switz/eslint-config/react.mjs';
export default [...main, ...react];If you need mdx support, use
import main from '@switz/eslint-config';
import mdx from '@switz/eslint-config/mdx.mjs';
export default [...main, ...mdx];If you need tailwind support, use:
import main from '@switz/eslint-config/main.mjs';
import react from '@switz/eslint-config/react.mjs';
import tailwind from '@switz/eslint-config/tailwind.mjs';
export default [...main, ...react, ...tailwind];You should be able to combine configs just by spreading more into the array.
Oxlint + Oxfmt (Alternative)
This package also ships oxlint and oxfmt configs as a faster alternative to ESLint + Prettier.
Setup
Install oxlint and oxfmt, then reference the configs:
pnpm install -D oxlint oxfmtCreate an oxlint.json in your project root that extends the base config:
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
"extends": ["@switz/eslint-config/oxlint"]
}For React, add the react config:
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
"extends": [
"@switz/eslint-config/oxlint",
"@switz/eslint-config/oxlint/react"
]
}For Tailwind, add the tailwind config:
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
"extends": [
"@switz/eslint-config/oxlint",
"@switz/eslint-config/oxlint/react",
"@switz/eslint-config/oxlint/tailwind"
]
}Then run:
oxlint -c oxlint.jsonFormatting — copy .oxfmtrc.json to your project root:
cp node_modules/@switz/eslint-config/.oxfmtrc.json .oxfmtrc.json
oxfmt .Add scripts to your package.json:
{
"scripts": {
"lint:ox": "oxlint -c oxlint.json",
"fmt:ox": "oxfmt ."
}
}Gaps vs ESLint configs
- React: oxlint covers ~20 of 80+
eslint-plugin-reactrules. Core rules likejsx-key,no-direct-mutation-state, hooks rules, andjsx-no-duplicate-propsare covered. Rules likeno-unstable-nested-components,no-array-index-key,jsx-handler-namesare not. - MDX: oxfmt formats
.mdxfiles, but does not lint embedded code blocks likeeslint-plugin-mdxdoes. - TypeScript type-aware rules: oxlint's type-aware checking is in alpha (~73% coverage of
typescript-eslintrecommended rules).
Reference
https://eslint.org/docs/developer-guide/shareable-configs
License
MIT, have fun
