Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including eslint-config-valorsoft with all npm packages installed. Try it out:

eslint-config-valorsoft lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("eslint-config-valorsoft/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

eslint-config-valorsoft v0.1.0

Valor Software's ESLint config, following our styleguide

Welcome to the most strict eslint config ever

npm version npm downloads Build Status Dependency Status devDependency Status

Philosophy

  • contains all rules
  • almost all rules enabled
  • this config is highly opinionated

Where to use

  • anywhere
  • for tests better to add env:"node" and disable newline-per-chained-call rule

How to use

  • install latest npm
    $(sudo) npm install -g npm@latest
    
  • add task eslint to package.json script section
    "eslint": "./node_modules/.bin/eslint --ignore-path .gitignore  --ext js --fix . .config",
    
  • add linting to tests step scripts package.json section
    "test": "npm run eslint && ..."
    
  • create .eslintrc.json near to you package.json with the following content
    {
      "extends": "./node_modules/eslint-config-valorsoft/.eslintrc.json",
      "env": {
        "node": true
      }
    }
    
  • run npm t to check that all is working correctly

What is disabled

  • no-eq-null - duplicates eqeqeq:smart
  • no-restricted-imports, no-restricted-modules, no-restricted-globals - dependant on project requirements
  • id-match - not found any particular use of this rule, camelCase is enough
  • jsx-quotes - I don't use jsx so I don't care
  • no-plusplus - why not ++? It's nice to use when you know what you are doing
  • no-restricted-syntax - duplicates no-with and disabled functional expressions
  • no-ternary - why not? but not nested ternary please
  • require-jsdoc- nice thing, but hard to follow
  • spaced-comment - nice for meaningful comments, bad for quick code commenting
  • wrap-regex - no need
  • prefer-reflect - compatibility is to low to use
  • newline-before-return - TBD

What is tweaked

  • indent - 2 spaces rulezzz!
  • max-len - extended to 120 chars
  • newline-per-chained-call - extended ignoreChainWithDepth to 3
  • eqeqeq - smart mode enabled
  • dot-location - property mode enabled
  • no-implicit-coercion - boolean implicit coercion enabled
  • func-style - declaration only please
  • no-use-before-define - usage of function before declarations are allowed
  • no-mixed-requires- grouping and allowCall checks enabled
  • linebreak-style - unix only
  • one-var - never use one var|let|const per block
  • padded-blocks - never add useless padding
  • quote-props - quote properties only as-needed and keywords
  • no-magic-numbers - ignore -1,0,1 as most often used numbers and ignoreArrayIndexes, enforceConst are enabled

Contribution

  • what I really appreciate is configs for IDEs
  • to change any rule you should have strong arguments and not only opinion
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free