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-webp-stencil-prettier-husky

v1.0.38

Published

ESLint + Prettier + StencilJS

Downloads

10

Readme

ESLint + Prettier + Husky Config for Stencil

Config for ESLint and Prettier, aimed to be used in Stencil projects, tested with vscode.

Overview

This configuration is using Airbnb ESLint config and Prettier integration via the ESLint plugin. Additionally, a few default rules are overriden to provide a more relaxed development experience in Stencil.js applications out of the box.

Install the package (and RTFM ⬇️!):

$ npm install -D eslint-config-webp-stencil-prettier-husky

This will install the shared config files into the node_modules folder. But we have to do some more steps to get it working.

Prerequisites

Since we want to manage the configuration in a central location in our multi-repos, we have to copy some files in the project directory. (symlinks doesn't work -> bamboo build will fail). Unfortunately, this does not work with PNPM and a postinstall script within this repo (package.json > scripts.postinstall) and problems with Bamboo builds (missing symlinks), but this is not tragic, because we need this only at the first use.

For the very first setup, run the following command to setup the config files:

# shell
$ npm pkg set 'scripts.install:config'='node ./node_modules/eslint-config-webp-stencil-prettier-husky/lib/generateLinks'

Alternative, add this line to your scripts in the package.json:

// package.json
{
  "scripts": {
    "install:config": "node ./node_modules/eslint-config-webp-stencil-prettier-husky/lib/generateLinks"
  }
}

And run:

$ npm run install:config

The node script is copying all the config files now. pnpm can be regularly used. Symlinks would be nicer, but Bamboo builds will fail.

Script for deployment

// package.json
{
  "scripts": {
    "build": "export NODE_ENV=production && npm run lint &&  stencil build --docs",
  }
}

Usage

To start using this shared config in vscode, add eslint-config-webp-stencil-prettier-husky (or just webp-stencil-prettier-husky) to your package.json:

// package.json
{
  "eslintConfig": {
    "extends": ["webp-stencil-prettier-husky"]
  }
}

Prettier

This config supports Prettier integration out of the box. Rules that may conflict with ESLint are disabled via recommended configuration in eslint-plugin-prettier.

Husky

The hooks should be installed automatically. Otherwise, run:

# shell
npx husky install
npx husky-init && npm i
npx husky set ./.husky/pre-commit "npm run lint"

Further reading for git tower users: Getting Started with Git Hooks and Husky

# If you want to use NVM:
# https://github.com/typicode/husky/issues/390#issuecomment-545855628
touch ~/.huskyrc

# ~/.huskyrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Known issues / things to improve / side notes

  • Dont change the compilerOptions.lib and .target in your ./tsconfig.json to es2022. This will break the stencil component(s).

  • If linting does not work after installation, simply restart vscode.

  • If you want to use pnpm instead of npm, run the following command after installation: npm i && rm -rf node_modules && rm package-lock.json && pnpm i

  • Update local linting settings in vscode, after a new version of this package is released: npm run install:config

  • 2do: Better handling with symlinks and bamboo builds

License

Licensed under MIT License.

NPM updates

  1. Add a new version number to package.json, otherwise you will get an 403 error
  2. Commit changes
  3. run npm publish