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

@murshidazher/eslint-config-react

v1.0.5

Published

eslint-react configuration for javascript projects based on airbnb and prettier configs

Downloads

4

Readme

@murshidazher/eslint-config-react npm

build: github workflow code style: prettier

An opinionated eslint configuration to make linting a 🌬️. Accepting PRs

  • ESLint configuration for React Project.
  • Easy to install and configure, ant it follows the best code standards from airbnb.
  • Integrated with @murshidazher/prettier-config configuration for code formatting.

Table of Contents

Purpose

This configuration uses airbnb and Prettier configuration plus some extra rules that we find handy for React applications.

For more information you can check eslint and prettier documentations as well the airbnb and prettier configurations for more information.

This package integrates the Prettier rules with ESLint using our configuration. You can check it at @murshidazher/prettier-configuration

Installation

You need ESLint and Prettier installed as development dependencies on your project. You can install them by using either npm or yarn.

Option 1: NPM

If you use npm as the package manager,

npm install -D eslint prettier

Install all peer dependencies of our configuration, these can be listed by the command:

npm info "@murshidazher/eslint-config-react@latest" peerDependencies

If running npm > v5 you install them by:

npx install-peerdeps --dev @murshidazher/eslint-config-react

If npm < v5, Linux/OSX users can run:

(
  export PKG=@murshidazher/eslint-config-react;
  npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)

Option 2: YARN

If you use yarn as the package manager,

yarn add eslint prettier -D

Install the peer dependencies tool, by running:

yarn global add install-peerdeps

and after that run the following command to install the project's config:

install-peerdeps @murshidazher/eslint-config-react

How to use

To configure add the following to your package.json file,


"eslintConfig": {
  "extends": "@murshidazher/react",
},
"prettier": "@murshidazher/prettier-config"

Extending

This configuration is not intended to be changed, but if you have a setup where modification is required, it is possible. Prettier does not offer an "extends" mechanism as you might be familiar from tools such as ESLint.

To extend a configuration you will need to create a .eslintrc.js and .prettierrc.js or prettier.config.js files:

//.eslintrc
{
  "root": true,
  "extends": "@murshidazher/react"
  // more configuration options goes here!
}

// .prettierrc.js
module.exports = {
    ...require('@murshidazher/prettier-config'),
    semi: false
    // more configuration options goes here!
};

Finally, you can add this scripts to your package.json file,

"lint": "eslint ./ --ignore-path .gitignore",
"lint:fix": "npm run lint -- --fix",
"format": "prettier --write \"{,!(node_modules)/**/}*.js\""

Commit Hook

If you need to add a pre-commit hook for linting,

npm install -D husky lint-staged
// package.json
"lint-staged": {
  "*.{js,css,html}": [
    "yarn run lint:fix",
    "yarn run format",
    "git add"
  ]
},

Contributors

contributors

Contributing

How to contribute to this open source library

License

Copyright © 2020-2021 Murshid Azher. This library is licensed under the MIT.