Skip to content

Commit

Permalink
add tailwind rule
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianwd committed Oct 26, 2024
1 parent 9c0d011 commit aa9760c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# swd-eslint-config

This is a custom eslint config for my projects. It uses the latest flat config version of eslint.

- Usage:

- Install: `pnpm add -D swd-eslint-config`
- In your `eslint.config.mjs`:

```ts
import swdEslintPlugin from "swd-eslint-config";
import tseslint from "typescript-eslint";

export default tseslint.config(
...swdEslintPlugin.configs.base,
// if using React:
...swdEslintPlugin.configs.react
);

// or the flat config with classic syntax:
export default tseslint.config({
extends: [
...swdEslintPlugin.configs.base,
// if using React:
...swdEslintPlugin.configs.react,
],
});
```

- Plugins included:
- [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
- [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
- [eslint-plugin-tailwindcss](https://github.com/tailwindlabs/eslint-plugin-tailwindcss)
- [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
- [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort)
- [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
- [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin)
7 changes: 7 additions & 0 deletions src/flat-react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export const react = tseslint.config(
rules: {
"react/prop-types": "off",
"react/display-name": "warn",
"tailwindcss/no-custom-classname": [
"warn",
{
callees: ["classnames", "clsx", "cva", "twMerge", "cn"],
ignoredKeys: ["color", "variant", "size", "defaultVariants"],
},
],
},
},
{
Expand Down

0 comments on commit aa9760c

Please sign in to comment.