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

@wildix/eslint-config-style-guide

v1.2.3

Published

ESLint and Prettier Config

Downloads

1,279

Readme

The Wildix Code Style Guide

Eslint / Prettier Setup for @wildix 📦

This repository contains ESLint and Prettier configurations tailored for projects at Wildix. Utilize these settings to ensure code consistency and adherence to the latest standards endorsed by the Wildix development team.

Table of Contents

What it does

  • Lints JavaScript / TypeScript based on the latest standards accepted by Wildix development team
  • Multiple configs available: react, hooks, native, and more
  • Shared tsconfig.json

Installation

All configurations are bundled in the package @wildix/eslint-config-style-guide. Follow the steps below:

# If you are using yarn
yarn add --dev @wildix/eslint-config-style-guide

# If you are using npm
npm i --save-dev @wildix/eslint-config-style-guide

Configuring ESLint

  1. Create a .eslintrc file in your project's root directory.
  2. Extend your config with the minimal base of the Wildix Utils config:
{
  "extends": [
    "@wildix/eslint-config-style-guide"
  ]
}

Scripts

Add the following scripts to your package.json to lint and/or fix your code:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

If you are using TypeScript

Extend your tsconfig

Extend your existing tsconfig.json file with the provided TypeScript configuration:

for browser env projects

{
  "extends": "@wildix/eslint-config-style-guide/tsconfig.browser.json"
}

// for node env projects

{
  "extends": "@wildix/eslint-config-style-guide/tsconfig.json"
}

Add TypeScript ESLint config

In your .eslintrc file, add the TypeScript ESLint rules:

{
  extends: [
    '@wildix/eslint-config-style-guide',
    '@wildix/eslint-config-style-guide/typescript'
  ],
  parserOptions: {
    project: true,
    tsconfigRootDir: __dirname
  },
  root: true
}

If you want to enable imports sorting

Include import sorting based on your alias from your jsonfig.json or tsconfig.json file:

{
  extends: [
    '@wildix/eslint-config-style-guide',
    '@wildix/eslint-config-style-guide/imports'
  ]
}

If you are using React.js

For React.js development (without Next.js), add these additional rules:

{
  extends: [
    '@wildix/eslint-config-style-guide',
    '@wildix/eslint-config-style-guide/react',
    '@wildix/eslint-config-style-guide/react-hooks'
  ]
}

If you want to use Prettier

Ensure Prettier config is added at the end of your extends array:

{
  extends: [
    '@wildix/eslint-config-style-guide',
    '@wildix/eslint-config-style-guide/imports',
    '@wildix/eslint-config-style-guide/react',
    '@wildix/eslint-config-style-guide/react-hooks',
    '@wildix/eslint-config-style-guide/prettier' // ensure it's the last one
  ],
}

If you are using VS Code

After configuration, install the ESLint package. Set up VS Code settings by creating a .vscode folder in your project's root and adding a settings.json file:

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}

Husky

Installation

Install Husky as a development dependency in your project:

yarn add -D husky lint-staged

Enable Git Hooks

Run the following command to enable Git hooks:

npx husky install

To automatically enable Git hooks after install, edit your package.json:

npm pkg set scripts.prepare="husky install"

Configure a Pre-commit Hook

Create a pre-commit hook that will run when you commit. First, create a .husky directory:

mkdir .husky

Then, add a pre-commit hook using the following command:

npx husky add .husky/pre-commit 'yarn lint-staged'

Now, your pre-commit hook is configured to run lint-staged before each commit, ensuring code quality and consistency.

Adjust the commands based on your project structure and linting needs.