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

eslint-config-hyoban

v2.2.11

Published

Hyoban's ESLint Config

Downloads

2,979

Readme

eslint-config-hyoban

npm version npm downloads License

Hyoban's ESLint Config, enable most of the recommended rules for js, ts, and react.

| Basic | Style | React | Others | | ----------------- | ---------------- | ------------- | ---------------------- | | js ✅ | stylistic ✅ | react ✅ | Tailwind CSS | | ts ✅ | antfu ✅ | hooks ✅ | UnoCSS | | unicorn ✅ | import-sort ✅ | refresh ✅ | flat-gitignore ✅ | | import-x ✅ | jsonc ✅ | jsx-nesting | config-inspector ✅ | | unused-import | yml | jsx-a11y | @antfu/eslint-config | | n | perfectionist | next | eslint-types | | compat | format | | command ✅ | | package-json ✅ | | | eslint-typegen ✅ |

Usage

ni -D eslint eslint-config-hyoban

eslint.config.js or eslint.config.mjs

// @ts-check
import hyoban from "eslint-config-hyoban";

export default hyoban();

[!WARNING] If your ESLint version is less than 8.57.0, you have to use eslint.config.js.

module.exports = (async () => (await import("./eslint.config.mjs")).default)();

[!TIP] If you find that saving files in the editor is a bit laggy, try turning off rules that require type checking while in the editor.

// @ts-check
import hyoban from "eslint-config-hyoban";

const isInEditor = !!(
  (process.env.VSCODE_PID ||
    process.env.VSCODE_CWD ||
    process.env.JETBRAINS_IDE ||
    process.env.VIM) &&
  !process.env.CI
);

export default hyoban({
  typeChecked: isInEditor ? false : "essential",
});

scripts in package.json

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

[!WARNING] If your ESLint version is less than 9.0.0, you have to use eslint . instead of eslint.

If you need Prettier

{
  "scripts": {
    "lint": "prettier --list-different . && eslint",
    "lint:fix": "prettier --list-different --write . && eslint --fix"
  }
}

[!TIP] You can use prettier-config-hyoban for Prettier to avoid conflicts.

.vscode/settings.json for VSCode.

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },

  // You may don't need this in the future
  "eslint.experimental.useFlatConfig": true,
  "eslint.probe": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "json"
  ],

  // If you need Prettier
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true
}

.zed/settings.json for Zed, read more at Zed's documentation and related PR.

{
  "formatter": {
    "code_actions": {
      "source.fixAll.eslint": true
    }
  }
}

Auto fix for Pull Request

name: Format

on:
  pull_request:
    branches:
      - main

jobs:
  format-code:
    runs-on: ubuntu-latest

    permissions:
      # Give the default GITHUB_TOKEN write permission to commit and push the
      # added or changed files to the repository.
      contents: write

    steps:
      - uses: actions/checkout@v4

      - name: Set node
        uses: actions/setup-node@v4
        with:
          node-version: lts/*

      - name: Install pnpm
        uses: pnpm/action-setup@v3
        with:
          run_install: |
            - args: [--frozen-lockfile]

      - name: Lint
        run: pnpm run lint:fix

      # Commit all changed files back to the repository
      - uses: stefanzweifel/git-auto-commit-action@v5