/eslint-config-vkbansal

Shareable ESLint Config

Primary LanguageJavaScript

ESLint Shareable Config

An ESLint Shareable Config for my projects. It uses typescript-eslint as its parser.

Install

yarn add eslint-config-vkbansal

Usage

Shareable configs are designed to work with the extends feature of .eslintrc files. You can learn more about Shareable Configs on the official ESLint website.

Then, add this to your .eslintrc file:

{
    "extends": [
        "vkbansal",
        "vkbansal/typescript"
    ],
  " parserOptions": {
        "project": "tsconfig.json"
    }
}

Note: We omitted the eslint-config- prefix since it is automatically assumed by ESLint.

You can override settings from the shareable config by adding them directly into your .eslintrc file.

React/JSX

This package also includes a shareable config to be used with React or JSX. Just add this to your .eslintrc file:

{
    "extends": [
        "vkbansal",
        "vkbansal/typescript"
        "vkbansal/react"
    ],
    "parserOptions": {
         "project": "tsconfig.json"
    }
}

Differences from eslint-config-airbnb

Config airbnb-base (11.1.1) vkbansal (5.0.0)
indent 2 spaces 4 spaces
eqeqeq ignore for null always
no-eq-null off error
no-implicit-coercion off error
no-warning-comments off warn
require-await off error
wrap-iife outside, functionPrototypeMethods: false inside, functionPrototypeMethods: false
yoda off error
comma-dangle always-multiline never
no-constant-condition warn error
no-extra-parens off error
no-constant-condition warn error
max-len 100 120
no-continue error off
no-nested-ternary error off
no-plusplus error off
no-restricted-syntax ForInStatement, ForOfStatement, LabeledStatement, WithStatement LabeledStatement, WithStatement
nonblock-statement-body-position off error
template-tag-spacing off error
wrap-regex off error
prefer-const error off
no-native-reassign (deprecated) off N/A
no-negated-in-lhs (deprecated) off N/A
no-spaced-func (deprecated) error N/A
prefer-reflect (deprecated) off N/A
import/imports-first (deprecated) off N/A

React

Config airbnb (14.1.0) vkbansal (5.0.0)
forbid-prop-types any, array, object none
jsx-closing-bracket-location line-aligned after-props
jsx-handler-names off error
jsx-indent-props 2 4
jsx-indent 2 4
jsx-indent-key off error
no-direct-mutation-state off error
sort-props no handler-names handler-names included
jsx-filename-extension .jsx .js

Import

Config airbnb (14.1.0) vkbansal (5.0.0)
named off error
default off error
namespace off error
no-commonjs off error
no-nodejs-modules off error
order off error

License

MIT. Copyright (c) Vivek Kumar Bansal.