@scalingfunds/eslint-config-base-ts
v4.0.2
Published
Base eslint config for all our TypeScript projects
Downloads
4
Readme
Base ESLint Config for TypeScript
Shareable ESLint config for all Brickblock TypeScript projects.
Based one TypeScript ESLint using the
@typescript-eslint/parser
for parsing
TypeScript and @typescript-eslint/eslint-plugin
for TypeScript-specific linting rules.
How to use this package
Install Package
yarn add --dev @scalingfunds/eslint-config-base-ts
Install required ESLint plugins from peer dependencies
npx install-peerdeps --yarn --dev @scalingfunds/eslint-config-base-ts
This is using
install-peerdeps
to automatically install all plugins used by this package. Plugins used by this ESLint config are defined aspeerDependencies
as outlined in the ESLint docs:If your shareable config depends on a plugin, you should also specify it as a peerDependency (plugins will be loaded relative to the end user’s project, so the end user is required to install the plugins they need). However, if your shareable config depends on a third-party parser or another shareable config, you can specify these packages as dependencies.
Use Package
Once @scalingfunds/eslint-config-base-ts
is installed, you can use it by adding it to the
extends
section of your ESLint configuration.
/* .eslintrc.js */
module.exports = {
extends: ['@scalingfunds/eslint-config-base-ts', 'other-eslint-configs']
}
NOTE: As the order in the extends
block matters, we recommend making this package the first config
because it contains all our base-level rules that may be overridden in more specific configs such as
@scalingfunds/eslint-config-react
How to develop this package
Change, add, or delete rules
All rules are to be found under
./src/rules
. Make sure to comment your rules and also link to the full docs to help colleagues reading your code understand what a particular rule does and why it's useful to us.Test your rules locally
To save you a ginormous amount of time, please do not directly push to CI or *gasp*, even push directly to npm without testing. Because testing locally is really easy.
a) Make a build
# To compile TypeScript into a ready-to-use build yarn build
b) Register your package locally
# Register your package for local use yarn link
c) Link it into another local repo
# `cd` into a local repo that will be using this eslint config cd some-package-using-this-config yarn link @scalingfunds/eslint-config-base-ts
d) Try out your new rules
cd some-package-using-this-config yarn lint:ts # this should now use your updated rules
Commit your changes
Please adhere strictly to the Conventional Commits Spec so standard-version can auto-update the version number according to semver and produce a nice CHANGELOG for your fellow developers.
Push your branch
Business as usual from here:
- Push your branch
- Open MR
- Get your code reviewed
- Merge it in
- A new npm release will be produced automatically by CI including semver-adhering version bump plus updated CHANGELOG (given you've adhered to the Conventional Commits Spec)