@ctrl/oxlint-config
A shareable oxlint for my projects.
Getting Started
pnpm add -D oxlint @ctrl/oxlint-config prettier @trivago/prettier-plugin-sort-imports
Usage
In your project's .oxlintrc.json
file, add the following:
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"env": {
"node": true
},
"plugins": ["react", "unicorn", "typescript", "oxc", "import"],
"extends": ["@ctrl/oxlint-config"]
}
Add a prettier config to your package.json
:
{
"prettier": {
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"semi": true,
"printWidth": 100,
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": [
"^node:.*$",
"^react",
"^(@ctrl)(/.*|$)",
"^\\.\\./(?!.*\\.css$)",
"^\\./(?!.*\\.css$)(?=.*/)",
"^\\./(?!.*\\.css$)(?!.*/)"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": false
}
}
Current Import Order Rules
^node:.*$
- Node.js built-in modules^react
- React imports^(@ctrl)(/.*|$)
- @ctrl packages^@?\\w
- Other third-party packages^\\.\\./(?!.*\\.css$)
- Relative imports from parent folders^\\./(?!.*\\.css$)(?=.*/)
- Relative imports from subfolders^\\./(?!.*\\.css$)(?!.*/)
- Relative imports from same folder
Note: CSS files (.css
extensions) are excluded from all relative import patterns and maintain their original positions