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-broadside

v1.4.0

Published

A powerful ESLint configuration for a variety of projects.

Downloads

13

Readme

eslint-config-broadside 🏴‍☠️

Ahoy, matey! Welcome aboard the most swashbuckling ESLint configuration this side of the seven seas! 🦜

What's this treasure chest all about?

eslint-config-broadside is a powerful ESLint configuration that'll make your code shine brighter than a freshly polished doubloon. It's designed to work with a variety of projects, from simple JavaScript scripts to complex TypeScript applications, using the new ESLint flat config format.

Features

  • 🦜 TypeScript support
  • 🏴‍☠️ Comprehensive rule set to catch even the sneakiest of code smells
  • 🗺️ High quality, opinionated rules to keep your codebase clean and consistent
  • 🔧 Built-in prettier configuration to make your code look shipshape
  • 🆕 First class support for the new ESLint flat config format
  • 🧩 Optional plugins for even more linting power

Installation

First, hoist the colors and run:

npm install --save-dev eslint-config-broadside eslint

Usage

Basic Configuration

Create an eslint.config.js file in your project root and import the configuration:

import { config } from "eslint-config-broadside";

export default await config();

Advanced Configuration (JavaScript Projects)

For more control over your linting rules, use the config function:

import { config } from "eslint-config-broadside";

export default (async () => {
  const baseConfig = await config({
    globals: {
      // Your global variables
    },
    parserOptions: {
      // Your custom parser options
    },
  });
  return [
    ...baseConfig,
    {
      rules: {
        // Your custom rules here
        "no-console": "warn", // Example: Warn about console.log usage
      },
    },
  ];
})();

Advanced Configuration (TypeScript Projects)

For more control over your linting rules and TypeScript support, use the tsEslintConfig function:

import { tsEslintConfig } from "eslint-config-broadside";
import tsEslint from 'typescript-eslint';

export default (async () => {
  const baseConfig = await tsEslintConfig({
    parserOptions: {
      project: './tsconfig.json', // Point to your TypeScript config
    },
    globals: {
      // Your global variables
    },
  });

  return tsEslint.config(
    ...baseConfig,
    {
      rules: {
        // Your custom rules here
        "@typescript-eslint/no-explicit-any": "error", // Example: Disallow 'any' type
      },
    }
  );
})();

Running ESLint

Once configured, run your regular ESLint commands:

npx eslint .

Configuration Options

The tsEslintConfig function accepts an options object with the following properties:

  • parserOptions: Custom parser options for TypeScript (e.g., specifying your tsconfig.json)
  • globals: Global variables to be defined for all files

Optional Plugins: Your Secret Weapons

eslint-config-broadside supports integration with several third-party ESLint plugins. These plugins are optional and provide additional linting capabilities:

  1. eslint-plugin-jsdoc: Keeps your documentation shipshape and Bristol fashion.
  2. eslint-plugin-unicorn: Adds a treasure trove of additional ESLint rules to make your code truly legendary.
  3. eslint-plugin-security: Protects your code from common security vulnerabilities, keeping your ship safe from digital pirates.

To use these plugins, you need to install them separately in your project. You can do this by running:

npm install --save-dev eslint-plugin-jsdoc eslint-plugin-unicorn eslint-plugin-security

Or for a specific plugin:

npm install --save-dev eslint-plugin-jsdoc

Once installed, eslint-config-broadside will automatically detect and configure these third-party plugins. If they're not installed, your configuration will still work, just without the additional rules these plugins provide.

For more information about these plugins, visit their respective GitHub repositories:

Troubleshooting

If ye be encountering any issues, check these common solutions:

  1. Make sure all peer dependencies are installed and up to date
  2. Check that your eslint.config.js is in the correct location
  3. Ensure your TypeScript version is compatible (we require ^5.5.4)
  4. If using optional plugins, verify they're installed correctly
  5. Double-check your configuration syntax

If ye still be having troubles, open an issue on our GitHub repository. We'll help ye navigate these treacherous waters!

Contributing

We welcome all hands on deck! Check out our CONTRIBUTING.md file to learn how to join our crew.

Code of Conduct

We run a tight ship here. Read our Code of Conduct to make sure you play nice with the other pirates.

Security

Found a leak in our hull? Don't let us sink! Check out our SECURITY.md for information on reporting vulnerabilities.

License

This treasure is protected by the GNU Affero General Public License v3.0. Share and share alike, but keep it open source, ye scurvy dogs!

Final Words

Remember, a clean codebase is like a well-maintained ship - it'll take you far and wide across the digital seas. Now hoist the mainsail, and may your code be ever bug-free and your linting errors few!

Fair winds and following seas, me hearties! 🏴‍☠️