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

v0.0.1

Published

ESLint settings for Schibsted

Downloads

5

Readme

eslint-config-spt Build Status

A module to contain the SPT JavaScript linting rules for ESLint.

How to use

First, install the npm package:

npm install --save-dev eslint-config-spt

Then add the extends option to your .eslintrc:

{
    "extends": "spt"
}

For React.js rules you can add

{
    "extends": [
        "spt",
        "spt/env-react"
    ]
}

You can override specific settings by specifying them as normal. See http://eslint.org/docs/developer-guide/shareable-configs for more details.

Publishing

Update CHANGELOG
$ npm version <patch | minor | major>
$ git push --tags origin master
$ npm publish

Subdirectories

ESLint configuration supports cascading with hierarchy. Every directory can have an .eslintrc file which overwrites settings included in .eslintrc files further up the tree. As such you should set rules for required syntax as close to the code that uses that syntax as possible.

For example you may have a subdirectory called app which is where all of your Node.js code resides. You should therefore have an app/.eslinrc files with at least the extends spt/env-node value in it.

Since the project root includes an .eslintrc file with extends spt it is advisable not to respecify this in subdirectories.

Locality & scoping

Using the ability of cascading configuration you should make all syntax as local to the code that requires it as possible. This includes env, rules, globals etc.

This will enable the linting process to be as accurate as possible, preventing easily spotted false positives and the harder to spot false negatives.

extends vs env

tldr; env sets globals, extends sets globals and rules. Use extends when possible.

A number of the available spt/* "rules packs" available to extends match env settings that can be toggled. It should be noted that in addition to toggling the env setting, they also set up additional rules that should be followed in that syntax. As such, when possible, always extends vs toggling an env.

It may not always be possible to isolate rules using extends; for example in a project root where there may be files for a mixture of environments. In such cases efforts should be made to set file based rules that provide some level of confidence in the file's syntax. It is not currently possible to use extends on a per-files basis.

Rule packs

ECMAScript 2015

ECMAScript 2015 (aka ES6, ECMA-262 6th Edition) syntax is enabled by default. If you would like to disable these features then you should extend spt/env-es6-false to remove the syntax. Note that doing so will disable all ES6 features such as ES6 modules.

{
  "extends": [
    "spt/env-es6-false"
  ]
}

If you would like to re-enable ES6 syntax for a specific subfolder tree make sure there is an .eslintrc file in that folder that includes at least the following.

{
  "extends": [
    "spt/env-es6"
  ]
}

ES6 modules

If you use ES6 modules you can enable and disable the syntax with the following extends values.

Note that these are not enabled by default because they can potentially cause a lot of lint errors in your other files. For example, ES6 modules are always in strict mode. As such, having a "use strict"; declaration is redundant and causes a lint error. However, if you enable this syntax globally then non-ES6 modules can throw the same error even though they require the use of "use strict"; to be in strict mode.

To enable:

{
  "extends": [
    "spt/env-es6-modules"
  ]
}

To disable:

{
  "extends": [
    "spt/env-es6-modules-false"
  ]
}

Node

Node.js syntax can be enabled and disabled with the following extends value.

To enable:

{
  "extends": [
    "spt/env-node"
  ]
}

To disable:

{
  "extends": [
    "spt/env-node-false"
  ]
}

React

React syntax can be linted with the following extends value.

To enable:

{
  "extends": [
    "spt/env-react"
  ]
}