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

Revert "New config structure docs" #119

Merged
merged 1 commit into from
Nov 9, 2024
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
5 changes: 0 additions & 5 deletions .changeset/little-zebras-pay.md

This file was deleted.

118 changes: 0 additions & 118 deletions CONFIG_EXAMPLES.md

This file was deleted.

89 changes: 0 additions & 89 deletions MIGRATION_GUIDE.md

This file was deleted.

85 changes: 13 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ Universal file structure and project architecture linter.
> [!NOTE]
> The project is in beta and in active development. Some APIs may change.

> [!NOTE]
> Version 0.5.0 introduced a new config file format. We have a codemod to automatically update your config, see the [migration guide](./MIGRATION_GUIDE.md).

## Features
# Features

- Built-in set of rules to validate adherence to [Feature-Sliced Design](https://feature-sliced.design/)
- Watch mode
- Rule configurability

## Installation
# Installation

```bash
npm i -D steiger
```

## Usage
# Usage

```bash
npx steiger ./src
Expand All @@ -34,79 +31,23 @@ To run in watch mode, add `-w`/`--watch` to the command:
npx steiger ./src --watch
```

## Configuration
# Configuration

Steiger is zero-config! If you don't want to disable certain rules, you can safely skip this section.

Steiger is configurable via `cosmiconfig`. That means that you can create a `steiger.config.ts` or `steiger.config.js` file in the root of your project to configure the rules. Import `{ defineConfig } from "steiger"` to get autocompletion.

The config file shape is highly inspired by ESLint's config file, so if you have configured ESLint before, you'll find it easy to configure Steiger.

### Example

```javascript
// ./steiger.config.js
```ts
import { defineConfig } from 'steiger'
import fsd from '@feature-sliced/steiger-plugin'

export default defineConfig([
...fsd.configs.recommended,
{
// disable the `public-api` rule for files in the Shared layer
files: ['./src/shared/**'],
rules: {
'fsd/public-api': 'off',
},

export default defineConfig({
rules: {
'public-api': 'off',
},
])
})
```

> [!TIP]
> If you want Steiger to ignore certain files, add an object like this to the config array:
>
> ```js
> defineConfig([, /* … */ { ignores: ['**/__mocks__/**'] }])
> ```

<details>
<summary>Comprehensive showcase of the config file syntax</summary>

```javascript
// ./steiger.config.ts
import { defineConfig } from 'steiger'
import fsd from '@feature-sliced/steiger-plugin'

export default defineConfig([
...fsd.configs.recommended,
{
// ignore all mock files for all rules
ignores: ['**/__mocks__/**'],
},
{
files: ['./src/shared/**'],
rules: {
// disable public-api rule for files in /shared folder
'fsd/public-api': 'off',
},
},
{
files: ['./src/widgets/**'],
ignores: ['**/discount-offers/**'],
rules: {
// disable no-segmentless-slices rule for all widgets except /discount-offers
'fsd/no-segmentless-slices': 'off',
},
},
])
```
[You can see more examples here](CONFIG_EXAMPLES.md)
</details>

### Migration from 0.4.0

Version 0.5.0 introduced a new config file format. Follow the [instructions](MIGRATION_GUIDE.md) to migrate your config file.

## Rules
# Rules

Currently, Steiger is not extendable with more rules, though that will change in the near future. The built-in rules check for the project's adherence to [Feature-Sliced Design](https://feature-sliced.design/).

Expand Down Expand Up @@ -139,12 +80,12 @@ Currently, Steiger is not extendable with more rules, though that will change in
</tbody>
</table>

## Contribution
# Contribution

Feel free to report an issue or open a discussion. Ensure you read our [Code of Conduct](CODE_OF_CONDUCT.md) first though :)

To get started with the codebase, see our [Contributing guide](CONTRIBUTING.md).

## Legal info
# Legal info

Project licensed under [MIT License](LICENSE.md). [Here's what it means](https://choosealicense.com/licenses/mit/)
Loading