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

@codeyourfuture/eslint-config-standard

v5.1.0

Published

A standard ESLint configuration for all CYF examples/projects.

Downloads

362

Readme

CYF ESLint Configuration

License Build Status NPM Version

A standard ESLint configuration for all CYF examples/projects.

Versioning

This configuration uses SemVer, interpreted as follows:

  • Patch release (x.y.z -> x.y.z+1): bugfixes and tooling updates mean that code that previously passed linting should continue to pass after the update.

  • Minor release (x.y.z -> x.y+1.0): a change to an existing rule means that code that previously failed linting may now pass, or a new configuration means that code that previously passed linting should continue to pass.

  • Major release (x.y.z -> x+1.0.0): a new rule, or a change to an existing rule, means that code that previously passed linting will not pass any more.

Please bear these definitions in mind when reporting any bugs.

Usage

Install this package along with ESLint itself:

npm install --save-dev eslint @codeyourfuture/eslint-config-standard

Then create an ESLint config file and add this config:

const cyfConfig = require("@codeyourfuture/eslint-config-standard");

module.exports = [cyfConfig];

or using ES module syntax:

import cyfConfig from "@codeyourfuture/eslint-config-standard";

export default [cyfConfig];

Alternatively, for a slightly more permissive set of rules, you can use @codeyourfuture/eslint-config-standard/lax.

.eslintrc

If you have not yet migrated to the newer ESLint "flat config", you can apply these rules to the deprecated config using "extends":

{
  "extends": ["@codeyourfuture/standard"]
}

Principles

  1. Errors only - don't teach trainees to ignore any output, all rules should either be "error" or "off"
  2. Maximise consistency - where there are options (e.g. braces for single-line statements, parentheses around arrow function parameters), be consistent with the non-optional cases
  3. Minimise change set size - keep commits small so trainees can focus on the important changes

Rules

This config starts from js.configs.recommended then adds the following rules:

| Configuration| Rule | Setting | Principles/rationale | |---|---|---|---| | standard, lax | arrow-parens | | 2, 3 | | standard, lax | brace-style | "1tbs", { "allowSingleLine": false } | | | standard, lax | comma-dangle | "always-multiline" | 3 | | standard, lax | curly | | 2 | | standard | indent | "tab", { "SwitchCase": 1 } | Tabs are more accessible | | standard | linebreak-style | "unix" | | | standard, lax | no-trailing-spaces | | | | standard, lax | no-unused-vars | { "ignoreRestSiblings": true } | | | standard, lax | no-var | | Stick with let and const for more predictable behaviour | | standard, lax | object-curly-spacing | "always" | | | standard, lax | operator-linebreak | "before" | | | standard, lax | quotes | "double", { "avoidEscape": true, "allowTemplateLiterals": false } | More likely to need ' inside a string than " | | standard, lax | semi | | Trainees shouldn't have to memorise the ASI rules |

Development

You can clone this repo and run npm install to install the development dependencies. Two scripts are provided:

  • lint: uses the version of ESLint installed as a dev dependency to lint index.js against its own rules.

  • test:examples: runs bin/examples.sh to test the configuration against the pass.js and fail.js examples in examples/. pass.js contains code that should pass linting according to the configuration, fail.js contains code that should fail linting.

  • test:install: runs bin/test.sh to create a package, installs ESLint (version defined by the required environment variable ESLINT_VERSION) and the current version of this configuration, then checks that there are no version conflicts and lints index.js. E.g. ESLINT_VERSION=6 npm run test will test that this configuration works with the latest version of ESLint 6.