Skip to content

Commit

Permalink
docs(eslint-plugin): add docs for signal-state-no-arrays-at-root-level (
Browse files Browse the repository at this point in the history
  • Loading branch information
iErKy authored Oct 9, 2024
1 parent 23cf7c4 commit 806c1d1
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,31 @@ signalState should accept a record or dictionary as an input argument.

<!-- Everything above this generated, do not edit -->
<!-- MANUAL-DOC:START -->

## Rule Details

This rule ensure that a Signal State shouldn't accept an array type at the root level.

Examples of **correct** code for this rule:

```ts
const store = withState({ foo: 'bar' });

const store = withState({ arrayAsProperty: ['foo', 'bar'] })

const initialState = {};
const store = signalStore(withState(initialState));
```

Examples of **incorrect** code for this rule:

```ts
const store = withState([1, 2, 3]);

const store = withState([{ foo: 'bar' }]);

const store = withState<string[]>([]);

const initialState = [];
const store = withState(initialState);
```

0 comments on commit 806c1d1

Please sign in to comment.