39 Commits

Author SHA1 Message Date
Sneh Khatri
a943f576d1
Fix duplicate declaration error on ambient class declarations (#14016) 2021-12-05 18:24:56 +01:00
Nicolò Ribaudo
2d989a983d
Run tests in a native Node.js ESM environment (#13966) 2021-12-03 15:32:58 +01:00
Nicolò Ribaudo
29de280006
Use Node.js interop when importing lib in test (#13995) 2021-11-29 21:48:34 +01:00
Nicolò Ribaudo
75996cb62b
Use full import specifier path in tests (#13938) 2021-11-24 11:43:18 +01:00
Huáng Jùnliàng
29f697c84e
Implement @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression (#13842)
* fix: register function expression id after params

* implement bugfix plugin

* add more testcases

* fix: do not skip pattern binding referencing id

* update compat-table

* add bugfix plugin to preset-env

* update Babel 8 test fixtures

* Update packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/README.md

* chore: bundle bugfix plugin

* address review comments

* add runtime version check

* update compat table

* fix syntax error

* update test fixtures

* revert bugfixes targets update

* update Babel 8 test fixtures
2021-10-20 15:53:40 -04:00
Huáng Jùnliàng
49a0d65be1
Mark static block as FunctionParent (#13832)
* refactor: move StaticBlock definition to core

* update generated types

* fix: mark StaticBlock as FunctionParent

* revise testcase

* update babel-types docs
2021-10-10 20:22:27 -04:00
Huáng Jùnliàng
4eda1c8605
chore: bump eslint and its plugins (#13412) 2021-06-03 23:42:32 -04:00
overlookmotel
792672ec60
Fix scope of computed method keys (#12812)
* Fix scope of computed method keys

* Test for nested computed keys

* Fix scope.rename with computed method keys

* Optional chaining tests
2021-02-19 02:36:34 +01:00
Huáng Jùnliàng
4462eeae6b
Clean up traverse scope (#12797) 2021-02-16 23:23:34 +01:00
Nicolò Ribaudo
b5b95f81dc
Add @babel/traverse tests for re-exported bindings (#12429) 2020-12-06 19:33:21 +01:00
Nicolò Ribaudo
dd5a977048
Revert "Mark ThisExpression and Super as Purish" (#12307) 2020-11-04 11:50:46 +01:00
Nicolò Ribaudo
df908fc63b
Mark ThisExpression and Super as Purish (#12251)
* Mark `ThisExpression` as `Purish`

The other purish types are functions and literals, so I
guess it means "it doesn't have side effects"

* Super & tests

* Fix tests
2020-10-27 13:12:49 +01:00
Wojciech Maj
1dd94e813e
Replace non-inclusive "whitelist" and "blacklist" terms with "allowlist" etc. (#11758) 2020-06-29 15:39:38 -04:00
Bogdan Savluk
4108524856
Update prettier to v2 (#11579)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-07 22:21:33 +02:00
Zen
83d365acb6
handle objectMethod in scope.isPure (#11482) 2020-04-25 18:34:52 +02:00
Mateusz Burzyński
70cc111b35
Fixed generateUid creating clashing ids after scope re-crawling (#11375) 2020-04-07 17:32:46 +02:00
Mateusz Burzyński
025e4ae44c
Fixed issue with programPath.scope.references not being regist… (#11323) 2020-03-24 16:27:32 +01:00
Huáng Jùnliàng
865d5155c2
Add eslint-plugin-jest (#11119)
* chore: add eslint-plugin-jest

* chore: update test sources

* chore: suppress preset-env debug log when linting
2020-02-11 00:11:32 +09:00
Erlend Tobiassen
740064ced7 Fix missing ClassDeclaration references after scope#crawl (#11011)
* Bug replication test

* Simplify test

* Fixes #10896

* Merge path.crawl `ClassDeclaration` and `Declaration` visitors

Merged to avoid subtle assumption that `Declaration` is called before `ClassDeclaration`

* Move registartion of class id in crawl to BlockScoped

* Add some assertions to crawl test
2020-01-19 21:32:05 -05:00
Huáng Jùnliàng
fc5365fe4a
Fix parameter expression get binding (#10912)
* fix: parameter expression closure should not have access to the declaration inside function body

* fix: renameVisitor should skip when a pattern is a scope

* address review comments
2019-12-24 15:18:46 -05:00
Daniel Tschinder
b32d271fee
Migrate some duplicate binding tests to traverse (#9532)
* Migrate try-catch duplicate error

* Remove exception for functions and let in the same scope

* Migrate duplicate bindings tests to traverse

* Add test for subscope and let/const

* Add more test cases
2019-02-19 21:25:49 -08:00
Chaitanya Kumar Kamatham
daf0ca8680 Rename "babylon" to "@babel/parser" (#7937) 🎉 2018-05-19 00:03:05 -04:00
Rubén Norte
bc6f0f989d Re-add support for local Flow bindings (TypeAlias, OpaqueTypeAlias and Interface) (#7900) 2018-05-17 10:54:14 -07:00
Deven Bansod
8b57a3e3b9 Migrate a few packages' tests to use Jest Expect (see below)
* Migrate the following packages' tests:
    * babel-helper-annotate-as-pure
    * babel-helper-module-imports
    * babel-helper-transform-fixture-test-runner
    * babel-highlight
    * babel-node
    * babel-plugin-transform-modules-commonjs
    * babel-preset-env-standalone
    * babel-preset-env
    * babel-preset-es2015
    * babel-preset-react
    * babel-standalone
    * babel-template
    * babel-traverse
    * babel-types
2018-03-24 16:22:10 +05:30
Nicolò Ribaudo
9a231c5671 Remove support for flow bindings (#6528)
Flow bindings have been deprecated for a while.
The reason behind this change is that `declare var foo`
doesn't introduce a new local binding, but it represents
a global one.
2017-11-09 12:29:04 -08:00
Ruben Verborgh
6560a29c36 Redeclaring a variable counts as a modification (#6219)
* Redeclaring a variable counts as a modification.

Fixes #6217.

* Remove "existing" logic from Binding.

Was added in #5745, but no longer triggered since 6536e605a.
2017-09-08 23:02:26 -04:00
Daniel Tschinder
44f6ff5e85 Update prettier, eslint + plugins, flow, husky and lint-staged (#6183) 2017-08-31 22:56:29 +02:00
Ash
960e1708a1 babel-traverse: Mark appropriate template literals as pure (#5914)
* Identify pure template literals

* Mark template literals as pure where possible

* Changes based on code review

* nit
2017-07-11 17:42:34 -04:00
Brian Ng
e4b35f680d
Run prettier 2017-06-27 12:15:00 -05:00
Mauro Bringolf
c142bbc429 Remove duplicated getStatementParent and refactor requires to imports in tests (#5746)
* Additional testcase and require->import refactorings

* Removed duplicated getStatementParent function. Refactored all babel-traverse tests to use ESmodules
2017-05-31 15:33:25 -04:00
Brian Ng
8a82cc060a Run new lint rules (#5413) 2017-03-04 10:46:01 -05:00
Jason Laster
ff2c24eed2 Add test for reference paths (#5296) 2017-02-15 15:05:31 -05:00
Logan Smyth
b845f2b69d Re-enable the max-len ESLint rule. (#5265) 2017-02-04 11:07:15 -05:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Juriy Zaytsev
beda884f41 Make getBinding ignore labels; add Scope#getLabel, Scope#registerLabel (#4758)
* Make getBinding ignore labels; add Scope#getLabel, Scope#registerLabel

* generateUid: account for labels again
2016-10-21 17:19:59 -04:00
Andrew Levine
9f8ab29213 Change usage of "suite"/"test" in unit-tests to "describe"/"it" (#4734)
Fixes #4733
2016-10-15 18:45:35 -04:00
Andrew Levine
c0038221d7 Run ESLint on test files, and fix lint errors in test files (#4732) 2016-10-15 18:27:48 -04:00
Amjad Masad
2a2cb4f160 Support ObjectProperty in purity check 2015-12-09 16:49:16 -08:00
Sebastian McKenzie
e72d4508de only use outer bindings when registering a binding to prevent retreiving function params - fixes #2615 2015-11-03 03:00:27 +00:00