Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README to give install and usage instructions. #17

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,53 @@ A collection of lint, format, and build configs used at Fauna for TypeScript pro
- `eslint-formatter.js`, a custom eslint output formatter intended for estimating the cost of adding new rules to an eslint config. From a consumer of `@fauna/typescript`, run it like `npx eslint --format ./node_modules/@fauna/typescript/scripts/eslint-formatter.js .`.
- `version-bump.js`, a script intended for use in CI environments to automatically version bump a npm package. Useful for packages that should be versioned and deployed on every merge to `main`.

## Workflows
## Usage

### Development
Develop on this package by running `npm install && npm link`. Then, navigate to a package that depends on this project and run `npm link @fauna/typescript`. [npm link](https://docs.npmjs.com/cli/v10/commands/npm-link) builds a symlink from the node_modules directory of the dependent package to `@fauna/typescript`, allowing you to develop locally in real time. When done, run `npm unlink @fauna/typescript` from any directory.
### Install
#### I use npm
```
npm install --save-dev @fauna/typescript
```

#### I use yarn
```
yarn add -D @fauna/typescript
```

## Configure
### ES Lint Config
In `eslint.config.mjs` put:
cleve-fauna marked this conversation as resolved.
Show resolved Hide resolved

```(javascript)
import { config as defaultConfig } from "@fauna/typescript/config/js/eslint.config.js";

export default [
...defaultConfig,
// ... any customizations you'd like
cleve-fauna marked this conversation as resolved.
Show resolved Hide resolved
];
```
### Prettier Config

cleve-fauna marked this conversation as resolved.
Show resolved Hide resolved
```(javascript)
import basePrettierConfig from "@fauna/typescript/config/prettierrc.js";

/**
* @type {import("prettier").Config}
*/
const config = {
...basePrettierConfig,
cleve-fauna marked this conversation as resolved.
Show resolved Hide resolved
};

export default config;
```

## Script
You can then write scripts in your `package.json` such as:

```(json)
"scripts": {
"lint": "eslint . --fix",
"format": "prettier -w --log-level silent .",
"format:check": "prettier -c ."
}
```
Loading