Tlon ESLint + Prettier Configuration
Abstract
These are our shared settings for ESLint and Prettier. This ESLint configuration lints and formats our code so it follows our shared style guide. It uses ESLint to lint and fix Typescript and Javascript, and Prettier to format our code nicely.
Installation
Install the package with:
npm install @tloncorp/eslint-config --save-dev
@tloncorp/eslint-config
requires you to take care of it's peerDependencies
. Install the correct version of each peerDependencies
package, which are listed with the following command:
npx install-peerdeps --dev @tloncorp/eslint-config
ESLint Configuration
Now add @tloncorp/eslint-config
to your .eslintrc.js
:
// .eslintrc.js
module.exports = {
extends: '@tloncorp/eslint-config',
// for typescript codebases, you'll also need to add the followings:
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
parserOptions: {
project: './tsconfig.json', // edit this path to point to your tsconfig.json
},
},
],
}
Prettier Configuration
This is how you can use or extend the @tloncorp/eslint-config
Prettier config in your app:
// .prettierrc.js
module.exports = require('@tloncorp/eslint-config/.prettierrc.js')
// or to override specific options
module.exports = {
...require('@tloncorp/eslint-config/.prettierrc.js'),
semi: true,
}
Publishing
This package gets published to NPM: @tloncorp/eslint-config
. You will need to be a member of @tloncorp
on npm in order to publish changes. From here you can publish your changes with:
- Update the version number in
package.json
, and merge your changes intomaster
- From
master
, runnpm publish