Releases: brodycj/prettierx
prettierx 0.19.0
Changelog
prettierx 0.19.0
compare prettierx-0.18.3...prettierx-0.19.0
Include updates from Prettier 2.3.2
(with some prettierX language-js
updates now based on Prettier 2.3.2)
with some updates including:
- switch to pure CSS parser using PostCSS 8 (see below)
- apply an optimization to reduce AST copying in HTML preprocessing -
prettier/prettier#11108
- update many dependencies
- use @brodybits/remark-parse@8, with updated trim sub-dependency, as recommended by:
- remove original author from package.json - with rationale:
- The code base in both Prettier and prettierX has many authors.
- Prettier has a number of committers and likely multiple owners, while prettierX has only one committer & owner at this point.
- The primary authors should be in the copyright & license statements, while the all of actual code authors should be in the git commits.
- The existing committer & owner of prettierX hence sees no point in keeping the original author entry.
prettierx 0.19.0 update(s) from Prettier next branch
[BREAKING] Add the pure css
parser (prettier/prettier#7933, prettier/prettier#9092, prettier/prettier#9093 by @fisker)
(using PostCSS version 8)
Previously, when --parser=css
was passed, Prettier tried to parse the content using postcss-scss
and postcss-less
. This caused confusion, and made syntax errors difficult to spot. Now --parser=css
works only with the vanilla CSS syntax.
If you use parser="css"
for your .less
/.scss
files, update it to the correct parser or remove the parser
option to let Prettier auto-detect the parser by the file extension.
/* Input */
/* Less Syntax with `--parser=css` */
a {.bordered();}
/* Prettier stable */
/* Less Syntax with `--parser=css` */
a {
.bordered();
}
/* Prettier main */
SyntaxError: (postcss) CssSyntaxError Unknown word (2:4)
1 | /* Less Syntax with `--parser=css` */
> 2 | a {.bordered();}
/* Input */
/* Scss Syntax with `--parser=css` */
::before {content: #{$foo}}
/* Prettier stable */
/* Scss Syntax with `--parser=css` */
::before {
content: #{$foo};
}
/* Prettier main */
SyntaxError: (postcss) CssSyntaxError Unknown word (2:22)
1 | /* Scss Syntax with `--parser=css` */
> 2 | ::before {content: #{$foo}}
prettier 2.3.2
Fix failure on dir with trailing slash (#11000 by @fisker)
$ ls
1.js 1.unknown
# Prettier 2.3.1
$ prettier . -l
1.js
$ prettier ./ -l
[error] No supported files were found in the directory: "./".
# Prettier 2.3.2
$ prettier ./ -l
1.js
Fix handling of parenthesis with Flow's {Optional}IndexedAccess (#11051 by @gkz)
Add parens when required.
// Input
type A = (T & S)['bar'];
type B = (T | S)['bar'];
type C = (?T)['bar'];
type D = (typeof x)['bar'];
type E = (string => void)['bar'];
// Prettier 2.3.1
type A = T & S["bar"];
type B = T | S["bar"];
type C = ?T["bar"];
type D = typeof x["bar"];
type E = (string) => void["bar"];
// Prettier 2.3.2
type A = (T & S)["bar"];
type B = (T | S)["bar"];
type C = (?T)["bar"];
type D = (typeof x)["bar"];
type E = ((string) => void)["bar"];
Print override modifiers for parameter property (#11074 by @sosukesuzuki)
// Input
class D extends B {
constructor(override foo: string) {
super();
}
}
// Prettier 2.3.1
class D extends B {
constructor(foo: string) {
super();
}
}
// Prettier 2.3.2
class D extends B {
constructor(override foo: string) {
super();
}
}
prettier 2.3.1
Support TypeScript 4.3 (#10945 by @sosukesuzuki)
override
modifiers in class elements
class Foo extends {
override method() {}
}
static index signatures ([key: KeyType]: ValueType
) in classes
class Foo {
static [key: string]: Bar;
}
get
/ set
in type declarations
interface Foo {
set foo(value);
get foo(): string;
}
Preserve attributes order for element node (#10958 by @dcyriller)
Track cursor position properly when it’s at the end of the range to format (#10938 by @j-f1)
Previously, if the cursor was at the end of the range to format, it would simply be placed back at the end of the updated range.
Now, it will be repositioned if Prettier decides to add additional code to the end of the range (such as a semicolon).
// Input (<|> represents the cursor)
const someVariable = myOtherVariable<|>
// range to format: ^^^^^^^^^^^^^^^
// Prettier stable
const someVariable = myOtherVariable;<|>
// range to format: ^^^^^^^^^^^^^^^
// Prettier main
const someVariable = myOtherVariable<|>;
// range to format: ^^^^^^^^^^^^^^^
Break the LHS of type alias that has complex type parameters (#10901 by @sosukesuzuki)
// Input
type FieldLayoutWith<
T extends string,
S extends unknown = { width: string }
> = {
type: T;
code: string;
size: S;
};
// Prettier stable
type FieldLayoutWith<T extends string, S extends unknown = { width: string }> =
{
type: T;
code: string;
size: S;
};
// Prettier main
type FieldLayoutWith<
T extends string,
S extends unknown = { width: string }
> = {
type: T;
code: string;
size: S;
};
Break the LHS of assignments that has complex type parameters (#10916 by @sosukesuzuki)
// Input
const map: Map<
Function,
Map<string | void, { value: UnloadedDescriptor }>
> = new Map();
// Prettier stable
const map: Map<Function, Map<string | void, { value: UnloadedDescriptor }>> =
new Map();
// Prettier main
const map: Map<
Function,
Map<string | void, { value: UnloadedDescriptor }>
> = new Map();
Fix incorrectly wrapped arrow functions with return types (#10940 by @thorn0)
// Input
longfunctionWithCall12("bla", foo, (thing: string): complex<type<something>> => {
code();
});
// Prettier stable
longfunctionWithCall12("bla", foo, (thing: string): complex<
type<something>
> => {
code();
});
// Prettier main
longfunctionWithCall12(
"bla",
foo,
(thing: string): complex<type<something>> => {
code();
}
);
Avoid breaking call expressions after assignments with complex type arguments (#10949 by @sosukesuzuki)
// Input
const foo = call<{
prop1: string;
prop2: string;
prop3: string;
}>();
// Prettier stable
const foo =
call<{
prop1: string;
prop2: string;
prop3: string;
}>();
// Prettier main
const foo = call<{
prop1: string;
prop2: string;
prop3: string;
}>();
Fix order of override
modifiers (#10961 by @sosukesuzuki)
// Input
cla...
prettierx-0.18.1
prettierx 0.18.1
compare prettierx-0.18.0...prettierx-0.18.1
- cleanup(src): add another objectCurlySpacing option comment
- Update some dependencies
- chalk -> 4.1.1
- get-stream -> 6.0.1
- mem -> 8.1.1
prettierx-0.18.0
prettierx 0.18.0
compare prettierx-0.17.0...prettierx-0.18.0
- Update some dependencies
- @babel/code-frame -> 7.12.13
- ci-info -> 3.1.1
- diff -> 5.0.0
- globby -> 11.0.3
- lodash -> 4.17.21
- mem -> 8.1.0
- postcss-less -> 4.0.1
- resolve -> 1.20.0
- semver -> 7.3.5
- string-width -> 4.2.2
- unified -> 9.2.1
prettierx-0.17.0
- replace --no-align-ternary-lines with --offset-ternary-expressions (with updated formatting)
- replace --no-bracket-spacing with finer-grained options
- replace --paren-spacing with finer-grained options
- update graphql -> 15.5.0
- update some descriptions & update some documentation
prettierx-0.16.1
- fix some descriptions
- update some documentation
prettierx-0.16.0
- add & implement --break-long-method-chains option
- Update fast-glob -> 3.2.5 in dependencies
- cleanup: remove extra parent.object conditions not needed
prettierx-0.15.0
- add --html-void-tags option
- update some dependencies
- @babel/parser -> 7.12.11
- cjk-regex -> 2.0.1
- globby -> 11.0.2
- graphql -> 15.4.0
- html-element-attributes -> 2.3.0
- fix & update some documentation
prettierx-0.14.3
- Update some dependencies
- mem -> 6.1.1
- n-readlines -> 1.0.1
- resolve -> 1.19.0
- semver -> 7.3.4
- yaml-unist-parser -> 1.3.1
prettierx-0.14.2
- Add tslib to avoid a peerDependencies warning
- Update some dependencies
- @babel/code-frame -> 7.12.11
- @babel/parser -> 7.12.0
- camelcase -> 6.2.0
- lodash -> 4.17.20
- unified -> 9.2.0
compare prettierx-0.14.0...prettierx-0.14.2
NOTE: prettierx release 0.14.1 was inadvertently skipped in package.json.
prettierx 0.14.0
- merge updates from Prettier 2.0.0 ... 2.0.5, with some workarounds
- parse TypeScript using Babel by default
- move the
flow-parser
parser topeerDependenciesMeta
, as an optional dependency (note that Prettier andprettierx
use Babel to parse Flow by default) - update documentation of
--space-before-function-paren
and--generator-star-spacing
features - apply some additional source code clanup
- apply some updates for
--paren-spacing
feature fromwp-prettier-2.0.5
branch of thewp-prettier
fork - resolve a limited number of issues related to the
--paren-spacing
feature - apply some additional source code cleanup
- update some dependencies