All Projects → eslint-kit → Eslint Config Kit

eslint-kit / Eslint Config Kit

Licence: mit
A collection of useful eslint configs

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Eslint Config Kit

eslint-config-hardcore
The most strict (yet practical) ESLint config. 34 plugins. 1047 rules.
Stars: ✭ 168 (+330.77%)
Mutual labels:  config, eslint, prettier
React Typescript Web Extension Starter
🖥 A Web Extension starter kit built with React, TypeScript, SCSS, Storybook, Jest, EsLint, Prettier, Webpack and Bootstrap. Supports Google Chrome + Mozilla Firefox + Brave Browser 🔥
Stars: ✭ 510 (+1207.69%)
Mutual labels:  eslint, prettier
Budgeting
Budgeting - React + Redux + Webpack (tree shaking) Sample App
Stars: ✭ 971 (+2389.74%)
Mutual labels:  eslint, prettier
React Ssr Setup
React Starter Project with Webpack 4, Babel 7, TypeScript, CSS Modules, Server Side Rendering, i18n and some more niceties
Stars: ✭ 678 (+1638.46%)
Mutual labels:  eslint, prettier
React 2048 Game
🎮 A fancy 2048 game build with react, redux best practices.
Stars: ✭ 401 (+928.21%)
Mutual labels:  eslint, prettier
Vue Skeleton Mvp
VueJs, Vuetify, Vue Router and Vuex skeleton MVP written on JavaScript using async/await built to work with API REST skeleton: https://github.com/davellanedam/node-express-mongodb-jwt-rest-api-skeleton
Stars: ✭ 406 (+941.03%)
Mutual labels:  eslint, prettier
Serverless Typescript Starter
🗄🙅‍♀️ Deploy your next serverless JavaScript function in seconds
Stars: ✭ 653 (+1574.36%)
Mutual labels:  eslint, prettier
Prettier Eslint
Code ➡️ prettier ➡️ eslint --fix ➡️ Formatted Code ✨
Stars: ✭ 3,435 (+8707.69%)
Mutual labels:  eslint, prettier
Mevn Cli
Light speed setup for MEVN(Mongo Express Vue Node) Apps
Stars: ✭ 696 (+1684.62%)
Mutual labels:  eslint, prettier
Express React Boilerplate
🚀🚀🚀 This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: ✭ 32 (-17.95%)
Mutual labels:  eslint, prettier
Prettier Atom
An atom package for the prettier formatter.
Stars: ✭ 750 (+1823.08%)
Mutual labels:  eslint, prettier
Nodejs Api Boilerplate
A boilerplate for kickstart your nodejs api project with JWT Auth and some new Techs :)
Stars: ✭ 364 (+833.33%)
Mutual labels:  eslint, prettier
Apollo Upload Examples
A full stack demo of file uploads via GraphQL mutations using Apollo Server and apollo-upload-client.
Stars: ✭ 358 (+817.95%)
Mutual labels:  eslint, prettier
Prettier Eslint Cli
CLI for prettier-eslint
Stars: ✭ 451 (+1056.41%)
Mutual labels:  eslint, prettier
Webpack React Boilerplate
Minimal React 16 and Webpack 4 boilerplate with babel 7, using the new webpack-dev-server, react-hot-loader, CSS-Modules
Stars: ✭ 358 (+817.95%)
Mutual labels:  eslint, prettier
Express Babel
Express starter kit with ES2017+ support, testing, linting, and code coverage
Stars: ✭ 621 (+1492.31%)
Mutual labels:  eslint, kit
Front End Stack
Starter kit for building single-page app using React, Redux, RxJS, Reselect, Material UI, Immer, Prettier and Webpack.
Stars: ✭ 11 (-71.79%)
Mutual labels:  eslint, prettier
Expo Netflix
Netflix UI Clone with React Native & Expo || web support => https://expo-netflix.vercel.app
Stars: ✭ 297 (+661.54%)
Mutual labels:  eslint, prettier
Web Configs
Common configurations for building web apps at Shopify
Stars: ✭ 302 (+674.36%)
Mutual labels:  eslint, prettier
Tslint To Eslint Config
Converts your TSLint configuration to the closest possible ESLint equivalent. 🚀
Stars: ✭ 680 (+1643.59%)
Mutual labels:  eslint, config

ESLint Config Kit


ESLint Config Kit is a collection of useful ESLint configs for much more convenient project developing.
It uses only the necessary rules to provide error checking and readability improving. Nothing extra included.

Configs divided into base and technology-specific parts, which can be used in "modular" style.

  • It doesn't enforce any doubtful rules, like prefer-default-export in airbnb config.

  • It helps you to write a more readable code.
    Any use of implicit language mechanic will be warned.

  • It's designed to be a conflict-free.
    For example, @typescript/eslint:recommended config does not resolve conflicts with import plugin, but @eslint-kit/typescript does.

  • The main goal is to create a zero-override config, which can be used almost in any project.

Here is the example for TypeScript React project:

{
  "extends": [
    "@eslint-kit/base",
    "@eslint-kit/typescript",
    "@eslint-kit/react"
  ]
}

Overview

Installation using ESLint Kit CLI

Using npx (recommended):

npx @eslint-kit/cli

