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

@automattic/eslint-config-target-es

v2.2.0

Published

ESLint sharable config to activate eslint-plugin-es checks based on browserslist targets.

Downloads

596

Readme

eslint-config-target-es

ESLint shareable config to activate eslint-plugin-es-x checks based on browserslist browser targets and MDN browser compatibility data.

Installation

Generally you'll install this via your package manager, e.g.

npm install --save-dev eslint eslint-plugin-es-x @automattic/eslint-config-target-es

Usage

First, you'll probably want to set up a browserslist configuration.

Then you can use this like any other sharable config in your eslint.config.js or .eslintrc.* file. Three configurations are offered.

  • To check only for language features, such as nullish coalescing, use the 'language' config.
  • To check only for builtins, such as Promise, WeakRef, and various features of RegExp, use the 'builtins' config.
  • To check both, use the 'all' config.

For eslint.config.js, that might look like this:

import eslintConfigTargetEs from '@automattic/eslint-config-target-es/flat/language';

export default [
	eslintConfigTargetEs,
	// etc
];

while for eslintrc you'd do like

{
	extends: [ '@automattic/eslint-config-target-es/rc/language' ],
}

For backwards compatibility, the eslintrc configs may also be accessed without the /rc/ path component (e.g. as @automattic/eslint-config-target-es/language), and @automattic/eslint-config-target-es is equivalent to @automattic/eslint-config-target-es/rc/all.

Checking built files

If you want to check your built files to make sure you didn't omit transpiling any packages that need transpiling, you might create a validate-es.config.js like this

module.exports = {
	root: true,
	extends: [ '@automattic/eslint-config-target-es/rc/language' ],
	env: {
		// Whatever environments you need.
	},
};

and then run eslint like

eslint --no-eslintrc --no-inline-config --config validate-es.config.js --no-ignore build/

to avoid your standard eslintrc and eslintignore and to avoid errors from any inline directives.

Something similar can be done for flat config.

Advanced usage

You can import or require @automattic/eslint-config-target-es/functions to gain access to some functions that can be used to build your own configuration.

As browserslist and MDN use different browser codes, getAllBrowsers( { query: } ) will take a browserslist query and return an object with the MDN browser codes and the matched versions for each.

getRules( { query:, builtins: } ) will return the rules config. Set builtins true for "builtins", false for "language", or null/undefined for "all".

Caveats

Some browsers supported by browserslist are not availble in the MDN data (e.g. Opera Mini) or are no longer being updated (e.g. Internet Explorer). In cases like these where no data is available, features are assumed to be supported. Set the environment variable DEBUG=@automattic/eslint-config-target-es:warn to generate messages when this happens.

Security

Need to report a security vulnerability? Go to https://automattic.com/security/ or directly to our security bug bounty site https://hackerone.com/automattic.

License

eslint-config-target-es is licensed under GNU General Public License v2 (or later)

--