Skip to content

Commit fe7725b

Browse files
committed
[patch] fix messed up line endings without trailing commas
GitHub: fixes #41
1 parent e7ee199 commit fe7725b

24 files changed

+666
-576
lines changed

README.md

+11-31
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Add this config to your prettierrc file:
1313
<!-- example-link: src/readme-examples/prettier-options.example.ts -->
1414

1515
```TypeScript
16-
module.exports = {
16+
export default {
1717
plugins: [
1818
'prettier-plugin-multiline-arrays',
1919
],
@@ -26,18 +26,18 @@ The order of your plugins array is very important, so if you have other plugins
2626

2727
This plugin provides two new options for your Prettier config:
2828

29-
- **`multilineArraysWrapThreshold`**: This should be set to a single number which controls when arrays wrap. If an array has _more_ elements than the number specified here, it will be forced to wrap. This option defaults to `-1`, which indicates that no automatic wrapping will take place. Example JSON: `"multilineArraysWrapThreshold": 3,`. To override this option for an individual array, precede the array with a comment like so: `// prettier-multiline-arrays-next-threshold: 4`.
30-
- **`multilineArraysLinePattern`**: This should be set to a string which contains a space separated list of numbers. These numbers allow fine grained control over how many elements appear in each line. The pattern will repeat if an array has more elements than the pattern. See the `Examples` section for how this works. This defaults to just `1`, which indicates all array lines have just a single element. Example: `"multilineArraysLinePattern": "2 1"`, which means the first line will have 2 elements, the second will have 1, the third will have 2, the fourth will have 1, and so on. If set, _this option overrides Prettier's default wrapping; multiple elements on one line will not be wrapped even if they don't fit within the column count._ To override this option for an array, precede the array with a comment like so: `// prettier-multiline-arrays-next-line-pattern: 2 1`.
29+
- **`multilineArraysWrapThreshold`**: This should be set to a single number which controls when arrays wrap. If an array has _more_ elements than the number specified here, it will be forced to wrap. This option defaults to `-1`, which indicates that no automatic wrapping will take place. Example JSON: `"multilineArraysWrapThreshold": 3,`. To override this option for an individual array, precede the array with a comment like so: `// prettier-multiline-arrays-next-threshold: 4`.
30+
- **`multilineArraysLinePattern`**: This should be set to a string which contains a space separated list of numbers. These numbers allow fine grained control over how many elements appear in each line. The pattern will repeat if an array has more elements than the pattern. See the `Examples` section for how this works. This defaults to just `1`, which indicates all array lines have just a single element. Example: `"multilineArraysLinePattern": "2 1"`, which means the first line will have 2 elements, the second will have 1, the third will have 2, the fourth will have 1, and so on. If set, _this option overrides Prettier's default wrapping; multiple elements on one line will not be wrapped even if they don't fit within the column count._ To override this option for an array, precede the array with a comment like so: `// prettier-multiline-arrays-next-line-pattern: 2 1`.
3131

3232
## Comment overrides
3333

34-
- Add a comment starting with `prettier-multiline-arrays-next-threshold:` followed by a single number to control `multilineArraysWrapThreshold` for an array on the next line.
35-
- Add a comment starting with `prettier-multiline-arrays-next-line-pattern:` followed by a pattern of numbers to control `multilineArraysLinePattern` for an array on the next line.
34+
- Add a comment starting with `prettier-multiline-arrays-next-threshold:` followed by a single number to control `multilineArraysWrapThreshold` for an array on the next line.
35+
- Add a comment starting with `prettier-multiline-arrays-next-line-pattern:` followed by a pattern of numbers to control `multilineArraysLinePattern` for an array on the next line.
3636

3737
To set a comment override for all arrays in a file following the comment, change `next` to `set`. Like so:
3838

39-
- `prettier-multiline-arrays-set-threshold: 5`
40-
- `prettier-multiline-arrays-set-line-pattern: 2 1 3`
39+
- `prettier-multiline-arrays-set-threshold: 5`
40+
- `prettier-multiline-arrays-set-line-pattern: 2 1 3`
4141

4242
To later undo a `set` comment, use `prettier-multiline-arrays-reset`, which resets the options to whatever you have set in prettierrc, or the default values.
4343

@@ -52,7 +52,7 @@ The precedence of forcing wrapping goes as follows:
5252

5353
## Examples
5454

55-
- Not formatted:
55+
- Not formatted:
5656

5757
<!-- example-link: src/readme-examples/not-formatted.example.ts -->
5858

@@ -65,27 +65,7 @@ The precedence of forcing wrapping goes as follows:
6565
'a', 'b', 'c', 'd', 'e'] // note the leading new line which forces a wrap
6666
```
6767

68-
- Removing the `prettier-ignore` comments leads to formatting like this (with the default options):
69-
70-
<!-- example-link: src/readme-examples/formatted.example.ts -->
71-
72-
```TypeScript
73-
export const myArray = [
74-
'a',
75-
'b',
76-
'c',
77-
]; // note the trailing comma which forces a wrap
78-
79-
export const myCustomArray = [
80-
'a',
81-
'b',
82-
'c',
83-
'd',
84-
'e',
85-
]; // note the leading new line which forces a wrap
86-
```
87-
88-
- Use comment overrides to affect wrapping:
68+
- Use comment overrides to affect wrapping:
8969

9070
<!-- example-link: src/readme-examples/formatted-with-comments.example.ts -->
9171

@@ -126,5 +106,5 @@ Tested to be compatible with the following plugins. It is likely compatible with
126106

127107
### Debugging
128108

129-
- Set the `MULTILINE_DEBUG` environment variable to something truthy before formatting to get extra debug output when formatting.
130-
- To debug in browser dev tools, run `npm run test:debug` and open Chrome's dev tools.
109+
- Set the `MULTILINE_DEBUG` environment variable to something truthy before formatting to get extra debug output when formatting.
110+
- To debug in browser dev tools, run `npm run test:debug` and open Chrome's dev tools.

configs/c8.config.json

-19
This file was deleted.

configs/dep-cruiser.config.cts

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ const baseConfig = defineConfig({
77
'no-orphans': {
88
from: [
99
'src/index.ts',
10+
'.example.ts',
11+
],
12+
},
13+
'no-duplicate-dep-types': {
14+
to: [
15+
'prettier',
1016
],
1117
},
1218
},

configs/typedoc.config.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {baseTypedocConfig} from '@virmator/docs/configs/typedoc.config.base';
2+
import {join, resolve} from 'path';
3+
import type {TypeDocOptions} from 'typedoc';
4+
5+
const repoRoot = resolve(import.meta.dirname, '..');
6+
const indexTsFile = join(repoRoot, 'src', 'index.ts');
7+
8+
export const typeDocConfig: Partial<TypeDocOptions> = {
9+
...baseTypedocConfig,
10+
out: join(repoRoot, 'docs-dist'),
11+
entryPoints: [
12+
indexTsFile,
13+
],
14+
intentionallyNotExported: [],
15+
requiredToBeDocumented: [],
16+
emit: 'none',
17+
};

0 commit comments

Comments
 (0)