0.1.1 • Published 6 years ago

@totominc/eslint-config v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

@totominc/eslint-config

Modern ESLint configs for JS, TS and Vue apps.

ESLint configurations

This module provides 3 configurations:

  • Vanilla JS: eslint:recommended, airbnb and prettier (no JSX support).
  • TypeScript: airbnb-base, @typescript-eslint/recommended and prettier.
  • Vue: vue:recommended, airbnb-base, prettier/recommended.

Usage

Vanilla JS

Extend your .eslintrc configuration:

{
  "extend": "@totominc/eslint-config"
}

Please note that this config doesn't have JSX support.

TypeScript

Extend your .eslintrc configuration:

{
  "extend": "@totominc/eslint-config/typescript"
}

If you need additionnal linting rules based on the typings, you must pass some additional configuration such as your tsconfig.json.

Vue

Extend your .eslintrc configuration:

{
  "extend": "@totominc/eslint-config/vue"
}

This set of rules provides good defaults to write a Vue app and avoid cognitive overhead (as recommended in their @vue/eslint-config docs) with Prettier on top of it to makes your Vue SFC easy to read.

Note: This ESLint configuration is not suitable Vue + TypeScript.

Default Prettier configuration

The default Prettier configuration used in all the modules is the following one:

{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "quoteProps": "as-needed",
  "jsxSingleQuote": true,
  "trailingComma": "all",
  "bracketSpacing": true,
  "jsxBracketSameLine": false,
  "arrowParens": "always"
}

You can easily override the Prettier config in your .eslintrc file by creating a new prettier/prettier rule, as explained here.