1.0.0 • Published 2 years ago

eslint-config-salt-typescript v1.0.0

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

eslint-config-salt-typescript

</salt>'s ESLint rules for all your course linting needs, now in TypeScript. 🧂 A ruleset based on Airbnb's JavaScript Style Guide.


version downloads ISC License

Table of Contents

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's devDependencies:

npm install --save-dev eslint-config-salt-typescript

Usage

Then add the extends to your .eslintrc:

{
  "extends": "salt-typescript",
  "rules": {
    // your overrides
  }
}

Potential errors

You might see the error

Error: Error while loading rule '@typescript-eslint/dot-notation': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

which can be easily solved by adding a parserOptions node to the .eslintrc file that points to your TypeScript configuraiton:

{
  // other config
  "parserOptions": {
    "project": ["./tsconfig.json"]
  }
}

Other configs

This config also exposes a few other configs that will be used throughout the duration of the course.

React configs

The config for React are created as additions. Use the the following config:

{
  "extends": ["salt-typescript", "salt-typescript/react"]
}

And for the config in case you are using React Hooks:

{
  "extends": ["salt-typescript", "salt-typescript/react", "salt-typescript/react/hooks"]
}

LICENSE

ISC