refactor: update all (major)
This MR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| commander | 6.2.1 -> 11.0.0 |
||||
| conventional-changelog-cli (source) | 2.2.2 -> 3.0.0 |
||||
| eslint-plugin-jsdoc | 39.6.2 -> 46.4.4 |
||||
| eslint-plugin-prettier | 4.2.1 -> 5.0.0 |
||||
| eslint-plugin-unicorn | 45.0.0 -> 48.0.0 |
||||
| prettier (source) | 2.7.1 -> 3.0.0 |
||||
| rimraf | 3.0.2 -> 5.0.1 |
Release Notes
tj/commander.js (commander)
v11.0.0
Fixed
- help command works when help option is disabled ([#1864])
Changed
- leading and trailing spaces are now ignored by the .arguments() method ([#1874])
- refine "types" exports for ESM to follow TypeScript guidelines ([#1886])
- Breaking: Commander 11 requires Node.js v16 or higher
v10.0.1
Added
Fixed
- remove unused
Option.optionFlagsproperty from TypeScript definition ([#1844])
Changed
- assume boolean option intended if caller passes string instead of hash to
.implies()([#1854])
v10.0.0
Added
- wrap command description in help ([#1804])
Changed
- Breaking: Commander 10 requires Node.js v14 or higher
v9.5.0
Added
-
.getOptionValueSourceWithGlobals()([#1832]) -
showGlobalOptionsfor.configureHelp{}andHelp([#1828])
v9.4.1
Fixed
-
.setOptionValue()now also clears option source ([#1795]) - TypeScript: add
impliedtoOptionValueSourcefor option values set by using.implies()([#1794]) - TypeScript : add
undefinedto return type of.getOptionValueSource()([#1794])
Changed
- additions to README
v9.4.0
Added
-
preSubcommandhook called before direct subcommands ([#1763])
Fixed
- export
InvalidOptionArgumentErrorin esm ([#1756])
Changed
- update dependencies ([#1767])
v9.3.0
Added
-
.summary()for a short summary to use instead of description when listing subcommands in help ([#1726]) -
Option.implies()to set other option values when the option is specified ([#1724]) - updated Chinese README with 9.x changes ([#1727])
Fixed
- TypeScript: add
string[]to.options()default value parameter type for use with variadic options ([#1721])
Deprecated
- multi-character short option flag (e.g.
-ws) ([#1718])
v9.2.0
Added
- conditional export of 'types' for upcoming TypeScript module resolution ([#1703])
- example file showing two ways to add global options to subcommands ([#1708])
Fixed
- detect option conflicts in parent commands of called subcommand ([#1710])
Changed
- replace deprecated
String.prototype.substr([#1706])
v9.1.0
Added
- Option
.conflicts()to set conflicting options which can not be specified together ([#1678]) - (developer) CodeQL configuration for GitHub Actions ([#1698])
v9.0.0
Added
- simpler ECMAScript import ([#1589])
- Option.preset() allows specifying value/arg for option when used without option-argument (especially optional, but also boolean option) ([#1652])
-
.executableDir()for custom search for subcommands ([#1571]) - throw with helpful message if pass
Optionto.option()or.requiredOption()([#1655]) - .
error()for generating errors from client code just like Commander generated errors, with support for.configureOutput(),.exitOverride(), and.showHelpAfterError()([#1675]) -
.optsWithGlobals()to return merged local and global options ([#1671])
Changed
- Breaking: Commander 9 requires Node.js v12.20.0 or higher
- update package-lock.json to lockfile@2 format ([#1659])
-
showSuggestionAfterErroris now on by default ([#1657]) - Breaking: default value specified for boolean option now always used as default value (see .preset() to match some previous behaviours) ([#1652])
- default value for boolean option only shown in help if true/false ([#1652])
- use command name as prefix for subcommand stand-alone executable name (with fallback to script name for backwards compatibility) ([#1571])
- allow absolute path with
executableFile([#1571]) - removed restriction that nested subcommands must specify
executableFile([#1571]) - TypeScript: allow passing readonly string array to
.choices()([#1667]) - TypeScript: allow passing readonly string array to
.parse(),.parseAsync(),.aliases()([#1669])
Fixed
- option with optional argument not supplied on command line now works when option already has a value, whether from default value or from previous arguments ([#1652])
Removed
-
Breaking: removed internal fallback to
require.main.filenamewhen script not known from arguments passed to.parse()(can supply details using.name(), and.executableDir()orexecutableFile) ([#1571])
v8.3.0
Added
-
.getOptionValueSource()and.setOptionValueWithSource(), where expected values for source are one of 'default', 'env', 'config', 'cli' ([#1613])
Deprecated
-
.command('*'), use default command instead ([#1612]) -
on('command:*'), use.showSuggestionAfterError()instead ([#1612])
v8.2.0
Added
-
.showSuggestionAfterError()to show suggestions after unknown command or unknown option ([#1590]) - add
Optionsupport for values from environment variables using.env()([#1587])
Changed
- show error for unknown global option before subcommand (rather than just help) ([#1590])
Removed
- TypeScript declaration of unimplemented
OptionmethodargumentRejected
v8.1.0
Added
-
.copyInheritedSettings()([#1557]) - update Chinese translations of documentation for Commander v8 ([#1570])
-
Argumentmethods for.argRequired()and.argOptional()([#1567])
v8.0.0
Added
-
.argument(name, description)for adding command-arguments ([#1490]) -
.createArgument()factory method ([#1497]) -
.addArgument()([#1490]) -
Argumentsupports.choices()([#1525]) -
.showHelpAfterError()to display full help or a custom message after an error ([#1534]) -
.hook()with support for'preAction'and'postAction'callbacks ([#1514]) - client typing of
.opts()return type using TypeScript generics ([#1539]) - the number of command-arguments is checked for programs without an action handler ([#1502])
-
.getOptionValue()and.setOptionValue()([#1521])
Changed
- refactor and simplify TypeScript declarations (with no default export) ([#1520])
-
.parseAsync()is now declared asasync([#1513]) -
Breaking:
Helpmethod.visibleArguments()returns array ofArgument([#1490]) - Breaking: Commander 8 requires Node.js 12 or higher ([#1500])
-
Breaking:
CommanderErrorcodecommander.invalidOptionArgumentrenamedcommander.invalidArgument([#1508]) -
Breaking: TypeScript declaration for
.addTextHelp()callback no longer allows result ofundefined, now juststring([#1516]) - refactor
index.tabinto a file per class ([#1522]) - remove help suggestion from "unknown command" error message (see
.showHelpAfteError()) ([#1534]) -
Commandproperty.arginitialised to empty array (was previously undefined) ([#1529]) - update dependencies
Deprecated
- second parameter of
cmd.description(desc, argDescriptions)for adding argument descriptions ([#1490])- (use new
.argument(name, description)instead)
- (use new
-
InvalidOptionArgumentError(replaced byInvalidArgumentError) ([#1508])
Removed
-
Breaking: TypeScript declaration for default export of global
Commandobject ([#1520])- (still available as named
programexport)
- (still available as named
Migration Tips
If you have a simple program without an action handler, you will now get an error if there are missing command-arguments.
program
.option('-d, --debug')
.arguments('<file>');
program.parse();
$ node trivial.js
error: missing required argument 'file'
If you want to show the help in this situation, you could check the arguments before parsing:
if (process.argv.length === 2)
program.help();
program.parse();
Or, you might choose to show the help after any user error:
program.showHelpAfterError();
v7.2.0
Added
- TypeScript typing for
parentproperty onCommand([#1475]) - TypeScript typing for
.attributeName()onOption([#1483]) - support information in package ([#1477])
Changed
- improvements to error messages, README, and tests
- update dependencies
v7.1.0
Added
- support for named imports from ECMAScript modules ([#1440])
- add
.cjsto list of expected script file extensions ([#1449]) - allow using option choices and variadic together ([#1454])
Fixed
- replace use of deprecated
process.mainModule([#1448]) - regression for legacy
command('*')and call when command line includes options ([#1464]) - regression for
on('command:*', ...)and call when command line includes unknown options ([#1464]) - display best error for combination of unknown command and unknown option (i.e. unknown command) ([#1464])
Changed
- make TypeScript typings tests stricter ([#1453])
- improvements to README and tests
v7.0.0
Added
-
.enablePositionalOptions()to let program and subcommand reuse same option ([#1427]) -
.passThroughOptions()to pass options through to other programs without needing--([#1427]) -
.allowExcessArguments(false)to show an error message if there are too many command-arguments on command line for the action handler ([#1409]) -
.configureOutput()to modify use of stdout and stderr or customise display of errors ([#1387]) - use
.addHelpText()to add text before or after the built-in help, for just current command or also for all subcommands ([#1296]) - enhance Option class ([#1331])
- allow hiding options from help
- allow restricting option arguments to a list of choices
- allow setting how default value is shown in help
-
.createOption()to support subclassing of automatically created options (like.createCommand()) ([#1380]) - refactor the code generating the help into a separate public Help class ([#1365])
- support sorting subcommands and options in help
- support specifying wrap width (columns)
- allow subclassing Help class
- allow configuring Help class without subclassing
Changed
-
Breaking: options are stored safely by default, not as properties on the command ([#1409])
- this especially affects accessing options on program, use
program.opts() - revert behaviour with
.storeOptionsAsProperties()
- this especially affects accessing options on program, use
- Breaking: action handlers are passed options and command separately ([#1409])
- deprecated callback parameter to
.help()and.outputHelp()(removed from README) ([#1296]) -
Breaking: errors now displayed using
process.stderr.write()instead ofconsole.error() - deprecate
.on('--help')(removed from README) ([#1296]) - initialise the command description to empty string (previously undefined) ([#1365])
- document and annotate deprecated routines ([#1349])
Fixed
- wrapping bugs in help ([#1365])
- first line of command description was wrapping two characters early
- pad width calculation was not including help option and help command
- pad width calculation was including hidden options and commands
- improve backwards compatibility for custom command event listeners ([#1403])
Deleted
-
Breaking:
.passCommandToAction()([#1409])- no longer needed as action handler is passed options and command
-
Breaking: "extra arguments" parameter to action handler ([#1409])
- if being used to detect excess arguments, there is now an error available by setting
.allowExcessArguments(false)
- if being used to detect excess arguments, there is now an error available by setting
Migration Tips
The biggest change is the parsed option values. Previously the options were stored by default as properties on the command object, and now the options are stored separately.
If you wish to restore the old behaviour and get running quickly you can call .storeOptionsAsProperties().
To allow you to move to the new code patterns incrementally, the action handler will be passed the command twice,
to match the new "options" and "command" parameters (see below).
program options
Use the .opts() method to access the options. This is available on any command but is used most with the program.
program.option('-d, --debug');
program.parse();
// Old code before Commander 7
if (program.debug) console.log(`Program name is ${program.name()}`);
// New code
const options = program.opts();
if (options.debug) console.log(`Program name is ${program.name()}`);
action handler
The action handler gets passed a parameter for each command-argument you declared. Previously by default the next parameter was the command object with the options as properties. Now the next two parameters are instead the options and the command. If you only accessed the options there may be no code changes required.
program
.command('compress <filename>')
.option('-t, --trace')
// Old code before Commander 7
.action((filename, cmd) => {
if (cmd.trace) console.log(`Command name is ${cmd.name()}`);
});
// New code
.action((filename, options, command) => {
if (options.trace) console.log(`Command name is ${command.name()}`);
});
If you already set .storeOptionsAsProperties(false) you may still need to adjust your code.
program
.command('compress <filename>')
.storeOptionsAsProperties(false)
.option('-t, --trace')
// Old code before Commander 7
.action((filename, command) => {
if (command.opts().trace) console.log(`Command name is ${command.name()}`);
});
// New code
.action((filename, options, command) => {
if (command.opts().trace) console.log(`Command name is ${command.name()}`);
});
conventional-changelog/conventional-changelog (conventional-changelog-cli)
v3.0.0: conventional-changelog-cli: v3.0.0
⚠ BREAKING CHANGES
- now all promises are native
- Node >= 14 is required
Code Refactoring
gajus/eslint-plugin-jsdoc (eslint-plugin-jsdoc)
v46.4.4
Bug Fixes
v46.4.3
Bug Fixes
-
match-description: dropthrowsandyieldsfrom being reported for non-empty descriptions bynonemptyTagsdefault; #1126 (03578ca)
v46.4.2
Bug Fixes
v46.4.1
Bug Fixes
-
require-jsdoc: do not reportPropertyDefinition's with non-publicaccessibility; fixes #1122 (1e45ae4)
v46.4.0
Features
v46.3.0
Bug Fixes
- make name required on
[@template](https://github.com/template)for non-JSDoc modes (467441b)
Features
-
match-description: ensure[@desc](https://github.com/desc)checked by default; check more desc-like tags by default; check non-empty tags; #233 (1b9d9e4)
v46.2.6
Bug Fixes
-
imports-as-dependencies: do not log missing package.json when rule is not active; fixes #1117 (3a5dd7d)
v46.2.5
Bug Fixes
v46.2.4
Bug Fixes
-
imports-as-dependencies: allow relative paths (7469e59)
v46.2.3
Bug Fixes
-
imports-as-dependencies: catchtypingsas possible publishing source (e3b0d0c)
v46.2.2
Bug Fixes
-
imports-as-dependencies: don't report TypeScript proper (75b6b8c)
v46.2.1
Bug Fixes
-
imports-as-dependencies: check fortypesinpackage.jsonand if not present, check[@types](https://github.com/types); fixes #1107 (785fb26)
v46.2.0
Features
-
imports-as-dependencies: add new rule to detect missing dependencies for import statements; fixes #896 (d7ec6e0)
v46.1.0
Features
v46.0.0
Features
-
no-defaults: make no-defaults on by default (034ade1)
BREAKING CHANGES
-
no-defaults: Removes default values. Disable the rule if removal not desired.
Also:
- docs: adds info on TS recommended rules
v45.0.0
Features
- add recommended-typescript-flavor configs (6042b77)
- for typescript configs, disable
no-undefined-types; fixes #888 (ec41b90)
BREAKING CHANGES
- This should only impact users of typescript configs. TS should itself handle checking for undefined types, so the (imperfect) rule has been disabled for such users.
v44.2.7
v44.2.6
v44.2.5
v44.2.4
v44.2.3
v44.2.2
v44.2.1
v44.2.0
v44.1.0
v44.0.2
v44.0.1
v44.0.0
v43.2.0
v43.1.1
v43.1.0
v43.0.9
v43.0.8
v43.0.7
v43.0.6
v43.0.5
v43.0.4
v43.0.3
v43.0.2
v43.0.1
v43.0.0
v42.0.0
v41.1.2
v41.1.1
v41.1.0
v41.0.0
v40.3.0
v40.2.1
v40.2.0
v40.1.2
v40.1.1
v40.1.0
v40.0.3
v40.0.2
v40.0.1
v40.0.0
v39.9.1
v39.9.0
v39.8.0
v39.7.5
v39.7.4
v39.7.3
v39.7.2
v39.7.1
v39.7.0
v39.6.10
v39.6.9
v39.6.8
v39.6.7
v39.6.6
v39.6.5
v39.6.4
Bug Fixes
v39.6.3
Bug Fixes
prettier/eslint-plugin-prettier (eslint-plugin-prettier)
v5.0.0
Major Changes
-
#508
910aeb6Thanks @JounQin! - feat!: bump peer eslint to ">=8.0.0" and node to "^14.18.0 || >=16.0.0" -
#508
910aeb6Thanks @JounQin! - feat!: upgrade to prettier v3
Minor Changes
Patch Changes
sindresorhus/eslint-plugin-unicorn (eslint-plugin-unicorn)
v48.0.0
Improvements
- Deprecate
no-unsafe-regexrule (#2135)7b473aa -
prefer-top-level-await: Ignore promises insidePromise.{all,allSettled,any,race}()(#2139)d3f6b60 -
no-process-exit: Ignore when usingnode:worker_threadsmodule (#2136)2907805 -
prefer-array-some: Ignore filter calls with literal argument (#2097)7a32edb -
prefer-modern-math-api: Check cases thatMath.hypot()should be preferred (#2080)9bbc948 -
explicit-length-check: Ignore.length || number(#1977)b9b8794
Fixes
- Fix crash on array holes (#2129)
f10f1a6 -
prefer-dom-node-dataset: Fix edge cases (#2171)b2d7378 -
prefer-dom-node-dataset: Remove broken fix forelement.setAttribute(#2169)61234af -
no-lonely-if: Fix an edge case (#2168)ca837a8 -
no-useless-undefined: Turn parameter withundefineddefault value into optional parameter (#2138)4aa7d60 -
no-thenable: FixObject.fromEntries()check (#2130)f3265b9 -
prefer-dom-node-remove: Fix incorrect auto-fix (#2084)74bb36d
v47.0.0
Breaking
- Require Node.js 16 (#2073)
a3bc120 - Require
eslint@>=8.38.0(#2066)04af765 - Enable
prefer-at,prefer-event-target, andprefer-string-replace-allin recommended config (#2073)a3bc120
New rules
Improvements
-
prefer-top-level-await: Ignore.cjsfiles (#2072)0c3ccb1 -
prefer-spread: Stop checkingArray.fromcall with map function (#2064)f5beccb -
prefer-dom-node-text-content: Check optional chaining (#2062)8d6d007 -
prefer-dom-node-{append,remove}: Check optional chaining (#2061)443999b
Fixes
v46.0.1
v46.0.0
Improvements
- Add
elemsto abbreviations (#2040)2a9c840 -
no-useless-spread: CheckArray#{toReversed,toSorted,toSpliced,with}(#2030)55469e5 -
prefer-set-has: SupportArray#{toReversed,toSorted,toSpliced,with}(#2032)fea5b42 -
prefer-spread: Forbid use ofArray#toSpliced()to copy array (#2034)4ada50e -
prefer-negative-index: Check.toSpliced()and.with()(#2031)7ed738a -
no-empty-file: Support.jsxand.tsxextensions (#2002)ba1a00e
Fixes
v45.0.2
-
prefer-string-replace-all: Don't crash on invalid pattern (#2011)3bbe027 -
prevent-abbreviations: Skip fix for variables used in Vue template (#2012)8cd1ded
v45.0.1
prettier/prettier (prettier)
v3.0.0
v2.8.8
This version is a republished version of v2.8.7. A bad version was accidentally published and it can't be unpublished, apologies for the churn.
v2.8.7
Allow multiple decorators on same getter/setter (#14584 by @fisker)
// Input
class A {
@​decorator()
get foo () {}
@​decorator()
set foo (value) {}
}
// Prettier 2.8.6
SyntaxError: Decorators cannot be applied to multiple get/set accessors of the same name. (5:3)
3 | get foo () {}
4 |
> 5 | @​decorator()
| ^^^^^^^^^^^^
6 | set foo (value) {}
7 | }
// Prettier 2.8.7
class A {
@​decorator()
get foo() {}
@​decorator()
set foo(value) {}
}
v2.8.6
Allow decorators on private members and class expressions (#14548 by @fisker)
// Input
class A {
@​decorator()
#privateMethod () {}
}
// Prettier 2.8.5
SyntaxError: Decorators are not valid here. (2:3)
1 | class A {
> 2 | @​decorator()
| ^^^^^^^^^^^^
3 | #privateMethod () {}
4 | }
// Prettier 2.8.6
class A {
@​decorator()
#privateMethod() {}
}
v2.8.5
Support TypeScript 5.0 (#14391 by @fisker, #13819 by @fisker, @sosukesuzuki)
TypeScript 5.0 introduces two new syntactic features:
-
constmodifiers for type parameters -
export type *declarations
Add missing parentheses for decorator (#14393 by @fisker)
// Input
class Person {
@​(myDecoratorArray[0])
greet() {}
}
// Prettier 2.8.4
class Person {
@​myDecoratorArray[0]
greet() {}
}
// Prettier 2.8.5
class Person {
@​(myDecoratorArray[0])
greet() {}
}
Add parentheses for TypeofTypeAnnotation to improve readability (#14458 by @fisker)
// Input
type A = (typeof node.children)[];
// Prettier 2.8.4
type A = typeof node.children[];
// Prettier 2.8.5
type A = (typeof node.children)[];
Support max_line_length=off when parsing .editorconfig (#14516 by @josephfrazier)
If an .editorconfig file is in your project and it sets max_line_length=off for the file you're formatting,
it will be interpreted as a printWidth of Infinity rather than being ignored
(which previously resulted in the default printWidth of 80 being applied, if not overridden by Prettier-specific configuration).
<!-- Input -->
<div className='HelloWorld' title={`You are visitor number ${ num }`} onMouseOver={onMouseOver}/>
<!-- Prettier 2.8.4 -->
<div
className="HelloWorld"
title={`You are visitor number ${num}`}
onMouseOver={onMouseOver}
/>;
<!-- Prettier 2.8.5 -->
<div className="HelloWorld" title={`You are visitor number ${num}`} onMouseOver={onMouseOver} />;
v2.8.4
Fix leading comments in mapped types with readonly (#13427 by @thorn0, @sosukesuzuki)
// Input
type Type = {
// comment
readonly [key in Foo];
};
// Prettier 2.8.3
type Type = {
readonly // comment
[key in Foo];
};
// Prettier 2.8.4
type Type = {
// comment
readonly [key in Foo];
};
Group params in opening block statements (#14067 by @jamescdavis)
This is a follow-up to #13930 to establish wrapping consistency between opening block statements and else blocks by grouping params in opening blocks. This causes params to break to a new line together and not be split across lines unless the length of params exceeds the print width. This also updates the else block wrapping to behave exactly the same as opening blocks.
{{! Input }}
{{#block param param param param param param param param param param as |blockParam|}}
Hello
{{else block param param param param param param param param param param as |blockParam|}}
There
{{/block}}
{{! Prettier 2.8.3 }}
{{#block
param
param
param
param
param
param
param
param
param
param
as |blockParam|
}}
Hello
{{else block param
param
param
param
param
param
param
param
param
param}}
There
{{/block}}
{{! Prettier 2.8.4 }}
{{#block
param param param param param param param param param param
as |blockParam|
}}
Hello
{{else block
param param param param param param param param param param
as |blockParam|
}}
There
{{/block}}
Ignore files in .sl/ (#14206 by @bolinfest)
In Sapling SCM, .sl/ is the folder where it stores its state, analogous to .git/ in Git. It should be ignored in Prettier like the other SCM folders.
Recognize @satisfies in Closure-style type casts (#14262 by @fisker)
// Input
const a = /** @​satisfies {Record<string, string>} */ ({hello: 1337});
const b = /** @​type {Record<string, string>} */ ({hello: 1337});
// Prettier 2.8.3
const a = /** @​satisfies {Record<string, string>} */ { hello: 1337 };
const b = /** @​type {Record<string, string>} */ ({ hello: 1337 });
// Prettier 2.8.4
const a = /** @​satisfies {Record<string, string>} */ ({hello: 1337});
const b = /** @​type {Record<string, string>} */ ({hello: 1337});
Fix parens in inferred function return types with extends (#14279 by @fisker)
// Input
type Foo<T> = T extends ((a) => a is infer R extends string) ? R : never;
// Prettier 2.8.3 (First format)
type Foo<T> = T extends (a) => a is infer R extends string ? R : never;
// Prettier 2.8.3 (Second format)
SyntaxError: '?' expected.
// Prettier 2.8.4
type Foo<T> = T extends ((a) => a is infer R extends string) ? R : never;
v2.8.3
Allow self-closing tags on custom elements (#14170 by @fisker)
See Angular v15.1.0 release note for details.
// Input
<app-test/>
// Prettier 2.8.2
SyntaxError: Only void and foreign elements can be self closed "app-test" (1:1)
> 1 | <app-test/>
| ^^^^^^^^^
2 |
// Prettier 2.8.3
<app-test />
v2.8.2
Don't lowercase link references (#13155 by @DerekNonGeneric & @fisker)
<!-- Input -->
We now don't strictly follow the release notes format suggested by [Keep a Changelog].
[Keep a Changelog]: https://example.com/
<!-- Prettier 2.8.1 -->
We now don't strictly follow the release notes format suggested by [Keep a Changelog].
[keep a changelog]: https://example.com/
<!--
^^^^^^^^^^^^^^^^^^ lowercased
-->
<!-- Prettier 2.8.2 -->
<Same as input>
Preserve self-closing tags (#13691 by @dcyriller)
{{! Input }}
<div />
<div></div>
<custom-component />
<custom-component></custom-component>
<i />
<i></i>
<Component />
<Component></Component>
{{! Prettier 2.8.1 }}
<div></div>
<div></div>
<custom-component></custom-component>
<custom-component></custom-component>
<i></i>
<i></i>
<Component />
<Component />
{{! Prettier 2.8.2 }}
<div />
<div></div>
<custom-component />
<custom-component></custom-component>
<i />
<i></i>
<Component />
<Component />
Allow custom "else if"-like blocks with block params (#13930 by @jamescdavis)
#13507 added support for custom block keywords used with else, but failed to allow block params. This updates printer-glimmer to allow block params with custom "else if"-like blocks.
{{! Input }}
{{#when isAtWork as |work|}}
Ship that
{{work}}!
{{else when isReading as |book|}}
You can finish
{{book}}
eventually...
{{else}}
Go to bed!
{{/when}}
{{! Prettier 2.8.1 }}
{{#when isAtWork as |work|}}
Ship that
{{work}}!
{{else when isReading}}
You can finish
{{book}}
eventually...
{{else}}
Go to bed!
{{/when}}
{{! Prettier 2.8.2 }}
{{#when isAtWork as |work|}}
Ship that
{{work}}!
{{else when isReading as |book|}}
You can finish
{{book}}
eventually...
{{else}}
Go to bed!
{{/when}}
Preserve empty lines between nested SCSS maps (#13931 by @jneander)
/* Input */
$map: (
'one': (
'key': 'value',
),
'two': (
'key': 'value',
),
)
/* Prettier 2.8.1 */
$map: (
'one': (
'key': 'value',
),
'two': (
'key': 'value',
),
)
/* Prettier 2.8.2 */
$map: (
'one': (
'key': 'value',
),
'two': (
'key': 'value',
),
)
Fix missing parentheses when an expression statement starts with let[ (#14000, #14044 by @fisker, @thorn0)
// Input
(let[0] = 2);
// Prettier 2.8.1
let[0] = 2;
// Prettier 2.8.1 (second format)
SyntaxError: Unexpected token (1:5)
> 1 | let[0] = 2;
| ^
2 |
// Prettier 2.8.2
(let)[0] = 2;
Fix semicolon duplicated at the end of LESS file (#14007 by @mvorisek)
// Input
@​variable: {
field: something;
};
// Prettier 2.8.1
@​variable: {
field: something;
}; ;
// Prettier 2.8.2
@​variable: {
field: something;
};
Fix no space after unary minus when followed by opening parenthesis in LESS (#14008 by @mvorisek)
// Input
.unary_minus_single {
margin: -(@​a);
}
.unary_minus_multi {
margin: 0 -(@​a);
}
.binary_minus {
margin: 0 - (@​a);
}
// Prettier 2.8.1
.unary_minus_single {
margin: - (@​a);
}
.unary_minus_multi {
margin: 0 - (@​a);
}
.binary_minus {
margin: 0 - (@​a);
}
// Prettier 2.8.2
.unary_minus_single {
margin: -(@​a);
}
.unary_minus_multi {
margin: 0 -(@​a);
}
.binary_minus {
margin: 0 - (@​a);
}
Do not change case of property name if inside a variable declaration in LESS (#14034 by @mvorisek)
// Input
@​var: {
preserveCase: 0;
};
// Prettier 2.8.1
@​var: {
preservecase: 0;
};
// Prettier 2.8.2
@​var: {
preserveCase: 0;
};
Fix formatting for auto-accessors with comments (#14038 by @fisker)
// Input
class A {
@​dec()
// comment
accessor b;
}
// Prettier 2.8.1
class A {
@​dec()
accessor // comment
b;
}
// Prettier 2.8.1 (second format)
class A {
@​dec()
accessor; // comment
b;
}
// Prettier 2.8.2
class A {
@​dec()
// comment
accessor b;
}
Add parentheses for TSTypeQuery to improve readability (#14042 by @onishi-kohei)
// Input
a as (typeof node.children)[number]
a as (typeof node.children)[]
a as ((typeof node.children)[number])[]
// Prettier 2.8.1
a as typeof node.children[number];
a as typeof node.children[];
a as typeof node.children[number][];
// Prettier 2.8.2
a as (typeof node.children)[number];
a as (typeof node.children)[];
a as (typeof node.children)[number][];
Fix displacing of comments in default switch case (#14047 by @thorn0)
It was a regression in Prettier 2.6.0.
// Input
switch (state) {
default:
result = state; // no change
break;
}
// Prettier 2.8.1
switch (state) {
default: // no change
result = state;
break;
}
// Prettier 2.8.2
switch (state) {
default:
result = state; // no change
break;
}
Support type annotations on auto accessors via babel-ts (#14049 by @sosukesuzuki)
The bug that @babel/parser cannot parse auto accessors with type annotations has been fixed. So we now support it via babel-ts parser.
class Foo {
accessor prop: number;
}
Fix formatting of empty type parameters (#14073 by @fisker)
// Input
const foo: bar</* comment */> = () => baz;
// Prettier 2.8.1
Error: Comment "comment" was not printed. Please report this error!
// Prettier 2.8.2
const foo: bar</* comment */> = () => baz;
Add parentheses to head of ExpressionStatement instead of the whole statement (#14077 by @fisker)
// Input
({}).toString.call(foo) === "[object Array]"
? foo.forEach(iterateArray)
: iterateObject(foo);
// Prettier 2.8.1
({}.toString.call(foo) === "[object Array]"
? foo.forEach(iterateArray)
: iterateObject(foo));
// Prettier 2.8.2
({}).toString.call(foo.forEach) === "[object Array]"
? foo.forEach(iterateArray)
: iterateObject(foo);
Fix comments after directive (#14081 by @fisker)
// Input
"use strict" /* comment */;
// Prettier 2.8.1 (with other js parsers except `babel`)
Error: Comment "comment" was not printed. Please report this error!
// Prettier 2.8.2
<Same as input>
Fix formatting for comments inside JSX attribute (#14082 by @fisker)
// Input
function MyFunctionComponent() {
<button label=/*old*/"new">button</button>
}
// Prettier 2.8.1
Error: Comment "old" was not printed. Please report this error!
// Prettier 2.8.2
function MyFunctionComponent() {
<button label=/*old*/ "new">button</button>;
}
Quote numeric keys for json-stringify parser (#14083 by @fisker)
// Input
{0: 'value'}
// Prettier 2.8.1
{
0: "value"
}
// Prettier 2.8.2
{
"0": "value"
}
Fix removing commas from function arguments in maps (#14089 by @sosukesuzuki)
/* Input */
$foo: map-fn(
(
"#{prop}": inner-fn($first, $second),
)
);
/* Prettier 2.8.1 */
$foo: map-fn(("#{prop}": inner-fn($first $second)));
/* Prettier 2.8.2 */
$foo: map-fn(
(
"#{prop}": inner-fn($first, $second),
)
);
Do not insert space in LESS property access (#14103 by @fisker)
// Input
a {
color: @​colors[@​white];
}
// Prettier 2.8.1
a {
color: @​colors[ @​white];
}
// Prettier 2.8.2
<Same as input>
v2.8.1
Fix SCSS map in arguments (#9184 by @agamkrbit)
// Input
$display-breakpoints: map-deep-merge(
(
"print-only": "only print",
"screen-only": "only screen",
"xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})",
),
$display-breakpoints
);
// Prettier 2.8.0
$display-breakpoints: map-deep-merge(
(
"print-only": "only print",
"screen-only": "only screen",
"xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, " sm
")-1})",
),
$display-breakpoints
);
// Prettier 2.8.1
$display-breakpoints: map-deep-merge(
(
"print-only": "only print",
"screen-only": "only screen",
"xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})",
),
$display-breakpoints
);
Support auto accessors syntax (#13919 by @sosukesuzuki)
Support for Auto Accessors Syntax landed in TypeScript 4.9.
(Doesn't work well with babel-ts parser)
class Foo {
accessor foo: number = 3;
}
v2.8.0
isaacs/rimraf (rimraf)
v5.0.1
v5.0.0
v4.4.1
v4.4.0
v4.3.1
v4.3.0
v4.2.0
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.7
v4.0.6
v4.0.5
v4.0.4
v4.0.3
v4.0.2
v4.0.1
v4.0.0
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.