Package detail

eslint-config-vtex

vtex81.4kMIT15.1.0

VTEX's eslint config

eslint, config, vtex

readme

eslint-config-vtex

This package provides VTEX's .eslintrc as an extensible shared config.

Installation

Give that you already have ESLint installed, run:

yarn add -D eslint-config-vtex typescript prettier

Usage

After installing the module, just add it to your extends array inside your .eslintrc.

// .eslintrc
{
  "extends": ["vtex"]
}

As any other eslint preset, it's possible to override some rules and configurations. We encourage trying to keep the closest possible to the preset rules, but every project is different and sometimes overriding is needed, use it carefully.

For typescript

The preset will automatically load Typescript rules when dealing with .ts or .tsx files. However, there are some rules that require type-checking. This means that a tsconfig.json, which includes all files supposed to be linted, must be present. If your existing configuration does not include all of the files you would like to lint, you can create a separate tsconfig.eslint.json, at the root of your project, as follows:

// tsconfig.eslint.json
{
  "extends": "./tsconfig.json",
  "include": ["**/*.ts", "**/*.tsx", "**/*.js"],
  "exclude": []
}

And you should be good to go.

For Javascript

Sometimes you want to use modern, not yet officially supported, syntax in your Javascript files, such as dynamic import(). This can be achieved by using the babel-eslint parser. For size reasons, we don't include it in this preset but it's extremely simple to configure it:

yarn add -D babel-eslint
// .eslintrc
{
  "extends": "vtex",
  "parser": "babel-eslint",
  "parserOptions": {
    "sourceType": "module"
  }
}

If a project uses both Typescript and Javascript, you can configure the parser inside an override block:

// .eslintrc
{
  "extends": "vtex",
  "overrides": [
    {
      "files": ["*.js", "*.jsx"],
      "parser": "babel-eslint",
      "parserOptions": {
        "sourceType": "module"
      }
    }
  ]
}

Please check the babel-eslint documentation for further options.

References

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

15.0.2 - 2022-10-28

Removed

  • Option forceSuggestionFixer that no longer exists.

15.0.0 - 2022-03-15

Changed

  • BREAKING CHANGE Upgrades @typescript-eslint dependencies to major 5.
  • BREAKING CHANGE Upgrades eslint-plugin-prettier to major 4, and bumps prettier peer dependency to only target major 2.
  • BREAKING CHANGE Updates peer dependency on eslint to only target major 8.

14.1.1 - 2021-08-17