Installing globally (it's good in rare cases):

npm i -g @eslint-kit/cli
eslint-kit

Learn more on @eslint-kit/cli page.

Manual installation

  1. Install basic dependencies:

    npm i -D eslint @eslint-kit/eslint-config-base
    
  2. Create .eslintrc file in the root of your project.

  3. Extend from base config:

    {
      "extends": ["@eslint-kit/base"]
    }
    
  4. Add any desired configs here.

  5. (optional) Integrate ESLint into your IDE/editor here.

Configs

Note: Base config does not include any formatting rules. It is strongly recommended to use prettier config for this purposes. Just open Prettier section right below.

Prettier

This config just enables the prettier plugin and adds prettier/prettier rule.

Installation:

  1. Install config:

    npm i -D @eslint-kit/eslint-config-prettier
    
  2. Extend from it:

    {
      "extends": [
        "@eslint-kit/base",
    +   "@eslint-kit/prettier"
      ]
    }
    
  3. Create .prettierrc file in the root of your project add specify your formatting settings.

  4. (optional) Use the recommended settings:

    {
      "semi": false,
      "singleQuote": true,
      "tabWidth": 2,
      "quoteProps": "consistent",
      "trailingComma": "es5",
      "endOfLine": "lf"
    } 
    
React

Installation:

  1. Install parser (skip if you already have it):

    Choose between babel-eslint and @typescript-eslint/parser, depends on what you use.

    Note: babel-eslint requires babel/[email protected]>=7.2.0 and a valid Babel configuration file to run. If you do not have this already set up, please see the Babel Usage Guide.

  2. Install config:

    npm i -D @eslint-kit/eslint-config-react
    
  3. Extend from it and specify a parser:

    {
    + "parser": "babel-eslint",
      "extends": [
        "@eslint-kit/base",
    +   "@eslint-kit/react"
      ]
    }
    
Node

This config just enables the node env, it doesn't add any rules.

Installation:

  1. Install config:

    npm i -D @eslint-kit/eslint-config-node
    
  2. Extend from node config:

    {
      "extends": [
        "@eslint-kit/base",
    +   "@eslint-kit/node"
      ]
    }
    
TypeScript

Installation:

  1. Install @typescript-eslint/parser parser (skip if you already have it):

  2. Install config:

    npm i -D @eslint-kit/eslint-config-typescript
    
  3. Extend from typescript config and specify a parser:

    {
    + "parser": "@typescript-eslint/parser",
      "extends": [
        "@eslint-kit/base",
    +   "@eslint-kit/typescript"
      ]
    }
    

Integrating ESLint with IDEs/editors

VSCode
  1. Install ESLint plugin

  2. Choose any option you like:

    • Fix on save.
      Add the following to your settings.json:

      "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
      }
      
    • Fix on keyboard shortcut.
      Add the following to your keybindings.json:

      {
        "key": "alt+f", // or any other keys
        "command": "eslint.executeAutofix"
      }
      

Advanced Usage

Add aliases to import plugin (JavaScript)

Using CLI:

npx @eslint-kit/cli alias

Manually:

  1. Install dependencies:

    npm i -D eslint-import-resolver-alias
    
  2. Update .eslintrc with your aliases:

    {
      "settings": {
        "import/resolver": {
          "alias": {
            "map": [
              ["@folder-alias", "./src"],
              ["@file-alias", "./src/App.js"]
            ],
            "extensions": [".js", ".jsx", ".json"]
          }
        }
      },
      "rules": {
        "import/order": [
          "warn",
          {
            "groups": [
              "builtin",
              "external",
              "internal",
              "parent",
              "sibling",
              "index"
            ],
            "pathGroups": [
              {
                "pattern": "@folder-alias/**",
                "group": "internal",
                "position": "before"
              },
              {
                "pattern": "@file-alias",
                "group": "internal",
                "position": "before"
              }
            ]
          }
        ]
      }
    }
    
Add aliases to import plugin (TypeScript)

Using CLI:

npx @eslint-kit/cli alias

Manually:

  1. Install dependencies:

    npm i -D eslint-import-resolver-typescript
    
  2. Update .eslintrc:

    {
      "settings": {
        "import/parsers": {
          "@typescript-eslint/parser": [".ts", ".tsx"]
        },
        "import/resolver": {
          "typescript": {
            "alwaysTryTypes": true
          }
        }
      },
      "rules": {
        "import/order": [
          "warn",
          {
            "groups": [
              "builtin",
              "external",
              "internal",
              "parent",
              "sibling",
              "index"
            ],
            "pathGroups": [
              {
                "pattern": "@folder-alias/**",
                "group": "internal",
                "position": "before"
              },
              {
                "pattern": "@file-alias",
                "group": "internal",
                "position": "before"
              }
            ]
          }
        ]
      }
    }
    

    Note: See eslint-import-resolver-typescript README for the details.

Troubleshooting

Common issues

Issue:

Definition for rule '**/**' was not found.

This problem occurs when there are several plugins in the dependencies of your project that are also used by eslint-kit, but their versions from the dependencies of your project do not fit the requirements of the eslint-kit. Due to the eslint mechanics of loading plugins, eslint-kit configs get the wrong plugins versions in which some of the rules may either be removed or have other settings.

Read more here.

Solution:

Install rc version of base config:

npm i -D @eslint-kit/[email protected]
TypeScript config issues

Issue:

  • Anything related to "parserOptions.project"

Solution:

You should specify your tsconfig location manually in parserOptions:

{
  "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+   "project": ["*/tsconfig.json"]
+ },
  "extends": [
    "@eslint-kit/base",
    "@eslint-kit/typescript"
  ]
}

If it doesn't work, try to rename eslint config file to .eslintrc.js and resolve tsconfig.json path:

const path = require('path')

module.exports = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: [path.resolve(__dirname, './tsconfig.json')] // or your tsconfig location
  },
  extends: [
    '@eslint-kit/base',
    '@eslint-kit/typescript'
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].