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

@runespoorstack/eslint-config

v1.1.5

Published

Battle tested, ready for production set of Runespoor ESlint configs.

Downloads

159

Readme

Table of Contents

✨ Features

  • Provides a full, battle tested, ready for production set of Runespoor ESlint configs.
  • Well managed system of separated core and mixins configs:
    • core/base-js
    • core/base-ts
    • core/react-js
    • core/react-ts
    • mixins/prettier
    • mixins/tailwind
    • mixins/jest
    • mixins/vitest
  • Out of the box no-restricted-imports rules that will save your time on dealing with bundle size.
  • The configs are created over the best eslint plugin and configs:
    • eslint-config-airbnb-base
    • eslint-config-airbnb
    • @typescript-eslint/parser
    • @typescript-eslint/eslint-plugin
    • eslint-plugin-prettier
    • eslint-config-prettier
    • eslint-plugin-jest
    • eslint-plugin-jest-formatting
    • eslint-plugin-import
    • eslint-plugin-simple-import-sort
    • eslint-import-resolver-custom-alias
    • eslint-plugin-jsx-a11y
    • eslint-plugin-react
    • eslint-plugin-react-hooks
    • eslint-plugin-storybook
    • eslint-plugin-tailwindcss
    • eslint-plugin-testing-library
    • eslint-plugin-vitest

🦾 Installation

npm i --save-dev @runespoorstack/eslint-config @rushstack/eslint-config@latest eslint@latest prettier@latest typescript@latest 

♾️ Usage

Create .eslintrc.cjs in the root of the project.

Choose the core config

Use a native JavaScript base config:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  "extends": ["@runespoorstack/eslint-config/core/base-js"]
}

Use a TypeScript base config:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  "extends": ["@runespoorstack/eslint-config/core/base-ts"]
}

Use a native React base config:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  ignorePatterns: ['!.storybook'],
  "extends": ["@runespoorstack/eslint-config/core/react-js"]
}

Use a TypesScript React base config:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  ignorePatterns: ['!.storybook'],
  "extends": ["@runespoorstack/eslint-config/core/react-ts"]
}

Choose a mixins

Use a Prettier mixin:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  ignorePatterns: ['!.storybook'],
  "extends": [
    "@runespoorstack/eslint-config/core/react-js", 
    "@runespoorstack/eslint-config/mixins/prettier"
  ]
}

Use a Tailwind mixin:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  ignorePatterns: ['!.storybook'],
  "extends": [
    "@runespoorstack/eslint-config/core/react-ts", 
    "@runespoorstack/eslint-config/mixins/prettier", 
    "@runespoorstack/eslint-config/mixins/tailwind"
  ]
}

Use a Jest mixin:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  ignorePatterns: ['!.storybook'],
  "extends": [
    "@runespoorstack/eslint-config/core/react-js", 
    "@runespoorstack/eslint-config/mixins/prettier", 
    "@runespoorstack/eslint-config/mixins/tailwind", 
  ],
   overrides: [
    {
       files: ['**/*.@(spec|test).[tj]s?(x)'], // or any other pattern
      extends: [
        '@runespoorstack/eslint-config/mixins/jest'
      ]
    }
  ]
}

Use a Vitest mixin:

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  ignorePatterns: ['!.storybook'],
  "extends": [
    "@runespoorstack/eslint-config/core/react-js", 
    "@runespoorstack/eslint-config/mixins/prettier", 
    "@runespoorstack/eslint-config/mixins/tailwind", 
  ],
   overrides: [
    {
      files: ['**/*.@(spec|test).[tj]s?(x)'], // or any other pattern
      extends: [
        '@runespoorstack/eslint-config/mixins/vitest'
      ]
    }
  ]
}

Add your own rules

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  ignorePatterns: ['!.storybook'],
  "extends": [
    "@runespoorstack/eslint-config/core/react-js", 
    "plugin:@tanstack/eslint-plugin-query/recommended"
  ]
}

⚠️ no-restricted-imports overrides

Be careful with adding your own no-restricted-imports rules! We use a set of predefined restriction rules to protect you from serious mistakes out of the box:

  • Use default imports from lodash/*. - to save your bundle size.
  • Use custom 'render', 'renderHook' methods. - to cover the 80% usage of these methods (you commonly use only the custom once).
  • Please use default @mui/icons-material/* import instead. - to save your bundle size.
  • Use default imports from @mui/material/<Component> - to save your bundle size. = MUI: Do not use the third level imports - to save your bundle size.

If you define your own no-restricted-imports, all the predefined once would be cleared. So in case of adding new rules or overriding only the separate rule, you should copy and paste the full no-restricted-imports rule definition from our source code.

⚠️ Linting .storybook folder

Make sure you have remove .storybook from ignore patterns to be able to lint this folder. By default eslint ignore all the .* files.

Use ignorePatterns: ['!.storybook'],

Run eslint

Run eslint check:

eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs --quiet

Run eslint autofix:

eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs --fix

🛠️ Contributing

See the CONTRIBUTING.md document.

💕 Special Thanks

  • I want to say thank you to the best woman in the world, my wife Diana for her love, daily support, motivation and inspiration.

❤️ Support or Donate

If you are enjoying this work and feel extra appreciative, you could buy me a book 📖 or 3 📖📖📖.