eslint-config-jimmy-guzman

An opinionated ESLint configuration that targets typescript, javascript, react, jest and testing-library

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
eslint-config-jimmy-guzman
14.1.021 days ago2 years agoMinified + gzip package size for eslint-config-jimmy-guzman in KB

Readme

eslint-config-jimmy-guzman
!actionsactions-badge !versionversion-badgepackage !downloadsdownloads-badgenpmtrends !semantic-releasesemantic-release-badgesemantic-release !code style: prettierprettier-badgeprettier !Code Coveragecoverage-badgecoverage
An opinionated ESLint configuration that targets typescript, javascript, react, jest vitest and testing-library
Usage
The current version of eslint-config-jimmy-guzman is fully supported on LTS and current versions of nodenode-lts-versions, and requires at least node v20.

Installation

pnpm add -D eslint-config-jimmy-guzman

Configuration

Add extends: ['jimmy-guzman'] to your .eslintrc to get all the rules that enforce code style, enforce best practices and prevent errors.
This package also includes rules for jest, vitest, react, typescript and testing-library that can be used such as:
| rules | configuration | notes | | --------------- | --------------------------------------------------------------------------------- | ------------------------ | | base | extends: ['jimmy-guzman'] | | | jest | extends: ['jimmy-guzman', 'jimmy-guzman/jest'] | | | vitest | extends: ['jimmy-guzman', 'jimmy-guzman/vitest'] | | | typescript | extends: ['jimmy-guzman', 'jimmy-guzman/typescript'] | here | | react | extends: ['jimmy-guzman', 'jimmy-guzman/react'] | here | | testing-library | extends: ['jimmy-guzman', 'jimmy-guzman/react', 'jimmy-guzman/testing-library'] | here |

Monorepos

The following rules don't support some monorepo setups so you might need to turned them off:
```js filename=".eslintrc.cjs" / @type {import('eslint').Linter.Config} / module.exports = { extends: 'jimmy-guzman', rules: {
'import/no-extraneous-dependencies': 'off',
'react/jsx-uses-react': 'error',
}, }
### Typescript

`jimmy-guzman/typescript` ruleset requires type information that needs further configuration:

```js filename=".eslintrc.cjs"
/** @type {import('eslint').Linter.Config} */
module.exports = {
  extends: ['jimmy-guzman', 'jimmy-guzman/typescript'],
  parserOptions: {
    project: ['./tsconfig.json'],
  },
}

You can read more about linting with type information heretyped-linting

React

jimmy-guzman/react favors React 17's new jsx transformreact-17-new-jsx-transform so a couple of rules are turned off by default. If you are not using the new jsx transform, it's recommended to add this configuration:
```js filename=".eslintrc.cjs" / @type {import('eslint').Linter.Config} / module.exports = { extends: 'jimmy-guzman', 'jimmy-guzman/react', parserOptions: {
ecmaFeatures: {
  jsx: true,
  pragma: 'React',
},
}, rules: {
'react/react-in-jsx-scope': 'error',
'react/jsx-uses-react': 'error',
}, } ```

Testing Library

jimmy-guzman/testing-library makes an assumption that a suite of Testing Library packages are being used such as @testing-library/react, @testing-library/jest-dom and @testing-library/user-event.