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

@fontoxml/eslint-config

v4.1.1

Published

Fonto's opiniated ESLint base configuration.

Downloads

230

Readme

@fontoxml/eslint-config

Opiniated ESLint (and Prettier) configuration used by Fonto.

Installation

Install this package in your project as a development dependency:

npm install --save-dev @fontoxml/eslint-config

A handful of additional (development) dependencies are required for this configuration to work. Make sure to at least install:

This suffices for linting (most) JavaScript (.js).

If you like to use this configuration to lint React/JSX (.jsx), also install the following:

And for TypeScript (.ts and .tsx):

Usage

Simply extend @fontoxml in your ESLint configuration. The following is an example .eslintrc.js file which extends this configuration:

module.exports = {
	extends: ['@fontoxml'],
	root: true,
};

This will configure all rules except those requiring additional configuration (see below), and requires all peer dependencies to be installed, including the optional ones. The configuration relies on file extensions to determine which additional rules and plugins to run. For React/JSX the .jsx file extension is assumed and for TypeScript it's both .ts and .tsx.

Advanced usage

It's also possible to pick and choose specific parts of the configuration. The following example .eslintrc.js file includes all parts in their intended order:

module.exports = {
	extends: [
		'@fontoxml/eslint-config/base',
		'@fontoxml/eslint-config/react',
		'@fontoxml/eslint-config/typescript',
		'@fontoxml/eslint-config/typeinfo', // ⚠️ Requires configuration, see below.
	],
	root: true,
};

It's recommended to always include the base configuration, as the other parts are configured to extend it. Extending the parts in a different order might cause issues.

Linting with type information

Some TypeScript ESLint rules rely on the availability of type information, and require additional configuration to work properly. These rules are disabled by default, and can be enabled by extending the typeinfo part of the configuration. The following example .eslintrc.js file demonstrates this setup:

module.exports = {
	extends: ['@fontoxml', '@fontoxml/eslint-config/typeinfo'],
	parserOptions: {
		project: '<PATH_TO_TSCONFIG>',
	},
	root: true,
};

Please note that configuring the parserOptions.project option is required for this setup. Please refer to TypeScript ESLint parser's documentation for guidance on configuring it.

Prettier

Prettier is configured for code formatting, and runs as an autofixable ESLint rule. If you like to use the same Prettier configuration for file types not in scope of this configuration (e.g. HTML, Markdown), you can import it directly from this package. The following is an example .prettierrc.js file in which the configuration is used as-is:

module.exports = require('@fontoxml/eslint-config/prettier');

Extending and/or overriding configuration

Please refer to ESLint's configuration guide and its guide for extending configuration to extend and/or override rules defined by this configuration. Also note that in addition to the rules, some of the included plugins have settings that may need to be adjusted for your project.