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

@promoboxx/eslint-config

v3.4.1

Published

JS Code styles for Promoboxx. Contrary to the name, it contains more than just eslint (eslint forces a naming convention).

Downloads

117

Readme

@promoboxx/eslint-config

JS Code styles for Promoboxx. Contrary to the name, it contains more than just eslint (eslint forces a naming convention).

Installation

yarn add --dev eslint prettier @promoboxx/eslint-config

Now add this to your .eslintrc.js:

module.exports = {
  extends: [
    // Base config applies to all projects.
    '@promoboxx/eslint-config',
    // If the project uses prettier:
    '@promoboxx/eslint-config/prettier',
    // If the project uses jest:
    // '@promoboxx/eslint-config/jest',
    // If the project uses react:
    // '@promoboxx/eslint-config/react',
    // If the project uses graphql:
    // '@promoboxx/eslint-config/graphql',
  ],
  parserOptions: {
    // If the project has a graphql config file you may end up with multiple
    // sources of truth for your graphql schema/documents. Either uncomment
    // this line, OR add this to your graphql config:
    //
    //     documents: './src/**/*.{graphql,js,ts,jsx,tsx}'
    // skipGraphQLConfig: true,

    // If the project uses graphql, set the path/url to your schema below.
    // Alternatively, you can set this in your graphql config file.
    // schema: 'node_modules/@promoboxx/graphql-server-types/graphql.schema.json',
  },
}

And this to your prettier.config.js:

module.exports = require('@promoboxx/eslint-config/prettier.config')

Usage

Normal usage would be adding support for prettier and eslint to your editor, running them after every save.

VS Code

Install the Prettier and eslint extensions.

Add this to your settings:

  // Formatting
  "editor.formatOnSave": true,

  // Prettier
  "prettier.requireConfig": true,

  // Set default formatter to prettier for languages.
  // Note: Expect this to grow as more languages are supported.
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[markdown]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[yaml]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[graphql]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

  // ESLint
  "eslint.format.enable": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "graphql"
  ],
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },

Atom

Install the Prettier and eslint extensions.

In the settings for Prettier, make sure these match:

  • [x] Format Files on save
  • [x] Only format if a Prettier config is found

In the settings for eslint, make sure these match:

  • [x] Fix errors on save

Vim / Neovim

ale supports both prettier and eslint.

Other Editors / Manual

Run these commands after a file is saved:

./node_modules/.bin/eslint --fix "$FILE"
./node_modules/.bin/prettier --write "$FILE"

Notes

There are multiple ways of getting eslint and Prettier working in harmony, and most of them involve using eslint to run Prettier. They work, but Prettier handles much more than just JavaScript, so it's best to use the two tools together, while disabling all eslint rules that Prettier takes care of.