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

@carimus/eslint-config-react-native

v1.0.1

Published

A base eslint config for Carimus React Native projects

Downloads

6

Readme

Carimus ESLint Config for React Native

The eslint config used by Carimus React Native projects.

Usage

Follow this setup on a fresh React Native project created with react-native init in order to:

  • Configure eslint to use this config
  • Install and configure Prettier
  • Run eslint and prettier on precommit

Delete the existing eslint and prettier config files created by react-native init:

rm .eslintrc.js .prettierrc.js

Remove the built-in React Native eslint config package:

yarn remove @react-native-community/eslint-config

Install eslint, the required eslint plugins, this package, prettier, the Carimus prettier config, husky (allows for custom precommit hooks specified in package.json), and lint-staged (allows to run eslint/prettier only on the file staged for commit during the precommit hook) as dev dependencies:

yarn add --dev eslint \
    eslint-plugin-babel \
    eslint-plugin-import \
    eslint-plugin-jest \
    eslint-plugin-node \
    eslint-plugin-promise \
    eslint-plugin-react \
    eslint-plugin-react-hooks \
    eslint-plugin-react-native \
    eslint-plugin-standard \
    @carimus/eslint-config-react-native \
    prettier \
    @carmius/prettier-config \
    husky \
    lint-staged

Create an .eslintrc.json file containing:

{
    "root": true,
    "extends": ["@carimus/eslint-config-react-native"]
}

Create a .prettierrc.json file containing (yes literally just a string):

"@carimus/prettier-config"

Merge the following into your package.json in order to add some custom scripts, the husky config, and the prettier config:

{
    "scripts": {
        "lint:raw": "eslint '{*,{src,docs,scripts,storybook}/{**/,}*,__{tests,mocks}__/{**/,}*}.{js,jsx}'",
        "lint": "yarn run lint:raw || true",
        "pretty": "prettier --write '{*,{src,docs,scripts,storybook}/{**/,}/*,__{tests,mocks}__/{**/,}*}.{js,jsx,json,md,yml,html}'",
        "fixcode": "yarn run lint:raw --fix; yarn run pretty"
    },
    "husky": {
        "hooks": {
            "pre-commit": "lint-staged"
        }
    },
    "lint-staged": {
        "{*,{src,docs,scripts,storybook}/{**/,}*,__{tests,mocks}__/{**/,}*}.{js,jsx}": [
            "eslint --fix",
            "prettier --write",
            "eslint",
            "git add"
        ],
        "{*,{src,docs,scripts,storybook}/{**/,}*,__{tests,mocks}__/{**/,}*}.{json,md,yml,html}": [
            "prettier --write",
            "git add"
        ]
    }
}

You may need to update the 4 glob patterns there to account for any custom directories, etc. used in the project. These globs should work for standard react-native projects.

The scripts added are:

  • lint will just check the entire codebase and report back
  • pretty will prettier-ify the entire codebase but not do any linting
  • fixcode will prettier-ify the entire codebase and fix any fixable linting errors as well

Commit the config changes, run fixcode to sync up the codebase with the new code style, and then commit that as well:

git add -A
git diff --staged
git commit -m 'chore(*): configure eslint and prettier for Carimus style' --no-verify
yarn run fixcode
git commit -m 'style(*): reformat codebase according to Carimus style'

Related Projects