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

@jjangga0214/eslint-config

v5.1.1

Published

A sharable eslint config for javascript, typescript, and jest

Downloads

185

Readme

@jjangga0214/eslint-config

An ESlint Shareable Config for javascript, typescript, react, and jest.

This package is for ESLint's new Flat Config.

Installation

npm install --save-dev @jjangga0214/eslint-config
# or
yarn add --dev @jjangga0214/eslint-config
# or
pnpm add --save-dev @jjangga0214/eslint-config

And make sure peerDependencies are satisfied.

# This does not install them all. This just show them on terminal.
npm info "@jjangga0214/eslint-config@latest" peerDependencies

Or install them all by install-peerdeps.

# For npm
npx install-peerdeps --dev @jjangga0214/eslint-config
# For yarn
yarn dlx install-peerdeps --yarn --dev @jjangga0214/eslint-config
# For pnpm
pnpm dlx install-peerdeps --pnpm --dev @jjangga0214/eslint-config

Entrypoints

Usage

eslint.config.js:

import { ignores } from '@jjangga0214/eslint-config/helpers'
import javascript from '@jjangga0214/eslint-config/javascript'
import typescript from '@jjangga0214/eslint-config/typescript'
import jest from '@jjangga0214/eslint-config/jest'
import react from '@jjangga0214/eslint-config/react'

export default [
  { ignores, },
  // The order matters!
  ...javascript, // You MUST include this even for typescript and jsx.
  ...typescript, // Include this only if you use typescript
  ...react, // Include this only if you use react
  ...jest, // Include this only if you use jest
]

The example above is equivalent to the default export of @jjangga0214/eslint-config.

export { default } from '@jjangga0214/eslint-config'

ESM is configured by default. For CJS, use @jjangga0214/eslint-config/commonjs

import config from '@jjangga0214/eslint-config'
import commonjs from '@jjangga0214/eslint-config/commonjs'

export default [
  ...config,
  ...commonjs,
]

Entry points of /javascript, /typescript, /react, and /jest are all mainly composed of popular 3rd-party configs. At the end of them, @jjangga0214/eslint-config/personal overrides partial rules internally.

When you need other configurations at the end,

import config from '@jjangga0214/eslint-config'

export default [
  ...config,
  { /* Your another config */ }, // <-- This may override too widely
]

sometimes its range is too wide.

Then use /personal to finalize.

import config from '@jjangga0214/eslint-config'
import personal from '@jjangga0214/eslint-config/personal'

export default [
  ...config,
  { /* Your another config */ },
  ...personal,
]

tsconfig.json and @jjangga0214/eslint-config/typescript

By default, ./packages/*/tsconfig.json and/or (if not found) ./tsconfig.json are targets to search. If your tsconfig file is named/located differently (e.g. tsconfig.eslint.json), override languageOptions.parserOptions.project AND settings['import/resolver'].typescript.project from typescript config.

{
  // ...
  languageOptions:{
    // ...
    parserOptions: {
      project: ['./packages/*/tsconfig.json', './tsconfig.json',], // <-- Override it
    },
  },
  settings: {
    // ...
    'import/resolver': {
      typescript: {
        // ...
        project: [ // <-- Override this as well
          'packages/*/tsconfig.json',
          'tsconfig.json',
        ]
      },
    },
  }
}

Development Note

The config depends on other popular shareable configs. Some of them do not provide flat configs, yet. So @jjangga0214/eslint-config transforms them internally. Though more concise porting is possible, they are intentionally converted as-is for comparability.