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

v0.28.2

Published

ESLint config following Wikimedia code conventions.

Downloads

32,293

Readme

Wikimedia ESLint config

Installation

npm install --save-dev eslint-config-wikimedia

Then, configure ESLint with one or more .eslintrc.json files as appropriate.

Example configurations

Below are some potential recommended uses:

A typical front-end project

This config allows ES6 code and browser native functions. It will complain about ES2016+ code and language features. It also automatically applies the Vue plugin and Vue-specific rules to .vue files.

.eslintrc.json:

{
	"extends": "wikimedia/client/es6"
}

If you want to only allow ES5 code and browser native functions, you can use wikimedia/client/es5 instead.

jQuery

This config adds the jQuery $ global, and additional rules preventing the use of jQuery features which are deprecated, have performance issues, or have simple ES6 alternatives. .eslintrc.json:

{
	"extends": [
		"wikimedia/client/es6",
		"wikimedia/jquery"
	]
}

MediaWiki

Code that runs in MediaWiki can use this config. It enforces rules that are specific to the MediaWiki codebase (core and extensions), such as correct documentation of mw.message usage, and prohibiting self-closing tags in Vue templates. .eslintrc.json:

{
	"extends": [
		"wikimedia/client/es6",
		"wikimedia/mediawiki"
	]
}

Adding a QUnit test suite

You can extend the above config by also adding a second .eslintrc.json file in your tests directory:

tests/qunit/.eslintrc.json:

{
	"extends": [
		"wikimedia/mediawiki/qunit"
	]
}

Or for standalone JavaScript libraries and Node.js projects:

tests/.eslintrc.json:

{
	"extends": [
		"wikimedia/qunit"
	]
}

Adding a Mocha test suite

The following config will the Mocha environment and some Mocha related rules:

tests/mocha/.eslintrc.json:

{
	"root": true,
	"extends": [
		"wikimedia/server",
		"wikimedia/mocha"
	]
}

Adding a Selenium WDIO test suite

The following config will enable WDIO globals, as well as the Mocha and server configs:

tests/selenium/.eslintrc.json:

{
	"root": true,
	"extends": [
		"wikimedia/selenium"
	]
}

A typical Node project

This config allows ES2018 code and Node native functions (i.e., Node 10.x). It will complain about ES2019+ code and language features.

.eslintrc.json:

{
	"extends": "wikimedia/server"
}

The wikimedia/server config consists of wikimedia, wikimedia/node and wikimedia/language/es2018. To use later versions of ES, for example ES2019, you can use the following config: .eslintrc.json:

{
	"extends": [
		"wikimedia",
		"wikimedia/node",
		"wikimedia/language/es2019"
	]
}

A basic project

Please note that the basic project configuration does not specify any language or environmental defaults, and is unlikely to be suitable. However, if you wish to target clients with ES3 language support, or earlier versions of Node, this is a good place from which to start.

.eslintrc.json:

{
	"extends": "wikimedia"
}

Proposing changes

Major changes should be discussed on mediawiki.org or on the Wikitech mailing list beforehand.

Semver policy

Same approach as in ESLint, see https://github.com/eslint/eslint#user-content-semantic-versioning-policy.