Dunqing
e4d66e4636
fix(transformer/arrow-functions): store super_methods on a Stack to fix nested async methods ( #8331 )
...
In the following case, async methods can be nested in another async method. The implementation is changing to store `super_methods` on a stack, and then we can store super method information in the correct `super_methods` map.
```js
const outer = {
value: 0,
async method() {
() => super.value;
const inner = {
value: 0,
async method() {
() => super.value;
}
};
() => super.value;
}
};
```
2025-01-08 21:00:45 +00:00
sapphi-red
8d52cd0a5e
feat(minifier): merge assign expression in conditional expression ( #8345 )
...
compresses `a ? b = 0 : b = 1` into `b = a ? 0 : 1`
This can be done when `b` is an IdentifierReference and the assignment operator is `=`.
In this circumstance, the evaluation of `b = a ? 0 : 1` is:
1. Let lref be ? Evaluation of LeftHandSideExpression. (this does not have a side effect when LeftHandSideExpression is an IdentifierReference)
2. Let rref be ? Evaluation of AssignmentExpression. (ConditionalExpression is evaluated here)
3. Let rval be ? GetValue(rref).
4. Perform ? PutValue(lref, rval).
5. Return rval.
**References**
- [spec of `=`](https://262.ecma-international.org/15.0/index.html#sec-assignment-operators-runtime-semantics-evaluation )
- [spec of `? :`](https://262.ecma-international.org/15.0/index.html#sec-conditional-operator-runtime-semantics-evaluation )
2025-01-08 13:34:12 +00:00
sapphi-red
a69d15f299
feat(minifier): compress new Array(2) -> [,,] ( #8344 )
...
For an integer value `n` smaller than 6, `Array(n)` can be compressed to `[,,]` (the number of `,` is `n`).
2025-01-08 12:07:46 +00:00
Yuji Sugiura
8e3eed7562
refactor(prettier): Update tasks/prettier to correctly handle snapshots ( #8337 )
...
I refactored the code in `tasks/prettier_conformance` primarily to make
the output more readable when using `--filter`.
But I also discovered that our previous implementation did not correctly
handle Prettier's behavior of adding a blank line at the EOF.
In addition, I resolved a problem where test specs that used patterns
like `runFormatTest(_, parsers)` were unable to locate the correct
snapshot output.
As a result, compatibility has also improved slightly. 😉
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-08 17:10:30 +08:00
Boshen
6220e05f38
feat(minifier): remove empty if statment if (test) {} -> test ( #8336 )
2025-01-08 08:50:10 +00:00
sapphi-red
ec88c68c28
feat(minifier): compress a || (a = b) to a ||= b ( #8315 )
...
Compress `a || (a = b)` to `a ||= b` and for other logical operators that are possible to.
I didn't find other minifiers doing this, but this is safe for identifiers. [Quoting MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR_assignment#description ):
> Logical OR assignment short-circuits, meaning that `x ||= y` is equivalent to `x || (x = y)`, except that the expression x is only evaluated once.
I actually checked the spec and the only difference was that `Let lRef be ? Evaluation of LeftHandSideExpression` was done twice. Evaluating an IdentifierReference is idempotent so it should be safe to do this compression.
References:
- [Spec of `&&=`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-assignment-operators:~:text=Return%20r.-,AssignmentExpression,7.%20Return%20rVal.,-AssignmentExpression )
- [Spec of `=`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#prod-AssignmentExpression:~:text=Runtime%20Semantics%3A%20Evaluation-,AssignmentExpression,6.%20Return%20rVal.,-AssignmentExpression )
- [Spec of `&&`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-binary-logical-operators:~:text=Runtime%20Semantics%3A%20Evaluation-,LogicalANDExpression,5.%20Return%20%3F%C2%A0GetValue(rRef).,-LogicalORExpression )
I think this is safe for `a.b || (a.b = foo)` as well because the number of `GetValue` and `SetValue` does not change, but I didn't include that in this PR.
2025-01-07 23:19:52 +00:00
sapphi-red
e6fe84d674
feat(minifier): compress a = a + b to a += b ( #8314 )
...
Compress `a = a + b` to `a += b` and for other binary operators that are possible to.
2025-01-07 23:19:50 +00:00
sapphi-red
9ea4e31ba3
feat(minifier): remove new from new Error/new Function/new RegExp ( #8313 )
...
Remove `new` from some cases:
- `new Error(...)` -> `Error(...)`: `new` can be removed unconditionally, [spec](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-error-constructor:~:text=Thus%20the%20function%20call%20Error(%E2%80%A6)%20is%20equivalent%20to%20the%20object%20creation%20expression%20new%20Error(%E2%80%A6)%20with%20the%20same%20arguments .)
- `new Function(...)` -> `Function(...)`: `new` can be removed unconditionally, [spec](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-function-constructor:~:text=Thus%20the%20function%20call%20Function(%E2%80%A6)%20is%20equivalent%20to%20the%20object%20creation%20expression%20new%20Function(%E2%80%A6)%20with%20the%20same%20arguments .)
- `new RegExp(nonRegexp)` -> `RegExp(nonRegexp)`: `new` can be removed if there's no argument or the first argument is not regex object, [mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp#return_value ), [spec](https://tc39.es/ecma262/multipage/text-processing.html#sec-regexp-constructor:~:text=when%20called%20as%20a%20function%20rather%20than%20as%20a%20constructor%2C%20returns%20either%20a%20new%20RegExp%20object%2C%20or%20the%20argument%20itself%20if%20the%20only%20argument%20is%20a%20RegExp%20object .). I made this to happen if the first argument is not an object.
2025-01-07 14:48:56 +00:00
Dunqing
775a289a55
fix(transformer/arrow-functions): _this = this should be inserted after super call expression ( #8024 )
...
related: #7792
This PR doesn't contain fixing the async arrow function in `super()`, which is difficult for our architecture. I just found that `esbuild`'s implementation is quite simpler! https://esbuild.github.io/try/#dAAwLjI0LjAALS10YXJnZXQ9ZXMyMDE2AGNsYXNzIEMgZXh0ZW5kcyBTIHsKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKGFzeW5jICgpID0+IHRoaXMpOwogICAgYXN5bmMoKSA9PiB7fQogIH0KfQ
2025-01-07 13:53:44 +00:00
Boshen
051fbb6909
feat(minifier): minimize x["0"] -> x[0] ( #8316 )
2025-01-07 13:12:35 +00:00
Boshen
a542013773
feat(minifier): minimize do{}while(true) -> do;while(true) ( #8311 )
2025-01-07 12:55:03 +00:00
Boshen
e3ff81ef82
feat(minifier): minimize (x = 1) === 1 -> (x = 1) == 1 ( #8310 )
2025-01-07 07:48:35 +00:00
Yuji Sugiura
30cee0e47e
feat(prettier): Print tagged template literal ( #8307 )
...
Part of #5068
First steps for template literals... 🗻
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-07 14:25:14 +08:00
camc314
5ed439bcaf
feat(minifier): minify typeof in binary expressions ( #8302 )
2025-01-06 23:26:19 +00:00
overlookmotel
d8b27afc35
refactor(ast)!: no unneccesary trailing underscores on AstBuilder method names ( #8283 )
...
`AstBuilder` method names have an `_` added on end if method name is not a valid identifier (e.g. `super`). But no need for trailing underscore on `alloc_super`.
Currently this only applies to `super`. But future-proof by checking against all Rust's reserved words.
This is a breaking change, because `alloc_super` method was previously called `alloc_super_`. But probably no-one uses that method anyway - usually you'd use `expression_super` method to get an `Expression::Super`.
2025-01-06 15:09:05 +00:00
overlookmotel
0db2a22e48
refactor(ast): AstBuilder enum builder methods use alloc_* methods ( #8281 )
...
Pure refactor. `AstBuilder` methods can use `alloc_*` methods directly, instead of calling `alloc`. Probably this makes no difference to performance as all these methods are marked `#[inline]` anyway. But in general it's better to use methods which don't return large objects on the stack.
2025-01-06 15:09:04 +00:00
overlookmotel
cd0c2dc6f7
test(transformer): remove repeated code from fixtures updating script ( #8287 )
...
Pure refactor / tidy up. These 2 lines are repeated twice.
2025-01-06 11:55:00 +00:00
Boshen
b8d26eab17
refactor(minifier): move optional catch param to peephole_substitute_alternate_syntax ( #8282 )
2025-01-06 10:47:56 +00:00
underfin
2e7207f11c
fix(transformer/typescript): should strip import specifiers type with only_remove_type_imports ( #8141 )
...
close: https://github.com/oxc-project/oxc/issues/8140
close: https://github.com/rolldown/rolldown/issues/3244
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2025-01-06 18:20:16 +08:00
Boshen
f87da160df
fix(minifier): do not fold literals in -0 != +0 ( #8278 )
2025-01-06 10:08:57 +00:00
camc314
e446c15619
feat(minifier): improve minimizing unary not expressions ( #8261 )
2025-01-06 02:21:26 +00:00
camc314
7f19211736
feat(minifier): minimize unary expression statements ( #8256 )
...
`delete` cannot be minified as it may have side effect.
2025-01-06 02:21:24 +00:00
Boshen
4d8a08d2ac
feat(minifier): improve constant evaluation ( #8252 )
2025-01-05 12:41:57 +00:00
camc314
3c534aeb5a
refactor(linter): refactor LintBuilder to prep for nested configs ( #8034 )
...
More simplification/preparations for nested configurations:
1. renames `LinterBuilder` to `ConfigStoreBuilder`
2. moves the `options` logic out of `LintBuilder`
3. make `ConfigStoreBuilder::build()` return a result (currently always returns OK, but it will return errors when nested config is implemented
The next steps to implement nested config which i hope to do in the next week are:
1. refactor the `from_oxlintrc` to accept a file path
2. introduce a new method on `ConfigStoreBuilder` (name TBC) that walks all child directories, collecting `.oxlintrc` files. these will be put into `ConfigStore` as a hash map of path > config.
2025-01-05 04:08:26 +00:00
Boshen
2f52f333fa
feat(minifier): minsize !!!foo ? bar : baz -> foo ? baz : bar ( #8244 )
2025-01-04 09:10:22 +00:00
Boshen
ce2b5a994b
chore(minifier): disable RemoveUnusedCode ( #8243 )
...
A lot of edge cases fail in test262 and monitor-oxc.
2025-01-04 08:49:20 +00:00
Boshen
ad9a0a9c4a
feat(mininifier): minimize variants of a instanceof b == true ( #8241 )
2025-01-04 06:04:52 +00:00
Boshen
ccdc039f54
feat(minifier): always put literals on the rhs of equal op 1==x => x==1 ( #8240 )
2025-01-04 04:07:54 +00:00
Boshen
bf0fbcea6e
refactor(minifier): improve constant fold numbers ( #8239 )
...
Ported esbuild's implementation
2025-01-04 03:30:20 +00:00
Cameron
39353b22e9
feat(minifier): improve minimizing conditionals ( #8238 )
2025-01-04 08:36:54 +08:00
camc314
c90fc16bba
feat(minifier): restore conditional minification and fix edge case ( #8235 )
...
This restore's the changes made in #8233 , but fixing the edge cases.
If the conditional expression is not a child of an `IfStatementTest`, `WhileStatementTest`, `DoWhileStatementText` or `ExpressionStatementExpression`, we must coerce the test to a boolean.
2025-01-03 14:20:42 +00:00
Boshen
6c8ee9fdef
feat(minifier): remove last redundant return statement ( #8234 )
2025-01-03 12:24:57 +00:00
Boshen
a698deff51
fix(minifier): fix incorrect return value for (x ? true : y) ( #8233 )
...
Need to check if the return value is used or not:
```
function foo() {
return foo ? true : bar; // no transformed
}
foo ? true : bar; // transformed to `foo || bar;`
```
2025-01-03 11:58:28 +00:00
Boshen
51f47926ef
feat(minifier): minimize foo ? foo : bar and foo ? bar : foo ( #8229 )
2025-01-03 10:55:59 +00:00
Boshen
6e2ec17d51
feat(minifier): statement fusion switch cases; improved minimize exit poitns ( #8228 )
2025-01-03 10:07:04 +00:00
Boshen
574a2428fd
feat(minifier): minimize all variants of typeof x == 'undefined' ( #8227 )
2025-01-03 07:05:55 +00:00
Boshen
2041477f51
feat(minifier): fold if(x)return;y -> if(!x)y ( #8226 )
2025-01-03 05:24:53 +00:00
Alexander S.
37d31ecef9
fix(tasks/lint_rules): sync unicorn rules with eslint rules ( #8224 )
...
👀 promise/spec-only is implemented but not found in their rules
👀 unicorn/consistent-existence-index-check is implemented but not found
in their rules
👀 unicorn/prefer-math-min-max is implemented but not found in their
rules
> [!WARNING]
> This comment is maintained by CI. Do not edit this comment directly.
> To update comment template, see
https://github.com/oxc-project/oxc/tree/main/tasks/lint_rules
This is tracking issue for `eslint-plugin-unicorn`.
There are 120(+ 17 deprecated) rules.
- 24/113 recommended rules are remaining as TODO
- 7/7 not recommended rules are remaining as TODO
To get started, run the following command:
```sh
just new-unicorn-rule <RULE_NAME>
```
Then register the rule in `crates/oxc_linter/src/rules.rs` and also
`declare_all_lint_rules` at the bottom.
## Recommended rules
<details open>
<summary>
✨ : 89, 🚫 : 0 / total: 113
</summary>
| Status | Name | Docs |
| :----: | :--- | :--- |
| | unicorn/better-regex |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/better-regex.md
|
| ✨ | unicorn/catch-error-name |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/catch-error-name.md
|
| ✨ | unicorn/consistent-empty-array-spread |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/consistent-empty-array-spread.md
|
| ✨ | unicorn/consistent-function-scoping |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/consistent-function-scoping.md
|
| ✨ | unicorn/empty-brace-spaces |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/empty-brace-spaces.md
|
| ✨ | unicorn/error-message |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/error-message.md
|
| ✨ | unicorn/escape-case |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/escape-case.md
|
| | unicorn/expiring-todo-comments |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/expiring-todo-comments.md
|
| ✨ | unicorn/explicit-length-check |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/explicit-length-check.md
|
| ✨ | unicorn/filename-case |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/filename-case.md
|
| | unicorn/import-style |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/import-style.md
|
| ✨ | unicorn/new-for-builtins |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/new-for-builtins.md
|
| ✨ | unicorn/no-abusive-eslint-disable |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-abusive-eslint-disable.md
|
| ✨ | unicorn/no-anonymous-default-export |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-anonymous-default-export.md
|
| | unicorn/no-array-callback-reference |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-array-callback-reference.md
|
| ✨ | unicorn/no-array-for-each |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-array-for-each.md
|
| | unicorn/no-array-method-this-argument |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-array-method-this-argument.md
|
| | unicorn/no-array-push-push |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-array-push-push.md
|
| ✨ | unicorn/no-array-reduce |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-array-reduce.md
|
| ✨ | unicorn/no-await-expression-member |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-await-expression-member.md
|
| ✨ | unicorn/no-await-in-promise-methods |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-await-in-promise-methods.md
|
| ✨ | unicorn/no-console-spaces |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-console-spaces.md
|
| ✨ | unicorn/no-document-cookie |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-document-cookie.md
|
| ✨ | unicorn/no-empty-file |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-empty-file.md
|
| | unicorn/no-for-loop |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-for-loop.md
|
| ✨ | unicorn/no-hex-escape |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-hex-escape.md
|
| ✨ | unicorn/no-instanceof-array |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-instanceof-array.md
|
| | unicorn/no-invalid-fetch-options |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-invalid-fetch-options.md
|
| ✨ | unicorn/no-invalid-remove-event-listener |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-invalid-remove-event-listener.md
|
| ✨ | unicorn/no-length-as-slice-end |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-length-as-slice-end.md
|
| ✨ | unicorn/no-lonely-if |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-lonely-if.md
|
| ✨ | unicorn/no-magic-array-flat-depth |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-magic-array-flat-depth.md
|
| ✨ | unicorn/no-negated-condition |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-negated-condition.md
|
| ✨ | unicorn/no-negation-in-equality-check |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-negation-in-equality-check.md
|
| ✨ | unicorn/no-nested-ternary |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-nested-ternary.md
|
| ✨ | unicorn/no-new-array |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-new-array.md
|
| ✨ | unicorn/no-new-buffer |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-new-buffer.md
|
| ✨ | unicorn/no-null |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-null.md
|
| ✨ | unicorn/no-object-as-default-parameter |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-object-as-default-parameter.md
|
| ✨ | unicorn/no-process-exit |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-process-exit.md
|
| ✨ | unicorn/no-single-promise-in-promise-methods |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-single-promise-in-promise-methods.md
|
| ✨ | unicorn/no-static-only-class |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-static-only-class.md
|
| ✨ | unicorn/no-thenable |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-thenable.md
|
| ✨ | unicorn/no-this-assignment |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-this-assignment.md
|
| ✨ | unicorn/no-typeof-undefined |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-typeof-undefined.md
|
| ✨ | unicorn/no-unnecessary-await |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-unnecessary-await.md
|
| | unicorn/no-unnecessary-polyfills |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-unnecessary-polyfills.md
|
| ✨ | unicorn/no-unreadable-array-destructuring |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-unreadable-array-destructuring.md
|
| ✨ | unicorn/no-unreadable-iife |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-unreadable-iife.md
|
| ✨ | unicorn/no-useless-fallback-in-spread |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-useless-fallback-in-spread.md
|
| ✨ | unicorn/no-useless-length-check |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-useless-length-check.md
|
| ✨ | unicorn/no-useless-promise-resolve-reject |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-useless-promise-resolve-reject.md
|
| ✨ | unicorn/no-useless-spread |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-useless-spread.md
|
| ✨ | unicorn/no-useless-switch-case |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-useless-switch-case.md
|
| ✨ | unicorn/no-useless-undefined |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-useless-undefined.md
|
| ✨ | unicorn/no-zero-fractions |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-zero-fractions.md
|
| ✨ | unicorn/number-literal-case |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/number-literal-case.md
|
| ✨ | unicorn/numeric-separators-style |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/numeric-separators-style.md
|
| ✨ | unicorn/prefer-add-event-listener |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-add-event-listener.md
|
| | unicorn/prefer-array-find |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-array-find.md
|
| ✨ | unicorn/prefer-array-flat-map |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-array-flat-map.md
|
| ✨ | unicorn/prefer-array-flat |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-array-flat.md
|
| | unicorn/prefer-array-index-of |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-array-index-of.md
|
| ✨ | unicorn/prefer-array-some |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-array-some.md
|
| | unicorn/prefer-at |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-at.md
|
| ✨ | unicorn/prefer-blob-reading-methods |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-blob-reading-methods.md
|
| ✨ | unicorn/prefer-code-point |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-code-point.md
|
| ✨ | unicorn/prefer-date-now |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-date-now.md
|
| | unicorn/prefer-default-parameters |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-default-parameters.md
|
| ✨ | unicorn/prefer-dom-node-append |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-dom-node-append.md
|
| ✨ | unicorn/prefer-dom-node-dataset |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-dom-node-dataset.md
|
| ✨ | unicorn/prefer-dom-node-remove |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-dom-node-remove.md
|
| ✨ | unicorn/prefer-dom-node-text-content |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-dom-node-text-content.md
|
| ✨ | unicorn/prefer-event-target |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-event-target.md
|
| | unicorn/prefer-export-from |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-export-from.md
|
| ✨ | unicorn/prefer-includes |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-includes.md
|
| | unicorn/prefer-keyboard-event-key |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-keyboard-event-key.md
|
| ✨ | unicorn/prefer-logical-operator-over-ternary |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-logical-operator-over-ternary.md
|
| ✨ | unicorn/prefer-math-trunc |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-math-trunc.md
|
| ✨ | unicorn/prefer-modern-dom-apis |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-modern-dom-apis.md
|
| ✨ | unicorn/prefer-modern-math-apis |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-modern-math-apis.md
|
| | unicorn/prefer-module |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-module.md
|
| ✨ | unicorn/prefer-native-coercion-functions |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-native-coercion-functions.md
|
| ✨ | unicorn/prefer-negative-index |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-negative-index.md
|
| ✨ | unicorn/prefer-node-protocol |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-node-protocol.md
|
| ✨ | unicorn/prefer-number-properties |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-number-properties.md
|
| | unicorn/prefer-object-from-entries |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-object-from-entries.md
|
| ✨ | unicorn/prefer-optional-catch-binding |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-optional-catch-binding.md
|
| ✨ | unicorn/prefer-prototype-methods |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-prototype-methods.md
|
| ✨ | unicorn/prefer-query-selector |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-query-selector.md
|
| ✨ | unicorn/prefer-reflect-apply |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-reflect-apply.md
|
| ✨ | unicorn/prefer-regexp-test |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-regexp-test.md
|
| ✨ | unicorn/prefer-set-has |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-set-has.md
|
| ✨ | unicorn/prefer-set-size |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-set-size.md
|
| | unicorn/prefer-spread |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-spread.md
|
| ✨ | unicorn/prefer-string-raw |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-string-raw.md
|
| ✨ | unicorn/prefer-string-replace-all |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-string-replace-all.md
|
| ✨ | unicorn/prefer-string-slice |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-string-slice.md
|
| ✨ | unicorn/prefer-string-starts-ends-with |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-string-starts-ends-with.md
|
| ✨ | unicorn/prefer-string-trim-start-end |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-string-trim-start-end.md
|
| ✨ | unicorn/prefer-structured-clone |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-structured-clone.md
|
| | unicorn/prefer-switch |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-switch.md
|
| | unicorn/prefer-ternary |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-ternary.md
|
| | unicorn/prefer-top-level-await |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-top-level-await.md
|
| ✨ | unicorn/prefer-type-error |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-type-error.md
|
| | unicorn/prevent-abbreviations |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prevent-abbreviations.md
|
| | unicorn/relative-url-style |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/relative-url-style.md
|
| ✨ | unicorn/require-array-join-separator |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/require-array-join-separator.md
|
| ✨ | unicorn/require-number-to-fixed-digits-argument |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/require-number-to-fixed-digits-argument.md
|
| ✨ | unicorn/switch-case-braces |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/switch-case-braces.md
|
| | unicorn/template-indent |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/template-indent.md
|
| ✨ | unicorn/text-encoding-identifier-case |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/text-encoding-identifier-case.md
|
| ✨ | unicorn/throw-new-error |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/throw-new-error.md
|
✨ = Implemented, 🚫 = No need to implement
</details>
## Not recommended rules
<details open>
<summary>
✨ : 0, 🚫 : 0 / total: 7
</summary>
| Status | Name | Docs |
| :----: | :--- | :--- |
| | unicorn/consistent-destructuring |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/consistent-destructuring.md
|
| | unicorn/custom-error-definition |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/custom-error-definition.md
|
| | unicorn/no-keyword-prefix |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-keyword-prefix.md
|
| | unicorn/no-unused-properties |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/no-unused-properties.md
|
| | unicorn/prefer-json-parse-buffer |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/prefer-json-parse-buffer.md
|
| | unicorn/require-post-message-target-origin |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/require-post-message-target-origin.md
|
| | unicorn/string-content |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/rules/string-content.md
|
✨ = Implemented, 🚫 = No need to implement
</details>
## Deprecated rules
<details >
<summary>
✨ : 0, 🚫 : 0 / total: 17
</summary>
| Status | Name | Docs |
| :----: | :--- | :--- |
| | unicorn/import-index |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#import-index
|
| | unicorn/no-array-instanceof |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#no-array-instanceof
|
| | unicorn/no-fn-reference-in-iterator |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#no-fn-reference-in-iterator
|
| | unicorn/no-reduce |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#no-reduce
|
| | unicorn/no-unsafe-regex |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#no-unsafe-regex
|
| | unicorn/prefer-dataset |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-dataset
|
| | unicorn/prefer-event-key |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-event-key
|
| | unicorn/prefer-exponentiation-operator |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-exponentiation-operator
|
| | unicorn/prefer-flat-map |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-flat-map
|
| | unicorn/prefer-node-append |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-node-append
|
| | unicorn/prefer-node-remove |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-node-remove
|
| | unicorn/prefer-object-has-own |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-object-has-own
|
| | unicorn/prefer-replace-all |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-replace-all
|
| | unicorn/prefer-starts-ends-with |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-starts-ends-with
|
| | unicorn/prefer-text-content |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-text-content
|
| | unicorn/prefer-trim-start-end |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#prefer-trim-start-end
|
| | unicorn/regex-shorthand |
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v55.0.0/docs/deprecated-rules.md#regex-shorthand
|
✨ = Implemented, 🚫 = No need to implement
</details>
2025-01-03 11:39:51 +08:00
Boshen
2da4365fbe
feat(parser): missing initializer in destructuring declaration inside for loop head ( #8222 )
...
closes #8220
2025-01-02 14:02:49 +00:00
Boshen
9c1afa4729
feat(minifier): optional catch binding when catch param is unused ( #8221 )
2025-01-02 13:20:49 +00:00
Boshen
2786dea164
feat(minifier): add RemoveUnusedCode ( #8210 )
2025-01-02 12:50:21 +00:00
Cameron
cd274eeb02
feat(minifier): minimize logical exprs ( #8209 )
2025-01-02 18:32:20 +08:00
Boshen
cd349a312d
chore(tasks/coverage): do not run minifier in script mode ( #8213 )
2025-01-01 14:56:43 +00:00
Boshen
05be1fc639
fix(minifier): remove incorrect fold Expression::AssignmentExpression ( #8211 )
2025-01-01 05:44:01 +00:00
camc314
4ae15df042
feat(minifier): imprve more conditional expr minification with boolean lit ( #8208 )
2025-01-01 02:31:18 +00:00
camc314
3202b4fed0
feat(minifier): imprve conditional expr minification with boolean lit ( #8207 )
2025-01-01 02:31:18 +00:00
camc314
3b4501183c
feat(minifier): handle conditional expr with boolean lit ( #8206 )
2025-01-01 02:31:17 +00:00
camc314
4c2059af29
feat(minifier): reverse negated conditional exprs ( #8205 )
2025-01-01 02:31:17 +00:00
Dunqing
e5ee38fdf1
chore(transformer): enable class-properties plugin ( #7750 )
...
Done!
2024-12-31 12:30:58 +00:00
Dunqing
0592a8b43f
feat(transformer/class-properties): transform private in expression ( #8202 )
...
This PR support transforms `#prop in object` in class-properties to cover https://www.npmjs.com/package/@babel/plugin-transform-private-property-in-object plugin does
2024-12-31 12:30:58 +00:00