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

@ecohead/configs

v2.2.0

Published

A collection of opinionated configuration files for my personal projects

Downloads

12

Readme

Configurations

This repository contains opinionated configurations for some tooling of the javascript ecosystem.

ESLint

To use the minimal configuration, create or update the eslint.config.js file in your project with the following content:

import { defineConfig } from '@ecohead/configs/eslint';

export default defineConfig({
	// Your additional configuration here
});

The defineConfig function also accepts as a second argument an array of files to be ignored by eslint in your project.

Built-in configurations

I provide some built-in configurations that you can use directly in your project, based on my personal preferences. I have disabled some rules that I find too strict or not useful for my use case. You are free to use them all or only some of them.

If you want to include all of them, I export a special variable that contains all the configurations.

import { defineConfig, all } from '@ecohead/configs/eslint';

export default defineConfig([...all]);

@eslint/js

import { defineConfig, native } from '@ecohead/configs/eslint';

export default defineConfig([...native]);

typescript-eslint

import { defineConfig, typescript } from '@ecohead/configs/eslint';

export default defineConfig([...typescript]);

eslint-plugin-unicorn

import { defineConfig, unicorn } from '@ecohead/configs/eslint';

export default defineConfig([...unicorn]);

eslint-plugin-sonarjs

import { defineConfig, sonar } from '@ecohead/configs/eslint';

export default defineConfig([...sonar]);

@eslint-community/eslint-plugin-eslint-comments

import { defineConfig, comments } from '@ecohead/configs/eslint';

export default defineConfig([...comments]);

eslint-plugin-n

import { defineConfig, node } from '@ecohead/configs/eslint';

export default defineConfig([...node]);

eslint-config-prettier

import { defineConfig, prettier } from '@ecohead/configs/eslint';

export default defineConfig([...prettier]);

eslint-plugin-no-use-extend-native

import { defineConfig, noUseExtendNative } from '@ecohead/configs/eslint';

export default defineConfig([...noUseExtendNative]);

eslint-plugin-promise

import { defineConfig, promise } from '@ecohead/configs/eslint';

export default defineConfig([...promise]);

eslint-plugin-import-x

import { defineConfig, importX } from '@ecohead/configs/eslint';

export default defineConfig([...importX]);

eslint-plugin-tailwindcss

import { defineConfig, tailwindcss } from '@ecohead/configs/eslint';

export default defineConfig([...tailwindcss]);

@adonisjs/eslint-plugin

import { defineConfig, adonis } from '@ecohead/configs/eslint';

export default defineConfig([...adonis]);

@unocss/eslint-config

import { defineConfig, unocss } from '@ecohead/configs/eslint';

export default defineConfig([...unocss]);

Prettier

The configuration is based mainly for accessibility and readability purposes, which for some part is inherited from this reddit post.

Usage

To use the configuration, you can add the following to your prettier.config.js file:

import { definePrettierConfig } from '@ecohead/configs/prettier';

export default definePrettierConfig({
	// Your additional configuration here
});

Built-in plugins

prettier-plugin-packagejson

Plugin documentation

This plugin formats the package.json file in a more readable way, using sort-package-json under the hood.

Add any prettier plugin

To add a plugin in your configuration, simply add it to the plugins array in the definedPrettierConfig function after installing it.

The following example shows how to add the prettier-plugin-tailwindcss plugin:

import { definePrettierConfig } from '@ecohead/configs/prettier';

export default definePrettierConfig({
	// Your additional configuration here
	plugins: [
		// ...
		'prettier-plugin-tailwindcss',
	],
	tailwindFunctions: ['clsx', 'cx', 'cva', 'cw', 'twMerge', 'tw'],
});

Stylelint

I export two configurations :

  • One for CSS files
  • One for SCSS files

The SCSS configuration is based on the CSS configuration, with some additional rules for SCSS files.

Usage

To use the configuration, you can add the following to your stylelint.config.js file:

import { css, scss } from '@ecohead/configs/stylelint';

/** @type {import('stylelint').Config} */
export default {
	...css, // or ...scss
	// Your additional configuration here
};

Typescript

The TypeScript configuration is as strict as possible from my point of view. It is inherited in high parts from the astro team's configuration.

I also export a special tsconfig file dedicated to eslint, which enables the noEmit flag.

Usage

To use the configuration, you can add the following to your tsconfig.json file:

For the default configuration:

{
	"extends": "@ecohead/configs/tsconfig.json",
	"compilerOptions": {
		// Your additional configuration here
	}
}

For the eslint configuration:

{
	"extends": "@ecohead/configs/tsconfig.eslint.json",
	"compilerOptions": {
		// Your additional configuration here
	}
}