Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,37 @@ A script for checking compatible licenses is included.

This readme assumes you are using yarn v4. For other package managers the steps should be similar but may vary a little from what is written here.

`yarn add --dev @sofie-automation/code-standard-preset eslint typescript husky lint-staged prettier`
`yarn add --dev @sofie-automation/code-standard-preset`

### Packages
### Automated setup

The easiest way to configure a project is to run the setup CLI, which will install all other required devDependencies and configure the project automatically:

```sh
yarn sofie-code-standard-preset-setup
```

This will:

1. Set the `prettier` field in `package.json` to use the preset's config
2. Add `lint`, `lint:eslint`, `lint:prettier`, `lint:fix`, `license-validate` and `prepare` scripts
3. Set `lint-staged` config
4. Create `eslint.config.mjs` if missing
5. Copy `.editorconfig` from the preset
6. Create `.husky/pre-commit` if missing
7. Install required devDependencies via `yarn add --dev` (`@eslint/js`, `eslint`, `husky`, `lint-staged`, `prettier`, `typescript`)

If any of the above items are already configured to a different value, they will be skipped with a warning. Pass `--force` to overwrite existing values:

```sh
yarn sofie-code-standard-preset-setup --force
```

After running, review and commit the changes, then follow the manual steps below to add any project-specific configuration.

### Manual setup

#### Packages

**Add** the following information to your `package.json`:

Expand Down Expand Up @@ -92,9 +120,10 @@ The parameter to the `generateEslintConfig` contains various option fields that
If you need to add additional rules, you can do so by building off the generated config, such as:

```mjs
import { generateEslintConfig } from '@sofie-automation/code-standard-preset/eslint/main.mjs'
import pluginYaml from 'eslint-plugin-yml'

import { generateEslintConfig } from '@sofie-automation/code-standard-preset/eslint/main.mjs'

const extendedRules = await generateEslintConfig({
ignores: ['client', 'server'],
})
Expand Down
Loading