My Code Docs

My Code Docs

  • Docs
  • Projects
  • Components
  • Help

›Javascript

Javascript

  • Promises and Asnyc/Await
  • Local Storage
  • Firebase
  • JS Language Basics
  • JS Array Functions
  • Keyboard and Mouse Input
  • ES6 Cheatsheet
  • ESLint Setup
  • Data Structures
  • Naming Conventions
  • Javascript Resources
  • Javascript Snippets
  • npm Module Creation

Node

  • Node JS Basics
  • Server Config and SSH

NextJS

  • NextJS Basics

JS/React Libs

  • Lodash Library
  • Axios
  • Ramda
  • Moment JS
  • Overmind
  • Redux Forms npm Module
  • React Beautiful DnD
  • Ant Design
  • Zustand State Managment

React

  • React Basics
  • React Hooks
  • React With Classes
  • Reach Router
  • React Router
  • React Components

Redux

  • Redux in React
  • My Redux Pattern
  • Redux with React (First Doc)
  • Simple Redux Package

ReactNative

  • React Native
  • React Navigation V5
  • React Navigation V4

HTMLCSS

  • HTML and CSS Snippets
  • Tailwind CSS

Electron

  • Electron React Boiler
  • Electron Basics
  • Electron Packaging
  • Electron Tooling

ESLint Setup

The basics of setting up ESLint:

  1. Install ESLint as a dev dependency for your project
  2. Install Library with usage you want to use (We will use airbnb's style guide)
  3. Create and .eslintrc file
  4. Install ESLint plugin into editor you are using

Should be easy, and usually is. I have found some issues when installing the airbnb rules with dependencies not being compatible. I would use the given versions below just to be sure.

Install ESLint and Style Library (items 1 and 2 above)

> yarn add -D eslint
> yarn add -D eslint-config-airbnb@16.1.0 eslint-plugin-import@2.7.0 eslint-plugin-react@7.4.0 eslint-plugin-jsx-a11y@6.0.1 

You can also include the Jest style guide if you are using it for testing:

> yarn add -D eslint-plugin-jest

Create the .eslintrc file

This will tell ESLint what to check. Here we are extending the airbnb guide.

I'm also include

{
  "extends": "airbnb",
  "parserOptions": {
    "ecmaVersion": 6
  },
  "env": {
    "node": true,
    "browser": true,
    "es6": true,
    "jest/globals": true
  },
  "plugins": [
    "jest"
  ],
  "rules": {
    "comma-dangle": 1,
    "no-unused-vars": [
      "error",
      {
        "vars": "local",
        "args": "none"
      }
    ],
    "arrow-body-style": "warn",
    "linebreak-style": "off",
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    "react/prop-types": 0
  }
}
← ES6 CheatsheetData Structures →
My Code Docs
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2020 McCoidCo