Skip to content

Releases: brodycj/prettierx

prettierx 0.19.0

06 Jul 14:06
prettierx-0.19.0
e96b04d
Compare
Choose a tag to compare

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

diff

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

diff

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)

{{!-- Input --}}
<MyComponent
  {{! this is a comment for arg 1}}
  @arg1="hello"
  {{on "clik" this.modify}}
  @arg2="hello"
  {{! this is a comment for arg 3}}
  @arg3="hello"
  @arg4="hello"
  {{! this is a comment for arg 5}}
  @arg5="hello"
  ...arguments
/>
{{!-- Prettier stable --}}
<MyComponent
  @arg1="hello"
  @arg2="hello"
  @arg3="hello"
  @arg4="hello"
  @arg5="hello"
  ...arguments
  {{on "clik" this.modify}}
  {{! this is a comment for arg 1}}
  {{! this is a comment for arg 3}}
  {{! this is a comment for arg 5}}
/>
{{!-- Prettier main --}}
<MyComponent
  {{! this is a comment for arg 1}}
  @arg1="hello"
  {{on "clik" this.modify}}
  @arg2="hello"
  {{! this is a comment for arg 3}}
  @arg3="hello"
  @arg4="hello"
  {{! this is a comment for arg 5}}
  @arg5="hello"
  ...arguments
/>

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...
Read more

prettierx-0.18.1

03 Jun 01:55
Compare
Choose a tag to compare

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

13 Apr 03:16
Compare
Choose a tag to compare

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

02 Feb 02:19
Compare
Choose a tag to compare
  • 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

27 Jan 22:27
Compare
Choose a tag to compare
  • fix some descriptions
  • update some documentation

compare prettierx-0.16.0...prettierx-0.16.1

prettierx-0.16.0

18 Jan 04:40
Compare
Choose a tag to compare
  • add & implement --break-long-method-chains option
  • Update fast-glob -> 3.2.5 in dependencies
  • cleanup: remove extra parent.object conditions not needed

compare prettierx-0.15.0...prettierx-0.16.0

prettierx-0.15.0

18 Jan 04:39
Compare
Choose a tag to compare
  • 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

compare prettierx-0.14.3...prettierx-0.15.0

prettierx-0.14.3

27 Dec 05:35
Compare
Choose a tag to compare
  • 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

27 Dec 03:53
Compare
Choose a tag to compare
  • 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

11 Aug 02:17
Compare
Choose a tag to compare
  • merge updates from Prettier 2.0.0 ... 2.0.5, with some workarounds
  • parse TypeScript using Babel by default
  • move the flow-parser parser to peerDependenciesMeta, as an optional dependency (note that Prettier and prettierx 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 from wp-prettier-2.0.5 branch of the wp-prettier fork
  • resolve a limited number of issues related to the --paren-spacing feature
  • apply some additional source code cleanup
  • update some dependencies