npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@heinzelman-labs/eslint-config-react

v2.0.0

Published

Heinzelman React ESLint configuration based on eslint-config-airbnb

Downloads

29

Readme

@heinzelman-labs/eslint-config-react

npm version total downloads monthly downloads license

A personal ESLint shareable config for React projects based on eslint-config-airbnb.

References

This config ...

Source code of this package can be found on ...

Installation

yarn

yarn add -D @heinzelman-labs/eslint-config-react

npm

npm i -D @heinzelman-labs/eslint-config-react

Usage

Basic .eslintrc.js

module.exports = {
    extends: [
        '@heinzelman-labs/eslint-config-react'
    ],
    rules: {
        // Adjust rules ...
    },
    env: {
        // Environments as needed ...
    }
};

Mono-Repo .eslintrc.js

For mono-repos don't forget to add your package directories.

const { resolve } = require('path');

module.exports = {
    // ...
    rules: {
        'import/no-extraneous-dependencies': ['error', { 
            packageDir: [
                __dirname,
                resolve(__dirname, 'packages/foo'),
                resolve(__dirname, 'packages/bar')
            ]
        }]
    },
    // ...
};

CLI

I would recommend to not use glob patterns or filenames, but to use directories to specify target files where possible. Then use the --ext option to define relevant file extensions. You may also use .eslintignore to exclude files from the result set as needed. This way ESLint will not complain if you end up not having a certain file type among your sources anymore, e.g. .mjs.

eslint ./src --ext .js,.mjs,.jsx

Base Rule Optimizations

  'no-unused-vars': ['error', { 
+     varsIgnorePattern: '^React$',
      vars: 'all', 
      args: 'none', 
      ignoreRestSiblings: true 
  }],

Diff eslint-config-airbnb

Note that unlike with eslint-config-airbnb, the rules for React hooks are integrated by default.

React

- 'react/jsx-indent-props': ['error', 2],
+ 'react/jsx-indent-props': ['error', 4],

- 'react/jsx-indent': ['error', 2],
+ 'react/jsx-indent': ['error', 4],
  
- 'react/jsx-filename-extension': ['error', { extensions: ['.jsx'] }],
+ 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.tsx']}],
  
- 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
+ 'react/jsx-one-expression-per-line': 'off',
  
- 'react/jsx-fragments': ['error', 'syntax'],
+ 'react/jsx-fragments': 'off',
  
  'react/jsx-props-no-spreading': ['error', {
-     html: 'enforce',
+     html: 'ignore',
-     custom: 'enforce',
+     custom: 'ignore',
      exceptions: [],
  }]
  
- 'react/function-component-definition': ['error', {
-     namedComponents: ['function-declaration', 'function-expression'],
-     unnamedComponents: 'function-expression',
- }],
+ 'react/function-component-definition': 'off'

React a11y

No changes.

React Hooks

No changes.

License

MIT License