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

v1.9.1

Published

ESLint config for ToC TypeScript based projects

Downloads

431

Readme

🚦 eslint-config-toc

This package allows us to make decisions on code styling for all TypeScript based projects developed by or for Tired of Cancer B.V.

  1. Useable in any TS project (react, react-native, next.js etc).
  2. Extends proven conventions (airbnb config, unicorn plugin etc).
  3. Allows for opiniated deviations (added consistency or sensible overrides).

Contents

⚙️ Usage

This library requires node 16+.

  1. yarn add -D eslint eslint-config-toc.
  2. Add the following to your package.json:
"prettier": "eslint-config-toc/.prettierrc",
"resolutions": {
  "eslint-plugin-react-native": "4.0.0"
}
  1. Setup your linting config in .eslintrc.js:
// This enables ESLint to use dependencies of this config
// (see https://github.com/eslint/eslint/issues/3458)
require('eslint-config-toc/setup-plugins')

module.exports = {
  // Uncomment only ONE (the most applicable) config for your project and remove the others
  // extends: ['toc/typescript'],
  // extends: ['toc/react'],
  // extends: ['toc/nexstjs'],
  // extends: ['toc/react-native'],
}
  1. Set up your TypeScript config in tsconfig.json. If your project was generated with a tsconfig file, make sure to remove all specific rules to prevent conflicts:
{
  // Uncomment only ONE (the most applicable) config for your project and remove the others
  // "extends": "eslint-config-toc/tsconfig-typescript.json",
  // "extends": "eslint-config-toc/tsconfig-react.json",
  // "extends": "eslint-config-toc/tsconfig-nextjs.json",
  // "extends": "eslint-config-toc/tsconfig-react-native.json",
}
  1. Happy linting! 🎉

📣 Proposing changes

When proposing a change to this shared configuration, keep in mind that it will impact all ToC projects and developers. First ask yourself these questions:

  1. Does the change improve consistency, security and/or stability of our codestyle?
  2. Will the change benefit all projects and developers?
  3. Is the effort worth the gain? For example, if the change cannot be auto-fixed by prettier it may cause a lot of refactor work.

If all of these questions can be answered with a strong 'YES', go ahead with a proposal for change:

  1. Research the change and the impact on our existing projects.
  2. Create a PR to this repository containing:
    • The change, added to the appropriate config (for example, React Native specific deviation rules should be added to react-native.js).
    • A comment right above the change(s) in the config files that explains in short why we are using that deviation.
    • If applicable; the changes required to keep the files in this repository valid (test with yarn lint and yarn prettier).
  3. In the PR body, describe the following:
    • What is the reason for this change.
    • What will the impact be on existing projects.
    • How can the changes be (temporarily) ignored. Add a code snippet.
  4. Add an appropriate label to the PR. These are used in our changelog automation:
  • bug for solving bugs in this library or it's ci configuration.
  • documentation for updating the instructions in the README or clarifying comments with existing deviations.
  • dependencies for updating existing dependencies. These are usually done automatically by Renovate.
  • feature for proposing a new rule deviation or adding a new dependency.
  • breaking for any of the above changes when it also will cause breaking changes in any project depending on this library.

☝️ For an example PR, see #1.

When the PR is ready for review, request reviews from the rest of the team. Discussion should happen in the PR comments as much as possible to ensure future developers can see why certain decissions were made in the past.

When more than half of the rest of the team agrees with the proposed changes, the PR can be merged.

🚀 Versioning and releasing

When a PR is merged, the release notes for the next draft release are automatically prepared. Based on the added labels, the version number in the release title and package.json may be automatically updated as well.

When we are ready to publish a new version to NPM, all we need to do is publish the draft release:

  1. Go to the releases overview.
  2. Check if the last change has been added (the Github action workflow needs to complete after merging the most recent PR).
  3. Edit the existing draft release. If there is no draft release, there were no changes since the last release.
  4. Press Publish release.
  5. Presto! A new Github release and tag have been made. A workflow will automatically publish this version to NPM.

🦸 Acknowledgements

The configured ruleset is based on airbnb's eslint config. Check their documentation on the reasoning behind all the rules that are not specifically configured as deviations in this repository.

The setup of this configuration project was inspired by eslint-config-molindo and eslint-config-ns.