diff --git a/.changeset/wicked-turkeys-swim.md b/.changeset/wicked-turkeys-swim.md new file mode 100644 index 0000000..30a3107 --- /dev/null +++ b/.changeset/wicked-turkeys-swim.md @@ -0,0 +1,5 @@ +--- +"swd-eslint-config": patch +--- + +add react button rule, update readme diff --git a/README.md b/README.md index af15304..11930cd 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,34 @@ This is a custom eslint config for my projects. It uses the latest flat config v import tseslint from "typescript-eslint"; export default tseslint.config( + { + languageOptions: { + parserOptions: { + // Important for typed linting + parser: tseslint.parser, + tsconfigRootDir: import.meta.dirname, + project: ["./tsconfig.json"], + }, + }, + }, ...swdEslintPlugin.configs.base, // if using React: ...swdEslintPlugin.configs.react ); + ``` + + or the flat config with classic syntax: - // or the flat config with classic syntax: + ```ts export default tseslint.config({ + languageOptions: { + parserOptions: { + // Important for typed linting + parser: tseslint.parser, + tsconfigRootDir: import.meta.dirname, + project: ["./tsconfig.json"], + }, + }, extends: [ ...swdEslintPlugin.configs.base, // if using React: @@ -44,14 +65,18 @@ This is a custom eslint config for my projects. It uses the latest flat config v }; ``` -``` - -- 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) -``` +### 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) + +### Commands + +- `pnpm build` - Builds the package +- `pnpm release` - Creates a new release, should be used before committing +- `pnpm release:publish` - Publishes the release, shouldn't be used manually diff --git a/src/flat-react.ts b/src/flat-react.ts index 6e3147b..e77fb19 100644 --- a/src/flat-react.ts +++ b/src/flat-react.ts @@ -35,6 +35,7 @@ export const react = tseslint.config( rules: { "react/prop-types": "off", "react/display-name": "warn", + "react/button-has-type": "warn", "tailwindcss/no-custom-classname": [ "warn", {