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-standard-typescript-prettier

v6.0.0

Published

A simple eslint config for modern TypeScript projects.

Downloads

4,991

Readme

Eslint config: StandardJS, Typescript, Prettier

A simple eslint config for modern TypeScript projects.

This package configures eslint with:

  • Typescript support https://github.com/typescript-eslint/typescript-eslint
  • StandardJs rules https://github.com/standard/eslint-config-standard
  • Prettier rules https://github.com/prettier/eslint-plugin-prettier
  • @typescript-eslint/recommended rules https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
  • Requires semicolons (from prettier) for consistancy with types
  • Disables some opinionated type check rules

For reference: ./eslint.js.



1. Install

Note: For an even "easier" install option, see eslint-config-nfour

yarn add -D eslint-config-standard-typescript-prettier

1.1 Install Peer Dependencies

Install all the peer dependencies listed in this projects package.json into your project.

This should do the trick:

npx install-peerdeps -o --dev --yarn eslint-config-standard-typescript-prettier

2. Configure

Add this to your package.json:

"eslintConfig": {
  "extends": ["standard-typescript-prettier"],
  "parserOptions": { "project": "./tsconfig.json" }
},
"prettier": "eslint-config-standard-typescript-prettier/prettier"

For other config recipes, see I want fine grained control

3. Bonus configure

Add the comment below to get type checks on your rules in a .eslintrc.js

/** @ts-check @type import('eslint-config-standard-typescript-prettier/types').TsEslintConfig */

FAQ

I want fine grained control

The packages exports a plain object, go nuts!

In an .eslintrc.js:

const config = require('eslint-config-standard-typescript-prettier');

module.exports = {
  ...config,
  parserOptions: { project: "./tsconfig.json" },
  rules: {
    ...config.rules,
    "@typescript-eslint/no-explicit-any": "error",
  },
};

Eslint might be changing their config, which is why a .eslintrc.js format is recommended.

More info: https://github.com/eslint/rfcs/pull/9

In a .prettierrc.js:

module.exports = {
  ...require('eslint-config-standard-typescript-prettier/prettier'),
  semi: false, // This is how you turn off semicolons, by the way
}

Eslint cant find my files

On the CLI, eslint requires the --ext flag (currently):

eslint --ext .ts,.tsx .

I want linting to appear as warnings, not errors

By default, lint errors can become mixed with TypeScript errors during development.

eslint-plugin-only-warn is already included in this package, so do this:

{
  "plugins": ["only-warn"],
  "extends": ["standard-typescript-prettier"],
  "parserOptions": { "project": "./tsconfig.json" }
}

Want your lint warnings turned into errors?

yarn eslint --max-warnings 1

Project future

Javascript churn is real. This project will be kept up to date only for as long as configuration remains tedious.

Potential issues

The peerDependencies listed are versioned for compatibility. Because you maintain these dependencies in your project, you'll have to keep them all in sync or you could have issues.