swd-eslint-config
v2.3.1
Published
Custom ESLint config
Maintainers
Readme
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 eslint prettier typescript-eslint swd-eslint-config jitiIn your
eslint.config.ts:import swdEslintPlugin from 'swd-eslint-config' import { defineConfig } from 'eslint/config' export default defineConfig( ...swdEslintPlugin.configs.base, // if using React: ...swdEslintPlugin.configs.react( { framework: 'astro' } // optional ) )or the flat config with classic syntax:
export default defineConfig({ extends: [ ...swdEslintPlugin.configs.base, // if using React: ...swdEslintPlugin.configs.react( { framework: 'astro' } // optional ), ], })
Create a prettier config. Example:
prettier.config.mjs/** @type {import("prettier").Config} */ export default { endOfLine: 'lf', // consistency between windows and linux semi: false, singleQuote: true, jsxSingleQuote: true, tabWidth: 2, trailingComma: 'es5', lineWidth: 120, }
Troubleshooting
If it doesn't work, try adding this to the
.npmrcfile:auto-install-peers = true public-hoist-pattern[]=*eslint*If using Expo,
eslint-config-expouses outdated versions, so you need to add the following to yourpackage.json:"pnpm": { "overrides": { "eslint-plugin-react-hooks": "^7.0.1" } }
Plugins included:
- eslint-plugin-react
- eslint-plugin-jsx-a11y
- eslint-plugin-better-tailwindcss
- eslint-plugin-prettier
- eslint-plugin-simple-import-sort
- eslint-plugin-react-hooks
- @tanstack/eslint-plugin-query
- typescript-eslint
Commands
pnpm build- Builds the packagepnpm release- Creates a new release, should be used before committingpnpm release:publish- Publishes the release, shouldn't be used manually
