@gbrachetta/tslint-config

0.0.43 • Public • Published

@gbrachetta/tslint-config

npm

TSLint configuration for a React-based Project (Next.js, Gatsby, etc). Easy to install and configure, it follows the best code standards from airbnb and uses prettier configuration on code format. Integrated with my prettier configuration.

Purpose

This configuration uses airbnb and Prettier configuration plus some extra rules that I find useful for React applications.

For more information, check ESLint, TSLint and Prettier documentations as well the airbnb and prettier.

This package integrates the Prettier rules with ESLint using my configuration, adapted to a typescript project. You can check it at @gbrachetta/prettier-config

How to install

You need ESLint and Prettier installed as development dependencies on your project. You can install them by using npm or yarn.

npm install --save-dev eslint prettier
# or
yarn add eslint prettier -D

Install all peer dependencies of my configuration, these can be listed with the command:

npm info "@gbrachetta/tslint-config@latest" peerDependencies

Install dependencies by:

npx install-peerdeps --dev @gbrachetta/tslint-config

How to use

To configure ESLint and Prettier you can add to your package.json

"eslintConfig": {
  "extends": "@gbrachetta/tslint-config"
},
"prettier": "@gbrachetta/prettier-config"

If you need to override or extend the settings, you can create a .eslintrc.json and .prettierrc.json files and add extends: "@gbrachetta/tslint-config" and "@gbrachetta/prettier-config" respectivally. As an example:

// .eslintrc.json
{
  "extends": "@gbrachetta/tslint-config"
}
// you can edit this configuration as usual, check ESLint docs
// .prettierrc.json
{
  "@gbrachetta/prettier-config"
}

To use ESLint and Prettier from the terminal, add these scripts to your package.json file

{
  "lint": "eslint ./ --ignore-path .gitignore",
  "lint:fix": "npm run lint -- --fix",
  "format": "prettier --write \"{,!(node_modules)/**/}*.js\""
}

Contributing

How to contribute to this open source library

License

Copyright © 2022 Guillermo Brachetta. This library is licensed under the MIT license.

Package Sidebar

Install

npm i @gbrachetta/tslint-config

Weekly Downloads

6

Version

0.0.43

License

MIT

Unpacked Size

9.11 kB

Total Files

4

Last publish

Collaborators

  • guillermobrachetta