Changed

  • Upgrades @typescript-eslint/* deps to 4.29.2

14.1.0 - 2021-06-24

Fixed

  • Fix OOM on monorepos by optmizing parsing of typescript files

14.0.0 - 2021-03-25

Changed

  • eslint-config-prettier updated 6.15.0 to 8.1.0
  • Requires at least ESLint 7.0.0 now, because eslint-config-prettier drops support for ESLint 6, see here

13.0.0 - 2021-03-16

Changed

  • Use eslint-plugin-node instead of deprecated native node rules.

Added

  • Encourage usage of Promise API for fs and dns node modules.

12.9.5 - 2021-03-15

Fixed

  • padding-line-between-statements doesn't forces lines between cjs-import, import/order already handle them

12.9.4 - 2021-01-29

Changed

  • Update typescript-eslint dependencies

12.9.3 - 2020-12-16

Fixed

  • Change projectFolderIgnoreList parameter to regexps.

12.9.2 - 2020-12-11

Added

  • consistency parameter to curly rule.

12.9.0 - 2020-12-09

Added

  • Add convention for multi-line statements after ifs, whiles, fors, etc.

12.8.14 - 2020-12-04

Changed

  • Allow to use import() for type annotations.

12.8.12 - 2020-12-03

Added

  • @typescript-eslint/no-unnecessary-type-constraint rule.
  • @typescript-eslint/consistent-type-imports rule.

Fixed

  • no-shadow rule for TypeScript.

12.8.11 - 2020-11-23

Fixed

  • Explicitly set a jest version for rule jest/no-deprecated-functions to work.
  • Fix tsconfig resolution.

12.8.9 - 2020-11-18

Changed

  • Update typescript related tools.

12.8.8 - 2020-10-22

Changed

  • Allow // @ts-expect-error comments if it has a description.

12.8.7 - 2020-10-21

Changed

  • Repo url in package.json

12.8.6 - 2020-08-25

Fixed

  • [naming-convention] Strange issue regarding multiple selectors.

12.8.5 - 2020-08-21

Changed

  • Update eslint dependencies

12.8.4 - 2020-08-20

Fixed

  • Missing lib directory.

12.8.3 - 2020-08-20

Added

  • Check if typescript is available before including its plugin.

12.8.2 - 2020-08-05

Fixed

  • [naming-convention] Disable casing convention for any memberLike name.

12.8.1 - 2020-08-03

Fixed

  • [naming-convention] Add missing casing cases.

12.8.0 - 2020-08-03

Added

  • [no-fallthrough] Add comments in the format of break .* omitted or fallsthrough to allow falling through a switch case.
  • [naming-convention] Use the new naming-convention rule to enforce a consistent symbol naming experience.

Changed

  • Update @typescript-eslint packages to latest major.

Removed

  • Deprecated camelcase rule.

12.7.0 - 2020-07-01

Changed

  • Block Typescript enums.
  • Allow console.info

12.6.0 - 2020-06-24

Added

  • Padding lines after multiline block-like statements such as try-catch, if, while, for etc.

Changed

  • padding-line-between-statements is now a warning instead of an error.

12.5.1 - 2020-06-19

Added

  • env.es6: true to base eslint config.

Fixed

  • Make Cypress global available in every file inside the cypress directory.

12.5.0 - 2020-06-01

Added

  • prettier v2.0 as acceptable dependency.

12.3.2 - 2020-04-01

Changed

  • Disable some import rules inside TypeScript declaration files.

12.3.1 - 2020-03-30

Fixed

  • Release cycle.

12.2.2 - 2020-03-30

Fixed

  • Deactivate consistent-type typescript rule.

12.2.1 - 2020-02-28

Fixed

  • Add sub presets to package bundle

12.2.0 - 2020-02-28

Removed

  • Import block of lodash and testing-library

12.1.0 - 2020-02-12

Added

  • eslint-plugin-jest and eslint-plugin-cypress

12.0.5 - 2020-02-06

Fixed

  • Prevent eslint trying to load tsconfig from node_modules.

12.0.4 - 2020-02-03

Added

  • Add warning message for lodash and @testing-library imports.

12.0.3 - 2020-01-24

Fixed

  • Changelog on deploy workflow again.

12.0.2 - 2020-01-24

Fixed

  • Changelog on deploy workflow.

12.0.1 - 2020-01-24

Fixed

  • Missing files in packages.

12.0.0 - 2020-01-24

Changed

  • Whole project structure.

Added

  • New rules to ensure best practices.
  • New rules to enforce a default coding style.

11.2.1 - 2019-12-11

Changed

  • Keep local imports together with no newline between them.
  • Add _+ as an ignore pattern for no-unused-vars.

11.2.0 - 2019-10-31

Added

  • Add eslint-plugin-import to standardize import/export styles.

11.1.0 - 2019-09-16

Changed

  • Bump typescript-eslint to v2.3.0.
  • Bump eslint-plugin-lodash to v6.0.0.
  • Bump eslint-config-prettier to v6.2.0.

11.0.0 - 2019-07-15

Changed

  • Upgrade typescript-eslint dependencies to support latest TypeScript version.

10.1.0 - 2019-03-20

Removed

  • Remove eslint-plugin-import.

10.0.1 - 2019-03-15

Changed

  • Disabled rule
    • The current version of the parser doesn't have support for type analysis, so this rule will complain for all functions, and not only the ones that doesn't have a type signature or aren't inferable.
  • Added typescript extensions for import plugin.

10.0.0 - 2019-03-15

Changed

  • Add support for typescript using the @typescript-eslint project packages.

9.2.0 - 2019-02-18

Changed

  • Disable no-console rule for warnings and errors.

9.1.0 - 2019-02-06

Added

  • Eslint recommended rules.

9.0.0 - 2019-01-28

Changed

  • Lodash rules and prettier configs.