Sosuke Suzuki and fisker Cheung
92a6af22e7
Remove prefer-ast-path-node and add prefer-ast-path-getters ( #13648 )
...
* Support `getParent`
* Fix
* Fix
* Refactor
* Rename rule and add tests
* Fix by rule
* Fix error message
* Add error message tests
* Run Prettier!
* Address review
* Improve error message
* Refactor
* Stricter check & refactor
* Minor tweak
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2022-10-18 14:23:13 +09:00
Georgii Dolzhykov
6d4d011252
Fix unstable embedded template literals ( #13532 )
2022-09-26 16:24:41 +03:00
fisker Cheung
9bacc75772
Use .at() and Object.hasOwn() ( #13482 )
2022-09-18 17:50:14 +08:00
Sosuke Suzuki
e92dcbd1a5
Add new ESLint prefer-ast-path-node ( #13470 )
...
* Add new lint rule `prefer-path-get-value`
* Add new rule
* Apply fix
* Ingore projects in benchmark
* Add comment
2022-09-11 18:39:06 +09:00
Georgii Dolzhykov
87d724f418
Refactor: use path.getValue() everywhere instead of getNode() ( #13447 )
...
Use path.getValue() everywhere instead of getNode()
2022-09-08 21:11:00 +03:00
Georgii Dolzhykov
41ff44e0c6
Refactor, optimize and fix call args expansion ( #13341 )
2022-08-29 14:37:09 +03:00
fisker Cheung
e096ea7552
Use try/finally in AstPath ( #13216 )
2022-08-05 21:58:54 +08:00
fisker Cheung
cdb1494170
Revert "Switch print/embed to async ( #13104 )" ( #13210 )
2022-08-02 18:11:34 +08:00
fisker Cheung
8dae4abf41
Switch print/embed to async ( #13104 )
2022-07-17 16:10:06 +08:00
fisker Cheung
2bcee631a2
Refactor: Import document/*.js directly ( #12739 )
2022-04-29 14:04:17 +08:00
fisker Cheung
54835025d5
Migrate JS language to ES Module ( #12342 )
2022-02-21 15:53:02 +08:00
Sosuke Suzuki
d13feed42b
Reduce JS parsers bundle size ( #12156 )
...
* Extract utils
* utils.js -> utils/index.js
* Fix linter
2022-01-26 23:29:19 +09:00
fisker Cheung
894f841fbd
Style: Enforce extensions ( #11227 )
2021-07-21 09:10:34 +08:00
Sosuke Suzuki
f1e0f639c3
refactor: Add isObjectProperty util function ( #10942 )
...
* Add isObjectProperty
* Rename to isProperty
* Address review
* Address review2
* Make isProperty strict
* Rename to isObjectProperty
2021-05-25 11:07:08 +09:00
fisker Cheung
4d37ac46a3
Add __babel_estree parser ( #10910 )
2021-05-19 09:22:52 +08:00
Sosuke Suzuki
6b204193c0
Improve formatting for Module Blocks Proposal ( #10758 )
...
* Improve
* Add tests
* Fix tests
* Detect specified option object expression
2021-04-27 12:11:53 +09:00
Georgii Dolzhykov and fisker Cheung
bc90973cad
Avoid arg expansion that leads to broken code ( #10712 )
...
* Avoid arg expansion that leads to broken code
* Preserve new lines and only take comments into account if they break lines
* Add robustness against path state corruption due to throwing
* Refactor
* Remove redundant logic
It solved the same issue but only partially.
* Simplify further
* Refactor path.try, fix callParent issue
* Minor refactoring
* Add istanbul ignore comment
* Add return to AstPath#try
Co-authored-by: fisker Cheung <lionkay@gmail.com >
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2021-04-20 15:02:11 +03:00
Sosuke Suzuki
0cdc62e405
Improve formatting for do expression ( #10693 )
2021-04-12 04:22:44 +03:00
fisker Cheung and Georgii Dolzhykov
7cc52da144
Simplified printGenerically ( #10557 )
...
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2021-03-22 16:57:03 +02:00
fisker Cheung
863eb079dc
Forbid AstPath.call without name ( #10541 )
2021-03-15 17:20:27 +08:00
Georgii Dolzhykov
2740ea6ee8
Avoid last-argument hugging for number-only arrays ( #10517 )
2021-03-14 12:15:53 +02:00
046ffb11f9
Support better formatting for curried arrow functions ( #9992 )
...
* Support formatting for curried arrow functions
* Fix test file name
* Fix threshold
* Add changelog
* Fix operator for comparing
* Fix return pos
* Fix eslint
* level 2
* Refactor for level2
* Update tests
* Remove concat
* If it fits on one line, print on one line
* Indent second level arg
* Break before last return value
* Use isCallLikeExpression
* Improve printing
* Add tests
* Remove unnecesary condition
* Fix lint problems
* Update src/language-js/utils.js
Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com >
* Update changelog
* Add ImportExpression
* Add ImportExpression to isCallLikeExpression
* Resolve conflicts
* Address reviews
* Fix ESLint problem
* Fix changelog
* Add tests
* More tests
* Print simple arrow chains on one line
* Don't forcibly break chain when a segment has a return type but no params
* Prevent excessive wrapping in assignments
* Simplify
* Format object bodies like blocks
* Update changelog
* Fix last arg expansion
* Simplify
* Fix arrow chains in assignment chains
Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com >
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2021-03-08 23:18:53 +02:00
Georgii Dolzhykov
81e6208e63
Allow arg hugging for non-concise arrow functions with return type ( #10316 )
2021-02-15 19:13:09 +02:00
Sosuke Suzuki
2598803a2a
Improve formatting for React Hooks call ( #10238 )
...
* Add isReactHookCallWithDepsArray
* Improve formatting for React hooks call
* Refactor
* Add changelog
* Use isReactHookCallWithDepsArray in shouldGroupLastArg
* Support general pattern
2021-02-14 23:57:26 +02:00
fisker Cheung
6ecb30a5ae
Refactor ChainElement related parts ( #10245 )
...
* Rename `isCallOrOptionalCallExpression` -> `isCallExpression`
* Replace use of `OptionalCallExpression`
* Fix
* Add `isMemberExpression`
* Check truly in `isCallExpression` and `isMemberExpression`
* Replace `OptionalMemberExpression`
* Remove unneeded check
* Fix type check
2021-02-05 01:04:54 +02:00
fisker Cheung
ce26805e84
Enable unicorn/prefer-spread ( #10129 )
2021-01-26 09:46:14 +08:00
fisker Cheung
7b24335064
Refactor: Use Doc[] instead of concat() ( #9993 )
2021-01-11 13:46:05 +08:00
fisker Cheung
358ad36a84
Forbid use concat() in concat() ( #9998 )
2021-01-11 10:19:13 +08:00
fisker Cheung and Sosuke Suzuki
7ec7a0f21f
Fix using concat() on single Doc ( #9994 )
...
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com >
2021-01-04 14:40:02 +08:00
fisker Cheung
d55d4e90d8
Add JS version isNextLineEmpty ( #9925 )
2020-12-18 10:14:14 +08:00
fisker Cheung
334609d81e
Fix comments.js import style ( #9917 )
2020-12-17 12:09:55 +08:00
fisker Cheung
89402482ee
Consistent Jsx case in variables ( #9871 )
2020-12-15 12:23:40 +08:00
fisker Cheung
d8e40cd978
JS: Add hasComment and getComments ( #9742 )
2020-11-25 22:14:27 +08:00
fisker Cheung
13c88511da
Refactor: Add getCallArguments and iterateCallArgumentsPath ( #9608 )
2020-11-11 10:02:47 +08:00
fisker Cheung
c7390d33b7
Refactor: Use locStart and locEnd directly from language-js/loc.js ( #9576 )
2020-11-04 08:52:02 +08:00
fisker Cheung and Sosuke Suzuki
bb31bf481c
Refactor function parameters print ( #9489 )
...
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com >
2020-10-26 09:22:37 +08:00
Chris Brody and fisker
cdc250c21a
typecheck updates & fixes in src/language-js ( #8759 )
...
Co-authored-by: fisker <lionkay@gmail.com >
2020-08-21 09:08:14 +08:00
fisker Cheung and sosukesuzuki
c8f9d254b9
Minor refactor ( #8752 )
...
Co-authored-by: sosukesuzuki <aosukeke@gmail.com >
2020-07-17 09:08:03 +08:00
fisker Cheung
350f641fca
Fix util import ( #8696 )
2020-07-05 00:34:35 +08:00
fisker Cheung
f55960af89
Support dynamic import ( #8530 )
...
* Support `ImportExpression`
* Fix print
2020-06-09 19:01:27 +03:00
Georgii Dolzhykov
20f02b06f3
Refactor printer-estree.js: extract printing of member chains and call args to separate files ( #8061 )
2020-04-15 22:31:08 +03:00