npm

Need private packages and team management tools?Check out npm Orgs. »

eslint-config-wikimedia

0.15.0 • Public • Published

Build Status

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

Bellow are some potential recommended uses:

A typical front-end project

This profile allows ES5 code and browser native functions. It will complain about ES6+ code and language features.

.eslintrc.json:

{
    "extends": "wikimedia/client"
}

jQuery

This profile adds the jQuery $ global, and additional rules preventing the use of jQuery features that have ES5 alternatives. .eslintrc.json:

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

MediaWiki

Code that runs in MediaWiki can use this profile. It enforces rules that are specific to the MediaWiki codebase (core and extensions), such as correct documentation of mw.message usage. .eslintrc.json:

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

Adding a QUnit test suite

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

tests/qunit/.eslintrc.json:

{
    "extends": [
        "wikimedia/qunit",
        "../../.eslintrc.json"
    ]
}

A typical Node project

This profile allows ES6 code and node native functions (i.e., Node 6.x). It will complain about ES2016+ code and language features.

.eslintrc.json:

{
    "extends": "wikimedia/server"
}

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

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

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.

install

npm i eslint-config-wikimedia

Downloadsweekly downloads

3,751

version

0.15.0

license

MIT

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability