dorian 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +15 -0
  3. data/.github/workflows/ci.yml +38 -0
  4. data/.gitignore +30 -0
  5. data/.node-version +1 -0
  6. data/.prettierignore +2 -0
  7. data/.rubocop.yml +129 -0
  8. data/.ruby-version +1 -0
  9. data/.tool-versions +3 -0
  10. data/Gemfile +20 -0
  11. data/Gemfile.lock +186 -0
  12. data/LICENSE +19 -0
  13. data/README.md +24 -0
  14. data/VERSION +1 -1
  15. data/bin/bundle +123 -0
  16. data/bin/bundle-audit +31 -0
  17. data/bin/bundler-audit +31 -0
  18. data/bin/rspec +31 -0
  19. data/bin/rubocop +31 -0
  20. data/dorian.gemspec +35 -0
  21. data/lib/dorian/bin.rb +739 -81
  22. data/package-lock.json +39 -0
  23. data/package.json +11 -0
  24. data/samples/books.json +33 -0
  25. data/samples/books.jsonl +3 -0
  26. data/samples/config.yml +27 -0
  27. data/samples/config_2.yml +22 -0
  28. data/samples/maths.js +1 -0
  29. data/samples/numbers.raw +10 -0
  30. data/samples/people.csv +6 -0
  31. data/samples/people.yml +28 -0
  32. data/samples/query.sql +7 -0
  33. data/samples/user.json +31 -0
  34. data/spec/dorian_spec.rb +276 -0
  35. data/spec/spec_helper.rb +3 -0
  36. data/vendor/groovy-beautify/LICENSE.MD +21 -0
  37. data/vendor/groovy-beautify/README.md +65 -0
  38. data/vendor/groovy-beautify/dist/__tests__/index.test.d.ts +1 -0
  39. data/vendor/groovy-beautify/dist/cjs/index.js +573 -0
  40. data/vendor/groovy-beautify/dist/cjs/package.json +3 -0
  41. data/vendor/groovy-beautify/dist/es/index.js +682 -0
  42. data/vendor/groovy-beautify/dist/es/package.json +3 -0
  43. data/vendor/groovy-beautify/dist/formatter/FormatRule.d.ts +14 -0
  44. data/vendor/groovy-beautify/dist/formatter/Formatter.d.ts +11 -0
  45. data/vendor/groovy-beautify/dist/formatter/GroovyFormatRules.d.ts +3 -0
  46. data/vendor/groovy-beautify/dist/formatter/__tests__/formatter.test.d.ts +1 -0
  47. data/vendor/groovy-beautify/dist/index.d.ts +5 -0
  48. data/vendor/groovy-beautify/dist/parser/GroovyParseRules.d.ts +3 -0
  49. data/vendor/groovy-beautify/dist/parser/ParseRule.d.ts +23 -0
  50. data/vendor/groovy-beautify/dist/parser/Parser.d.ts +29 -0
  51. data/vendor/groovy-beautify/dist/parser/__tests__/parser.test.d.ts +1 -0
  52. data/vendor/groovy-beautify/dist/parser/types.d.ts +6 -0
  53. data/vendor/groovy-beautify/dist/utils/text.d.ts +4 -0
  54. data/vendor/groovy-beautify/package.json +55 -0
  55. data/vendor/prettier/LICENSE +4379 -0
  56. data/vendor/prettier/README.md +109 -0
  57. data/vendor/prettier/bin/prettier.cjs +71 -0
  58. data/vendor/prettier/doc.d.ts +243 -0
  59. data/vendor/prettier/doc.js +1545 -0
  60. data/vendor/prettier/doc.mjs +1503 -0
  61. data/vendor/prettier/index.cjs +825 -0
  62. data/vendor/prettier/index.d.ts +941 -0
  63. data/vendor/prettier/index.mjs +25899 -0
  64. data/vendor/prettier/internal/cli.mjs +4366 -0
  65. data/vendor/prettier/package.json +198 -0
  66. data/vendor/prettier/plugins/acorn.d.ts +6 -0
  67. data/vendor/prettier/plugins/acorn.js +6618 -0
  68. data/vendor/prettier/plugins/acorn.mjs +6456 -0
  69. data/vendor/prettier/plugins/angular.d.ts +8 -0
  70. data/vendor/prettier/plugins/angular.js +2435 -0
  71. data/vendor/prettier/plugins/angular.mjs +2375 -0
  72. data/vendor/prettier/plugins/babel.d.ts +18 -0
  73. data/vendor/prettier/plugins/babel.js +14271 -0
  74. data/vendor/prettier/plugins/babel.mjs +13986 -0
  75. data/vendor/prettier/plugins/estree.d.ts +1 -0
  76. data/vendor/prettier/plugins/estree.js +9487 -0
  77. data/vendor/prettier/plugins/estree.mjs +9279 -0
  78. data/vendor/prettier/plugins/flow.d.ts +5 -0
  79. data/vendor/prettier/plugins/flow.js +51477 -0
  80. data/vendor/prettier/plugins/flow.mjs +51219 -0
  81. data/vendor/prettier/plugins/glimmer.d.ts +5 -0
  82. data/vendor/prettier/plugins/glimmer.js +8534 -0
  83. data/vendor/prettier/plugins/glimmer.mjs +8421 -0
  84. data/vendor/prettier/plugins/graphql.d.ts +5 -0
  85. data/vendor/prettier/plugins/graphql.js +2421 -0
  86. data/vendor/prettier/plugins/graphql.mjs +2347 -0
  87. data/vendor/prettier/plugins/html.d.ts +8 -0
  88. data/vendor/prettier/plugins/html.js +8182 -0
  89. data/vendor/prettier/plugins/html.mjs +8077 -0
  90. data/vendor/prettier/plugins/markdown.d.ts +7 -0
  91. data/vendor/prettier/plugins/markdown.js +9068 -0
  92. data/vendor/prettier/plugins/markdown.mjs +8977 -0
  93. data/vendor/prettier/plugins/meriyah.d.ts +5 -0
  94. data/vendor/prettier/plugins/meriyah.js +5953 -0
  95. data/vendor/prettier/plugins/meriyah.mjs +5800 -0
  96. data/vendor/prettier/plugins/postcss.d.ts +7 -0
  97. data/vendor/prettier/plugins/postcss.js +9244 -0
  98. data/vendor/prettier/plugins/postcss.mjs +9046 -0
  99. data/vendor/prettier/plugins/typescript.d.ts +5 -0
  100. data/vendor/prettier/plugins/typescript.js +38058 -0
  101. data/vendor/prettier/plugins/typescript.mjs +37732 -0
  102. data/vendor/prettier/plugins/yaml.d.ts +5 -0
  103. data/vendor/prettier/plugins/yaml.js +7425 -0
  104. data/vendor/prettier/plugins/yaml.mjs +7329 -0
  105. data/vendor/prettier/standalone.d.ts +33 -0
  106. data/vendor/prettier/standalone.js +3984 -0
  107. data/vendor/prettier/standalone.mjs +3938 -0
  108. data/vendor/sql-formatter.js +18762 -0
  109. metadata +205 -2
@@ -0,0 +1,109 @@
1
+ [![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)](https://prettier.io)
2
+
3
+ <h2 align="center">Opinionated Code Formatter</h2>
4
+
5
+ <p align="center">
6
+ <em>
7
+ JavaScript
8
+ · TypeScript
9
+ · Flow
10
+ · JSX
11
+ · JSON
12
+ </em>
13
+ <br />
14
+ <em>
15
+ CSS
16
+ · SCSS
17
+ · Less
18
+ </em>
19
+ <br />
20
+ <em>
21
+ HTML
22
+ · Vue
23
+ · Angular
24
+ </em>
25
+ <br />
26
+ <em>
27
+ GraphQL
28
+ · Markdown
29
+ · YAML
30
+ </em>
31
+ <br />
32
+ <em>
33
+ <a href="https://prettier.io/docs/en/plugins.html">
34
+ Your favorite language?
35
+ </a>
36
+ </em>
37
+ </p>
38
+
39
+ <p align="center">
40
+ <a href="https://github.com/prettier/prettier/actions?query=workflow%3AProd+branch%3Amain">
41
+ <img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/prod-test.yml?label=Prod&style=flat-square"></a>
42
+ <a href="https://github.com/prettier/prettier/actions?query=workflow%3ADev+branch%3Amain">
43
+ <img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/dev-test.yml?label=Dev&style=flat-square"></a>
44
+ <a href="https://github.com/prettier/prettier/actions?query=workflow%3ALint+branch%3Amain">
45
+ <img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/lint.yml?label=Lint&style=flat-square"></a>
46
+ <a href="https://codecov.io/gh/prettier/prettier">
47
+ <img alt="Codecov Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a>
48
+ <a href="https://twitter.com/acdlite/status/974390255393505280">
49
+ <img alt="Blazing Fast" src="https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?style=flat-square"></a>
50
+ <br/>
51
+ <a href="https://www.npmjs.com/package/prettier">
52
+ <img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square"></a>
53
+ <a href="https://www.npmjs.com/package/prettier">
54
+ <img alt="weekly downloads from npm" src="https://img.shields.io/npm/dw/prettier.svg?style=flat-square"></a>
55
+ <a href="#badge">
56
+ <img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
57
+ <a href="https://twitter.com/PrettierCode">
58
+ <img alt="Follow Prettier on Twitter" src="https://img.shields.io/badge/%40PrettierCode-9f9f9f?style=flat-square&logo=x&labelColor=555"></a>
59
+ </p>
60
+
61
+ ## Intro
62
+
63
+ Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
64
+
65
+ ### Input
66
+
67
+ <!-- prettier-ignore -->
68
+ ```js
69
+ foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
70
+ ```
71
+
72
+ ### Output
73
+
74
+ ```js
75
+ foo(
76
+ reallyLongArg(),
77
+ omgSoManyParameters(),
78
+ IShouldRefactorThis(),
79
+ isThereSeriouslyAnotherOne(),
80
+ );
81
+ ```
82
+
83
+ Prettier can be run [in your editor](https://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
84
+
85
+ ---
86
+
87
+ **[Documentation](https://prettier.io/docs/en/)**
88
+
89
+ <!-- prettier-ignore -->
90
+ [Install](https://prettier.io/docs/en/install.html) ·
91
+ [Options](https://prettier.io/docs/en/options.html) ·
92
+ [CLI](https://prettier.io/docs/en/cli.html) ·
93
+ [API](https://prettier.io/docs/en/api.html)
94
+
95
+ **[Playground](https://prettier.io/playground/)**
96
+
97
+ ---
98
+
99
+ ## Badge
100
+
101
+ Show the world you're using _Prettier_ → [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
102
+
103
+ ```md
104
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
105
+ ```
106
+
107
+ ## Contributing
108
+
109
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __commonJS = function (cb, mod) {
5
+ return function __require() {
6
+ return (
7
+ mod ||
8
+ (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
9
+ mod.exports
10
+ );
11
+ };
12
+ };
13
+
14
+ // node_modules/semver-compare/index.js
15
+ var require_semver_compare = __commonJS({
16
+ "node_modules/semver-compare/index.js": function (exports2, module2) {
17
+ module2.exports = function cmp(a, b) {
18
+ var pa = a.split(".");
19
+ var pb = b.split(".");
20
+ for (var i = 0; i < 3; i++) {
21
+ var na = Number(pa[i]);
22
+ var nb = Number(pb[i]);
23
+ if (na > nb) return 1;
24
+ if (nb > na) return -1;
25
+ if (!isNaN(na) && isNaN(nb)) return 1;
26
+ if (isNaN(na) && !isNaN(nb)) return -1;
27
+ }
28
+ return 0;
29
+ };
30
+ },
31
+ });
32
+
33
+ // node_modules/please-upgrade-node/index.js
34
+ var require_please_upgrade_node = __commonJS({
35
+ "node_modules/please-upgrade-node/index.js": function (exports2, module2) {
36
+ var semverCompare = require_semver_compare();
37
+ module2.exports = function pleaseUpgradeNode2(pkg, opts) {
38
+ var opts = opts || {};
39
+ var requiredVersion = pkg.engines.node.replace(">=", "");
40
+ var currentVersion = process.version.replace("v", "");
41
+ if (semverCompare(currentVersion, requiredVersion) === -1) {
42
+ if (opts.message) {
43
+ console.error(opts.message(requiredVersion));
44
+ } else {
45
+ console.error(
46
+ pkg.name +
47
+ " requires at least version " +
48
+ requiredVersion +
49
+ " of Node, please upgrade",
50
+ );
51
+ }
52
+ if (opts.hasOwnProperty("exitCode")) {
53
+ process.exit(opts.exitCode);
54
+ } else {
55
+ process.exit(1);
56
+ }
57
+ }
58
+ };
59
+ },
60
+ });
61
+
62
+ // bin/prettier.cjs
63
+ var pleaseUpgradeNode = require_please_upgrade_node();
64
+ var packageJson = require("../package.json");
65
+ pleaseUpgradeNode(packageJson);
66
+ function runCli(cli) {
67
+ return cli.run();
68
+ }
69
+ var dynamicImport = new Function("module", "return import(module)");
70
+ var promise = dynamicImport("../internal/cli.mjs").then(runCli);
71
+ module.exports.__promise = promise;
@@ -0,0 +1,243 @@
1
+ // https://github.com/prettier/prettier/blob/next/src/document/public.js
2
+ export namespace builders {
3
+ type DocCommand =
4
+ | Align
5
+ | BreakParent
6
+ | Cursor
7
+ | Fill
8
+ | Group
9
+ | IfBreak
10
+ | Indent
11
+ | IndentIfBreak
12
+ | Label
13
+ | Line
14
+ | LineSuffix
15
+ | LineSuffixBoundary
16
+ | Trim;
17
+ type Doc = string | Doc[] | DocCommand;
18
+
19
+ interface Align {
20
+ type: "align";
21
+ contents: Doc;
22
+ n: number | string | { type: "root" };
23
+ }
24
+
25
+ interface BreakParent {
26
+ type: "break-parent";
27
+ }
28
+
29
+ interface Cursor {
30
+ type: "cursor";
31
+ placeholder: symbol;
32
+ }
33
+
34
+ interface Fill {
35
+ type: "fill";
36
+ parts: Doc[];
37
+ }
38
+
39
+ interface Group {
40
+ type: "group";
41
+ id?: symbol;
42
+ contents: Doc;
43
+ break: boolean;
44
+ expandedStates: Doc[];
45
+ }
46
+
47
+ interface HardlineWithoutBreakParent extends Line {
48
+ hard: true;
49
+ }
50
+
51
+ interface IfBreak {
52
+ type: "if-break";
53
+ breakContents: Doc;
54
+ flatContents: Doc;
55
+ }
56
+
57
+ interface Indent {
58
+ type: "indent";
59
+ contents: Doc;
60
+ }
61
+
62
+ interface IndentIfBreak {
63
+ type: "indent-if-break";
64
+ }
65
+
66
+ interface Label {
67
+ type: "label";
68
+ label: any;
69
+ contents: Doc;
70
+ }
71
+
72
+ interface Line {
73
+ type: "line";
74
+ soft?: boolean | undefined;
75
+ hard?: boolean | undefined;
76
+ literal?: boolean | undefined;
77
+ }
78
+
79
+ interface LineSuffix {
80
+ type: "line-suffix";
81
+ contents: Doc;
82
+ }
83
+
84
+ interface LineSuffixBoundary {
85
+ type: "line-suffix-boundary";
86
+ }
87
+
88
+ interface LiterallineWithoutBreakParent extends Line {
89
+ hard: true;
90
+ literal: true;
91
+ }
92
+
93
+ type LiteralLine = [LiterallineWithoutBreakParent, BreakParent];
94
+
95
+ interface Softline extends Line {
96
+ soft: true;
97
+ }
98
+
99
+ type Hardline = [HardlineWithoutBreakParent, BreakParent];
100
+
101
+ interface Trim {
102
+ type: "trim";
103
+ }
104
+
105
+ interface GroupOptions {
106
+ shouldBreak?: boolean | undefined;
107
+ id?: symbol | undefined;
108
+ }
109
+
110
+ function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc;
111
+
112
+ /** @see [align](https://github.com/prettier/prettier/blob/main/commands.md#align) */
113
+ function align(widthOrString: Align["n"], doc: Doc): Align;
114
+
115
+ /** @see [breakParent](https://github.com/prettier/prettier/blob/main/commands.md#breakparent) */
116
+ const breakParent: BreakParent;
117
+
118
+ /** @see [conditionalGroup](https://github.com/prettier/prettier/blob/main/commands.md#conditionalgroup) */
119
+ function conditionalGroup(alternatives: Doc[], options?: GroupOptions): Group;
120
+
121
+ /** @see [dedent](https://github.com/prettier/prettier/blob/main/commands.md#dedent) */
122
+ function dedent(doc: Doc): Align;
123
+
124
+ /** @see [dedentToRoot](https://github.com/prettier/prettier/blob/main/commands.md#dedenttoroot) */
125
+ function dedentToRoot(doc: Doc): Align;
126
+
127
+ /** @see [fill](https://github.com/prettier/prettier/blob/main/commands.md#fill) */
128
+ function fill(docs: Doc[]): Fill;
129
+
130
+ /** @see [group](https://github.com/prettier/prettier/blob/main/commands.md#group) */
131
+ function group(doc: Doc, opts?: GroupOptions): Group;
132
+
133
+ /** @see [hardline](https://github.com/prettier/prettier/blob/main/commands.md#hardline) */
134
+ const hardline: Hardline;
135
+
136
+ /** @see [hardlineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
137
+ const hardlineWithoutBreakParent: HardlineWithoutBreakParent;
138
+
139
+ /** @see [ifBreak](https://github.com/prettier/prettier/blob/main/commands.md#ifbreak) */
140
+ function ifBreak(
141
+ ifBreak: Doc,
142
+ noBreak?: Doc,
143
+ options?: { groupId?: symbol | undefined },
144
+ ): IfBreak;
145
+
146
+ /** @see [indent](https://github.com/prettier/prettier/blob/main/commands.md#indent) */
147
+ function indent(doc: Doc): Indent;
148
+
149
+ /** @see [indentIfBreak](https://github.com/prettier/prettier/blob/main/commands.md#indentifbreak) */
150
+ function indentIfBreak(
151
+ doc: Doc,
152
+ opts: { groupId: symbol; negate?: boolean | undefined },
153
+ ): IndentIfBreak;
154
+
155
+ /** @see [join](https://github.com/prettier/prettier/blob/main/commands.md#join) */
156
+ function join(sep: Doc, docs: Doc[]): Doc[];
157
+
158
+ /** @see [label](https://github.com/prettier/prettier/blob/main/commands.md#label) */
159
+ function label(label: any | undefined, contents: Doc): Doc;
160
+
161
+ /** @see [line](https://github.com/prettier/prettier/blob/main/commands.md#line) */
162
+ const line: Line;
163
+
164
+ /** @see [lineSuffix](https://github.com/prettier/prettier/blob/main/commands.md#linesuffix) */
165
+ function lineSuffix(suffix: Doc): LineSuffix;
166
+
167
+ /** @see [lineSuffixBoundary](https://github.com/prettier/prettier/blob/main/commands.md#linesuffixboundary) */
168
+ const lineSuffixBoundary: LineSuffixBoundary;
169
+
170
+ /** @see [literalline](https://github.com/prettier/prettier/blob/main/commands.md#literalline) */
171
+ const literalline: LiteralLine;
172
+
173
+ /** @see [literallineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
174
+ const literallineWithoutBreakParent: LiterallineWithoutBreakParent;
175
+
176
+ /** @see [markAsRoot](https://github.com/prettier/prettier/blob/main/commands.md#markasroot) */
177
+ function markAsRoot(doc: Doc): Align;
178
+
179
+ /** @see [softline](https://github.com/prettier/prettier/blob/main/commands.md#softline) */
180
+ const softline: Softline;
181
+
182
+ /** @see [trim](https://github.com/prettier/prettier/blob/main/commands.md#trim) */
183
+ const trim: Trim;
184
+
185
+ /** @see [cursor](https://github.com/prettier/prettier/blob/main/commands.md#cursor) */
186
+ const cursor: Cursor;
187
+ }
188
+
189
+ export namespace printer {
190
+ function printDocToString(
191
+ doc: builders.Doc,
192
+ options: Options,
193
+ ): {
194
+ formatted: string;
195
+ cursorNodeStart?: number | undefined;
196
+ cursorNodeText?: string | undefined;
197
+ };
198
+ interface Options {
199
+ /**
200
+ * Specify the line length that the printer will wrap on.
201
+ * @default 80
202
+ */
203
+ printWidth: number;
204
+ /**
205
+ * Specify the number of spaces per indentation-level.
206
+ * @default 2
207
+ */
208
+ tabWidth: number;
209
+ /**
210
+ * Indent lines with tabs instead of spaces
211
+ * @default false
212
+ */
213
+ useTabs?: boolean;
214
+ parentParser?: string | undefined;
215
+ __embeddedInHtml?: boolean | undefined;
216
+ }
217
+ }
218
+
219
+ export namespace utils {
220
+ function willBreak(doc: builders.Doc): boolean;
221
+ function traverseDoc(
222
+ doc: builders.Doc,
223
+ onEnter?: (doc: builders.Doc) => void | boolean,
224
+ onExit?: (doc: builders.Doc) => void,
225
+ shouldTraverseConditionalGroups?: boolean,
226
+ ): void;
227
+ function findInDoc<T = builders.Doc>(
228
+ doc: builders.Doc,
229
+ callback: (doc: builders.Doc) => T,
230
+ defaultValue: T,
231
+ ): T;
232
+ function mapDoc<T = builders.Doc>(
233
+ doc: builders.Doc,
234
+ callback: (doc: builders.Doc) => T,
235
+ ): T;
236
+ function removeLines(doc: builders.Doc): builders.Doc;
237
+ function stripTrailingHardline(doc: builders.Doc): builders.Doc;
238
+ function replaceEndOfLine(
239
+ doc: builders.Doc,
240
+ replacement?: builders.Doc,
241
+ ): builders.Doc;
242
+ function canBreak(doc: builders.Doc): boolean;
243
+ }