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

@liveryvideo/biome-lit

v1.0.3

Published

Shared Biome with ESLint configuration for use in Livery projects using TypeScript and Lit custom elements.

Downloads

38

Readme

biome-lit

Shared Biome with ESLint configuration for use in Livery projects using TypeScript and Lit custom elements.

This uses Biome for most linting and formatting, see biome.jsonc for details.

And ESLint for additional linting, see eslint.config.js for details.

Installation

Install the dependencies:

npm install -D @biomejs/biome eslint @liveryvideo/biome-lit

Create biome.jsonc with: (you can add project specific overrides below)

{
  "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
  "extends": ["@liveryvideo/biome-lit/biome"]
}

Create eslint.config.js with:

import configs from '@liveryvideo/biome-lit/eslint';

export default configs;

Add scripts to package.json with:

{
  "scripts": {
    "lint": "biome check && eslint && tsc",
    "lint:fix": "biome check --fix && eslint --fix"
  }
}

Usage

To check formatting and linting rules and possibly exit with errors:

npm run lint

To automatically fix errors and possibly exit with remaining errors:

npm run lint:fix

Conventions

This assumes the following conventional files/directories:

  • .editorconfig - Should be supported by Biome, but for now we manually specify indentStyle: space
  • .gitignore - Is supported by Biome, but not by ESLint, there we manually specify ignores: dist/, ext/, node_modules/
  • index.html - SDK test or App page
  • index.ts - SDK exports or App code
  • livery-*.ts - SDK test or App element(s)
  • package.json - NPM package config
  • dist/ - Bundled files for distribution
  • ext/ - Any external (third party) source files, only formatted (not linted) by biome; to be imported from TypeScript source files
  • src/**/*.ts - Source files processed through biome, eslint, typescript and server/bundler (e.g: vite)
  • test/**/*.ts - Unit test files (e.g: vitest) with names matching the source modules they test and .test.ts extension
  • tsconfig.json - TypeScript config

Summary

Based on the conventions above this will:

  • Indent using 2 spaces and use single quotes for formatting
  • index.*, livery-*.ts, src/**/*.ts, test/**/*.ts are formatted by Biome and strictly linted using all rules but for a few
  • All other supported files (e.g: config, scripts) but those matching .gitignore are formatted by Biome
  • All supported files but dist/, ext/, node_modules/ are linted by ESLint using rules from plugins: lit, perfectionist, tsdoc and wc

Additional installation

VS Code

Install extensions: Biome and ESLint.

And in settings.json specify:

{
  "editor.codeActionsOnSave": {
    "quickfix.biome": "explicit",
    "source.organizeImports.biome": "explicit",
    "source.fixAll.eslint": "explicit"
  },
  "editor.defaultFormatter": "biomejs.biome",
  "editor.formatOnSave": true,
}

Git pre-commit

To check and, where possible, auto fix errors while committing:

Install dependencies:

npm install -D husky lint-staged

Create .husky/pre-commit with:

npx lint-staged -r

Add lint-stage config to package.json:

{
  "lint-staged": {
    "*": ["biome check --fix --no-errors-on-unmatched", "eslint --fix"]
  }
}

CI

Add a step to your test jobs, e.g:

npm ci
npm run lint
npm test

CI Error

If CI results in: Error: Cannot find module '@biomejs/cli-linux-x64/biome' then on your machine:

rm -rf node_modules package-lock.json
npm install

And commit and push to try again.

See: https://github.com/npm/cli/issues/4828