prettier-plugin-multiline-arrays-2 1.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -19
- package/dist/augments/array.d.ts +8 -2
- package/dist/augments/array.js +11 -5
- package/dist/augments/doc.d.ts +2 -2
- package/dist/augments/doc.js +12 -9
- package/dist/augments/string.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -20
- package/dist/options.d.ts +6 -9
- package/dist/options.js +20 -25
- package/dist/plugin-marker.js +1 -1
- package/dist/preprocessing.d.ts +1 -1
- package/dist/preprocessing.js +60 -30
- package/dist/printer/child-docs.d.ts +9 -7
- package/dist/printer/child-docs.js +89 -63
- package/dist/printer/comment-triggers.d.ts +5 -7
- package/dist/printer/comment-triggers.js +104 -134
- package/dist/printer/comments.d.ts +1 -1
- package/dist/printer/comments.js +15 -16
- package/dist/printer/insert-new-lines.d.ts +10 -6
- package/dist/printer/insert-new-lines.js +260 -277
- package/dist/printer/leading-new-line.d.ts +2 -2
- package/dist/printer/leading-new-line.js +2 -1
- package/dist/printer/multiline-array-printer.js +4 -2
- package/dist/printer/original-printer.js +6 -4
- package/dist/printer/supported-node-types.d.ts +1 -1
- package/dist/printer/supported-node-types.js +6 -5
- package/dist/printer/trailing-comma.d.ts +1 -1
- package/dist/printer/trailing-comma.js +1 -1
- package/package.json +56 -29
- package/dist/augments/array.test.d.ts +0 -1
- package/dist/augments/array.test.js +0 -34
- package/dist/options.test.d.ts +0 -1
- package/dist/options.test.js +0 -48
- package/dist/printer/insert-new-lines.test.d.ts +0 -1
- package/dist/printer/insert-new-lines.test.js +0 -36
- package/dist/readme-examples/formatted-with-comments.example.d.ts +0 -3
- package/dist/readme-examples/formatted-with-comments.example.js +0 -16
- package/dist/readme-examples/formatted.example.d.ts +0 -2
- package/dist/readme-examples/formatted.example.js +0 -12
- package/dist/readme-examples/not-formatted.example.d.ts +0 -2
- package/dist/readme-examples/not-formatted.example.js +0 -6
- package/dist/readme-examples/prettier-options.example.d.ts +0 -4
- package/dist/readme-examples/prettier-options.example.js +0 -5
- package/dist/test/babel-ts.test.d.ts +0 -1
- package/dist/test/babel-ts.test.js +0 -10
- package/dist/test/javascript.test.d.ts +0 -1
- package/dist/test/javascript.test.js +0 -702
- package/dist/test/json.test.d.ts +0 -1
- package/dist/test/json.test.js +0 -403
- package/dist/test/json5.test.d.ts +0 -1
- package/dist/test/json5.test.js +0 -210
- package/dist/test/prettier-config.d.ts +0 -2
- package/dist/test/prettier-config.js +0 -12
- package/dist/test/prettier-versions.mock.script.d.ts +0 -1
- package/dist/test/prettier-versions.mock.script.js +0 -123
- package/dist/test/run-tests.mock.d.ts +0 -17
- package/dist/test/run-tests.mock.js +0 -95
- package/dist/test/typescript-tests.mock.d.ts +0 -2
- package/dist/test/typescript-tests.mock.js +0 -1575
- package/dist/test/typescript.test.d.ts +0 -1
- package/dist/test/typescript.test.js +0 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseNode } from "estree";
|
|
2
2
|
export declare function containsLeadingNewline({ nodeLocation, children, originalLines, debug, }: Readonly<{
|
|
3
|
-
nodeLocation: BaseNode["loc"];
|
|
4
3
|
children: (BaseNode | null)[];
|
|
5
|
-
originalLines: string[];
|
|
6
4
|
debug: boolean;
|
|
5
|
+
nodeLocation: BaseNode["loc"];
|
|
6
|
+
originalLines: string[];
|
|
7
7
|
}>): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { arrayFirst } from "ts-extras";
|
|
1
2
|
import { extractTextBetweenRanges } from "../augments/array.js";
|
|
2
3
|
export function containsLeadingNewline({ nodeLocation, children, originalLines, debug, }) {
|
|
3
|
-
const firstElement = children
|
|
4
|
+
const firstElement = arrayFirst(children);
|
|
4
5
|
if (firstElement) {
|
|
5
6
|
const startLocation = nodeLocation?.start;
|
|
6
7
|
if (!startLocation) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assertWrap } from "@augment-vir/assert";
|
|
2
2
|
import estreePluginModule from "prettier/plugins/estree";
|
|
3
|
+
import { safeCastTo } from "ts-extras";
|
|
3
4
|
import { envDebugKey, fillInOptions, } from "../options.js";
|
|
4
5
|
import { printWithMultilineArrays } from "./insert-new-lines.js";
|
|
5
6
|
/**
|
|
@@ -8,7 +9,8 @@ import { printWithMultilineArrays } from "./insert-new-lines.js";
|
|
|
8
9
|
* via the module's exported value.
|
|
9
10
|
*/
|
|
10
11
|
const estreePlugin = estreePluginModule;
|
|
11
|
-
const
|
|
12
|
+
const debugEnvValue = process.env[envDebugKey];
|
|
13
|
+
const debug = Boolean(debugEnvValue);
|
|
12
14
|
export function createMultilineArrayPrinter(basePrinter) {
|
|
13
15
|
return {
|
|
14
16
|
...basePrinter,
|
|
@@ -24,7 +26,7 @@ export function createMultilineArrayPrinter(basePrinter) {
|
|
|
24
26
|
console.info("[multiline-arrays] multilineArrayPrinter.print for node:", path.getNode()?.type);
|
|
25
27
|
}
|
|
26
28
|
const originalOutput = basePrinter.print(path, options, print, args);
|
|
27
|
-
if (options.filepath?.endsWith("package.json") &&
|
|
29
|
+
if (safeCastTo(options.filepath)?.endsWith("package.json") &&
|
|
28
30
|
options.plugins.some((plugin) => typeof plugin === "object" &&
|
|
29
31
|
plugin.name?.includes("prettier-plugin-packagejson"))) {
|
|
30
32
|
return originalOutput;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
const originalPrinterState = {
|
|
2
|
+
value: undefined,
|
|
3
|
+
};
|
|
2
4
|
export function setOriginalPrinter(input) {
|
|
3
|
-
|
|
5
|
+
originalPrinterState.value = input;
|
|
4
6
|
}
|
|
5
7
|
export function getOriginalPrinter() {
|
|
6
|
-
if (!
|
|
8
|
+
if (!originalPrinterState.value) {
|
|
7
9
|
throw new Error("originalPrinter hasn't been defined yet!");
|
|
8
10
|
}
|
|
9
|
-
return
|
|
11
|
+
return originalPrinterState.value;
|
|
10
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ArrayExpression, ArrayPattern, BaseNode, Node } from "estree";
|
|
2
2
|
type TSTupleType = BaseNode & {
|
|
3
|
-
type: "TSTupleType";
|
|
4
3
|
elementTypes: (BaseNode | null)[];
|
|
4
|
+
type: "TSTupleType";
|
|
5
5
|
};
|
|
6
6
|
export type ArrayLikeNode = ArrayExpression | ArrayPattern | TSTupleType;
|
|
7
7
|
export declare function isArrayLikeNode(node: Node): boolean;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { setHas } from "ts-extras";
|
|
2
|
+
const arrayLikeNodeTypes = new Set([
|
|
2
3
|
"ArrayExpression",
|
|
3
4
|
"ArrayPattern",
|
|
4
|
-
// this expression type isn't accounted for in the types, but I saw it used in another plugin
|
|
5
|
-
"TupleExpression",
|
|
6
5
|
"TSTupleType",
|
|
7
|
-
|
|
6
|
+
// This expression type isn't accounted for in the types, but I saw it used in another plugin
|
|
7
|
+
"TupleExpression",
|
|
8
|
+
]);
|
|
8
9
|
export function isArrayLikeNode(node) {
|
|
9
|
-
return arrayLikeNodeTypes
|
|
10
|
+
return setHas(arrayLikeNodeTypes, node.type);
|
|
10
11
|
}
|
|
11
12
|
export function getArrayLikeElements(node) {
|
|
12
13
|
if (node.type === "TSTupleType") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseNode } from "estree";
|
|
2
2
|
export declare function containsTrailingComma({ nodeLocation, children, originalLines, }: Readonly<{
|
|
3
|
-
nodeLocation: BaseNode["loc"];
|
|
4
3
|
children: (BaseNode | null)[];
|
|
4
|
+
nodeLocation: BaseNode["loc"];
|
|
5
5
|
originalLines: string[];
|
|
6
6
|
}>): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractTextBetweenRanges } from "../augments/array.js";
|
|
2
2
|
export function containsTrailingComma({ nodeLocation, children, originalLines, }) {
|
|
3
|
-
const lastElement = children
|
|
3
|
+
const [lastElement] = children.toReversed();
|
|
4
4
|
if (lastElement) {
|
|
5
5
|
const startLocation = lastElement.loc?.end;
|
|
6
6
|
if (!startLocation) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package.json",
|
|
3
3
|
"name": "prettier-plugin-multiline-arrays-2",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"description": "Prettier plugin to force array elements to wrap onto new lines.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"array",
|
|
@@ -45,47 +45,67 @@
|
|
|
45
45
|
"README.md"
|
|
46
46
|
],
|
|
47
47
|
"scripts": {
|
|
48
|
-
"build": "tsc -p tsconfig.build.json",
|
|
49
|
-
"changelog:generate": "git-cliff --config cliff.toml --output CHANGELOG.md",
|
|
50
|
-
"changelog:preview": "git-cliff --config cliff.toml --unreleased",
|
|
51
|
-
"changelog:release-notes": "git-cliff --config cliff.toml --current --strip all",
|
|
48
|
+
"build": "node -e \"const fs = require('node:fs'); fs.rmSync('dist', {recursive: true, force: true});\" && npx tsc -p tsconfig.build.json",
|
|
49
|
+
"changelog:generate": "npx git-cliff --config cliff.toml --output CHANGELOG.md",
|
|
50
|
+
"changelog:preview": "npx git-cliff --config cliff.toml --unreleased",
|
|
51
|
+
"changelog:release-notes": "npx git-cliff --config cliff.toml --current --strip all",
|
|
52
52
|
"clean": "node -e \"const fs = require('node:fs'); fs.rmSync('dist', {recursive: true, force: true}); fs.rmSync('coverage', {recursive: true, force: true});\"",
|
|
53
|
-
"format": "prettier . --write",
|
|
54
|
-
"format:check": "prettier . --check",
|
|
55
|
-
"lint": "eslint . --cache --cache-strategy content --cache-location .cache/.eslintcache",
|
|
56
|
-
"lint:fix": "eslint . --cache --cache-strategy content --cache-location .cache/.eslintcache --fix",
|
|
57
|
-
"lint:
|
|
58
|
-
"lint:
|
|
59
|
-
"lint:
|
|
53
|
+
"format": "npx prettier . --write",
|
|
54
|
+
"format:check": "npx prettier . --check",
|
|
55
|
+
"lint": "npx eslint . --cache --cache-strategy content --cache-location .cache/.eslintcache",
|
|
56
|
+
"lint:fix": "npx eslint . --cache --cache-strategy content --cache-location .cache/.eslintcache --fix",
|
|
57
|
+
"lint:gitleaks": "gitleaks dir --config .gitleaks.toml .",
|
|
58
|
+
"lint:package": "npx publint",
|
|
59
|
+
"lint:package-json": "npx npmPkgJsonLint . --config .npmpackagejsonlintrc.json",
|
|
60
|
+
"lint:prettier": "npx prettier . --log-level warn --cache --cache-location=.cache/.prettier-cache --cache-strategy=content --check",
|
|
61
|
+
"lint:prettier:fix": "npx prettier . --log-level warn --cache --cache-location=.cache/.prettier-cache --cache-strategy=content --write",
|
|
62
|
+
"lint:remark": "npx remark . --frail --ignore-path .remarkignore",
|
|
63
|
+
"lint:remark:fix": "npx remark . --ignore-path .remarkignore --output",
|
|
64
|
+
"lint:yamllint": "yamllint -c .yamllint .",
|
|
60
65
|
"prepack": "npm run build",
|
|
61
66
|
"release:check": "npm run release:verify && npm pack --dry-run",
|
|
62
|
-
"release:verify": "npm run build && npm run typecheck && npm run lint && npm run lint:prettier && npm run lint:package && npm run
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"test
|
|
66
|
-
"
|
|
67
|
-
"
|
|
67
|
+
"release:verify": "npm run build && npm run typecheck && npm run lint && npm run lint:prettier && npm run lint:package && npm run lint:package-json && npm run lint:remark && npm run lint:yamllint && npm run test:coverage && npm run test:prettier-latest",
|
|
68
|
+
"sync:node-version-files": "node scripts/sync-node-version-files.mjs",
|
|
69
|
+
"sync:peer-prettier-range": "node scripts/sync-peer-prettier-range.mjs",
|
|
70
|
+
"test": "npx vitest run --coverage",
|
|
71
|
+
"test:ci": "npx vitest run --coverage --reporter=default --reporter=junit --outputFile.junit=coverage/test-report.junit.xml",
|
|
72
|
+
"test:coverage": "npx vitest run --coverage",
|
|
73
|
+
"test:coverage:open": "npm run test:coverage && node -e \"import('node:child_process').then(({spawn}) => spawn(process.platform === 'win32' ? 'cmd' : 'xdg-open', process.platform === 'win32' ? ['/c', 'start', '', 'coverage/index.html'] : ['coverage/index.html'], {stdio: 'ignore', detached: true}))\"",
|
|
74
|
+
"test:prettier-latest": "npm install --min-release-age=0 --package-lock=false --no-save --save-dev prettier@latest && npm test",
|
|
75
|
+
"test:versions": "npm run build && npx tsx test/prettier-versions.mock.script.ts",
|
|
76
|
+
"test:watch": "npx vitest",
|
|
77
|
+
"typecheck": "npx tsc -p tsconfig.json --noEmit",
|
|
78
|
+
"update-actions": "npx actions-up --yes --style sha --quiet",
|
|
79
|
+
"update-all": "npm run update-actions && npm run update-deps",
|
|
80
|
+
"update-deps": "npx ncu -i --install never && npm update --force && npm install --force && npm run sync:peer-prettier-range && npm run sync:node-version-files"
|
|
68
81
|
},
|
|
69
82
|
"dependencies": {
|
|
70
|
-
"@augment-vir/assert": "^
|
|
71
|
-
"@augment-vir/common": "^
|
|
72
|
-
"proxy-vir": "^2.0.3"
|
|
83
|
+
"@augment-vir/assert": "^32.0.0",
|
|
84
|
+
"@augment-vir/common": "^32.0.0",
|
|
85
|
+
"proxy-vir": "^2.0.3",
|
|
86
|
+
"ts-extras": "^1.2.0"
|
|
73
87
|
},
|
|
74
88
|
"devDependencies": {
|
|
75
|
-
"@augment-vir/
|
|
89
|
+
"@augment-vir/node": "^32.0.0",
|
|
76
90
|
"@eslint/js": "^10.0.1",
|
|
91
|
+
"@microsoft/tsdoc-config": "^0.18.1",
|
|
77
92
|
"@types/esprima": "^4.0.6",
|
|
78
93
|
"@types/estree": "^1.0.9",
|
|
79
|
-
"@types/node": "^26.
|
|
94
|
+
"@types/node": "^26.1.0",
|
|
80
95
|
"@types/semver": "^7.7.1",
|
|
96
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
81
97
|
"cspell": "^10.0.1",
|
|
82
|
-
"
|
|
83
|
-
"eslint
|
|
98
|
+
"date-vir": "^8.6.2",
|
|
99
|
+
"eslint": "^10.6.0",
|
|
100
|
+
"eslint-config-nick2bad4u": "^3.3.1",
|
|
84
101
|
"git-cliff": "^2.13.1",
|
|
85
|
-
"
|
|
102
|
+
"gitleaks-config-nick2bad4u": "^1.0.3",
|
|
103
|
+
"npm-check-updates": "^22.2.9",
|
|
104
|
+
"npm-package-json-lint": "^10.4.1",
|
|
105
|
+
"npm-package-json-lint-config-nick2bad4u": "^1.0.4",
|
|
86
106
|
"object-shape-tester": "^6.14.0",
|
|
87
107
|
"prettier": "^3.9.4",
|
|
88
|
-
"prettier-config-nick2bad4u": "^1.0.
|
|
108
|
+
"prettier-config-nick2bad4u": "^1.0.22",
|
|
89
109
|
"prettier-plugin-interpolated-html-tags": "^2.0.1",
|
|
90
110
|
"prettier-plugin-jsdoc": "^1.8.1",
|
|
91
111
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
@@ -93,9 +113,16 @@
|
|
|
93
113
|
"prettier-plugin-sort-json": "^4.2.0",
|
|
94
114
|
"prettier-plugin-toml": "^2.0.6",
|
|
95
115
|
"publint": "^0.3.21",
|
|
116
|
+
"remark": "^15.0.1",
|
|
117
|
+
"remark-cli": "^12.0.1",
|
|
118
|
+
"remark-config-nick2bad4u": "^1.1.3",
|
|
96
119
|
"semver": "^7.8.5",
|
|
97
|
-
"
|
|
98
|
-
"
|
|
120
|
+
"tsdoc-config-nick2bad4u": "^1.0.6",
|
|
121
|
+
"tsx": "^4.23.0",
|
|
122
|
+
"typescript": "^6.0.3",
|
|
123
|
+
"vite": "^8.1.3",
|
|
124
|
+
"vitest": "^4.1.9",
|
|
125
|
+
"yamllint-config-nick2bad4u": "^1.1.1"
|
|
99
126
|
},
|
|
100
127
|
"peerDependencies": {
|
|
101
128
|
"prettier": "^3.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { assert } from '@augment-vir/assert';
|
|
2
|
-
import { describe, it } from '@augment-vir/test';
|
|
3
|
-
import { extractTextBetweenRanges } from './array.js';
|
|
4
|
-
describe(extractTextBetweenRanges.name, () => {
|
|
5
|
-
it('extracts text from multiple lines', () => {
|
|
6
|
-
assert.strictEquals(extractTextBetweenRanges([
|
|
7
|
-
'a b c d e f g h i j k l m n',
|
|
8
|
-
'o p q r s',
|
|
9
|
-
't u v w x y',
|
|
10
|
-
'z',
|
|
11
|
-
], {
|
|
12
|
-
start: {
|
|
13
|
-
line: 0,
|
|
14
|
-
column: 4,
|
|
15
|
-
},
|
|
16
|
-
end: {
|
|
17
|
-
line: 2,
|
|
18
|
-
column: 3,
|
|
19
|
-
},
|
|
20
|
-
}), ' d e f g h i j k l m n\no p q r s\nt u');
|
|
21
|
-
});
|
|
22
|
-
it('extracts text from the same line', () => {
|
|
23
|
-
assert.strictEquals(extractTextBetweenRanges(['a b c d e f g h i j k l m n'], {
|
|
24
|
-
start: {
|
|
25
|
-
line: 0,
|
|
26
|
-
column: 4,
|
|
27
|
-
},
|
|
28
|
-
end: {
|
|
29
|
-
line: 0,
|
|
30
|
-
column: 7,
|
|
31
|
-
},
|
|
32
|
-
}), ' d');
|
|
33
|
-
});
|
|
34
|
-
});
|
package/dist/options.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/options.test.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { describe, itCases } from '@augment-vir/test';
|
|
2
|
-
import { optionPropertyValidators } from './options.js';
|
|
3
|
-
describe('optionPropertyValidators', () => {
|
|
4
|
-
itCases((optionType, input) => {
|
|
5
|
-
return optionPropertyValidators[optionType](input);
|
|
6
|
-
}, [
|
|
7
|
-
{
|
|
8
|
-
it: 'allows -1 for multilineArraysWrapThreshold',
|
|
9
|
-
inputs: [
|
|
10
|
-
'multilineArraysWrapThreshold',
|
|
11
|
-
-1,
|
|
12
|
-
],
|
|
13
|
-
expect: true,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
it: 'allows numbers for multilineArraysWrapThreshold',
|
|
17
|
-
inputs: [
|
|
18
|
-
'multilineArraysWrapThreshold',
|
|
19
|
-
63,
|
|
20
|
-
],
|
|
21
|
-
expect: true,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
it: 'rejects strings for multilineArraysWrapThreshold',
|
|
25
|
-
inputs: [
|
|
26
|
-
'multilineArraysWrapThreshold',
|
|
27
|
-
'63',
|
|
28
|
-
],
|
|
29
|
-
expect: false,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
it: 'allows numeric strings for multilineArraysLinePattern',
|
|
33
|
-
inputs: [
|
|
34
|
-
'multilineArraysLinePattern',
|
|
35
|
-
'63',
|
|
36
|
-
],
|
|
37
|
-
expect: true,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
it: 'rejects non-numeric strings for multilineArraysLinePattern',
|
|
41
|
-
inputs: [
|
|
42
|
-
'multilineArraysLinePattern',
|
|
43
|
-
'63 keys',
|
|
44
|
-
],
|
|
45
|
-
expect: false,
|
|
46
|
-
},
|
|
47
|
-
]);
|
|
48
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { assert } from '@augment-vir/assert';
|
|
2
|
-
import { describe, it } from '@augment-vir/test';
|
|
3
|
-
import { doc } from 'prettier';
|
|
4
|
-
import { insertLinesIntoArray } from './insert-new-lines.js';
|
|
5
|
-
describe(insertLinesIntoArray.name, () => {
|
|
6
|
-
it('handles comment-only array doc emitted by Prettier GitHub Issue #75', () => {
|
|
7
|
-
const commentOnlyArrayDoc = [
|
|
8
|
-
'[',
|
|
9
|
-
[
|
|
10
|
-
doc.builders.indent([
|
|
11
|
-
doc.builders.softline,
|
|
12
|
-
[
|
|
13
|
-
'// "source.fixAll.eslint",',
|
|
14
|
-
[
|
|
15
|
-
doc.builders.hardline,
|
|
16
|
-
doc.builders.breakParent,
|
|
17
|
-
],
|
|
18
|
-
'// "source.fixAll.prettier",',
|
|
19
|
-
],
|
|
20
|
-
]),
|
|
21
|
-
[
|
|
22
|
-
doc.builders.hardline,
|
|
23
|
-
doc.builders.breakParent,
|
|
24
|
-
],
|
|
25
|
-
],
|
|
26
|
-
']',
|
|
27
|
-
];
|
|
28
|
-
assert.strictEquals(insertLinesIntoArray({
|
|
29
|
-
inputDoc: commentOnlyArrayDoc,
|
|
30
|
-
manualWrap: false,
|
|
31
|
-
lineCounts: [],
|
|
32
|
-
wrapThreshold: Infinity,
|
|
33
|
-
debug: false,
|
|
34
|
-
}), commentOnlyArrayDoc);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// prettier-multiline-arrays-next-line-pattern: 2 1
|
|
2
|
-
export const linePatternArray = [
|
|
3
|
-
'a', 'b',
|
|
4
|
-
'c',
|
|
5
|
-
'd', 'e',
|
|
6
|
-
];
|
|
7
|
-
// Even if this example had a leading new line or a trailing comma, it won't wrap because the
|
|
8
|
-
// comment overrides that behavior.
|
|
9
|
-
// prettier-multiline-arrays-next-threshold: 10
|
|
10
|
-
export const highThresholdArray = ['a', 'b', 'c', 'd', 'e'];
|
|
11
|
-
// this array doesn't fully wrap even though it exceeded the column width because the
|
|
12
|
-
// "next-line-pattern" comment overrides Prettier's column width wrapping
|
|
13
|
-
// prettier-multiline-arrays-next-line-pattern: 100
|
|
14
|
-
export const superHighThresholdArray = [
|
|
15
|
-
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
|
|
16
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { describe } from '@augment-vir/test';
|
|
2
|
-
import { runTests } from './run-tests.mock.js';
|
|
3
|
-
import { typescriptTests } from './typescript-tests.mock.js';
|
|
4
|
-
describe('babel-ts multiline array formatting', () => {
|
|
5
|
-
runTests({
|
|
6
|
-
extension: '.ts',
|
|
7
|
-
tests: typescriptTests,
|
|
8
|
-
parser: 'babel-ts',
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|