Commit Graph

25 Commits

Author SHA1 Message Date
Donny/강동윤
5520b236dd
refactor(es/parser): Rename EsConfig and TsConfig (#9094)
**Description:**

`EsConfig` and `TsConfig` sound like a general configuration for the whole language, while actually it's only about parsing.

To avoid a breaking change, I created type aliases that will work without changing the code, while warning the users.

**Related issue:**

 - Closes #9089.
2024-06-22 01:56:37 +09:00
pshu
c9c971a792
feat(es/lints): Detect duplicate bindings in export defaults (#8760)
**Description:**
add DefaultDecl's FnExpr and ClassExpr's ident to bindings. 
because all of them should be treated as hoisted Fn/Class Declare

```txt
  × the name `x` is defined multiple times
   ╭─[examples/all.js:1:1]
 1 │ export default class x{}
   ·                      ┬
   ·                      ╰── previous definition of `x` here
 2 │
 3 │ let x = 1;
   ·     ┬
   ·     ╰── `x` redefined here
 4 │ let t = function x(){};
   ╰────
```



**Related issue:**

 - Closes #8755
2024-03-19 14:39:06 +09:00
Donny/강동윤
0259a7465f
build(cargo): Update rustc to nightly-2023-03-20 (#7170)
**Description:**

This PR also updates `rkyv` to `=0.7.40`.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6807.
2023-03-30 08:06:02 +00:00
Donny/강동윤
12546c853a
build(cargo): Revert rustc upgrade (#7162)
**Description:**

The `rkyv` bug is not fixed.
2023-03-29 17:48:45 +09:00
Donny/강동윤
e445502072
build(cargo): Update rustc to nightly-2023-03-28 (#7154)
**Description:**

This PR also updates `rkyv` to `=0.7.40`.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6807.
2023-03-29 06:24:19 +00:00
OJ Kwon
43eeeb35a5
feat(es/plugin): Pass experimental metadata from host (#5261) 2022-07-21 05:34:48 +00:00
OJ Kwon
b7c7e3afb0
test(es/plugin): Test plugins with different schema versions (#5255) 2022-07-20 04:08:48 +00:00
Austaras
bef8aebdea
fix(es/lints): Allow overload in typescript (#5116) 2022-07-06 01:33:58 +09:00
Austaras
9519e801ea
fix(es/resolver): Fix handling of block scoped functions (#5092) 2022-07-05 05:04:49 +00:00
Austaras
4a422a09a4
fix(es/lints): Allow duplicate function in non-top level (#5011) 2022-06-21 13:22:23 +00:00
Donny/강동윤
6a97c7bef8
fix(es/utils): Fix wrong apis (#4604)
# API Changes

## `swc_ecma_utils`

### Renames

 - `find_ids` => `find_pat_ids`
 - `prepend` => `prepend_stmt`
 - `as_bool` => `cast_to_bool`
 - `as_number` => `as_pure_number`
 - `as_string` => `cast_to_string`
 - (`as_pure_bool`, `cast_to_number` is not renamed)
 - `UsageFinder` => `IdentUsageFinder`.
 - `IdentFinder` => `IdentRefFinder`.

## Changes

 - Re-export of `HANDLER` from `swc_common::errors` is removed. Use `swc_common::error::HANDLER` instead.
 - Re-export of `Id` from `swc_ecma_ast` is removed. Use `swc_ecma_ast::Id` instead.
 - `ExprCtx` is used for apis related to `Expr`.
 - `preserve_effects` is now a method of `ExprCtx`. It was a top-level function.
 - `extract_side_effects_to` is now a method of `ExprCtx`. It was a top-level function.
 - `IdentUsageFinder` (previously `UsageFinder`) now takes `Id` instead of `Ident`.
 - `IdentRefFinder` (previously `IdentFinder`) now takes `Id` instead of `Ident`.
 - `ExprExt::is_ident_ref_to` is removed.
 - `Expr::is_global_ref_to` is added.
 - `:🆔:id` is removed. Use `Ident::to_id()` instead.
2022-05-11 04:36:22 +00:00
Donny/강동윤
53610fdafc
feat(es/resolver): Use different syntax context for unresolved refs (#4436)
- We don't need a list of bindings to check if an identifier is unresolved.
 - Checking if an identifier is unresolved is now one CPU instruction.
   - Previously it was one hashmap operation.
 - This PR also improves performance, by removing the hashmaps mentioned above.
2022-04-26 07:38:50 +00:00
magic-akari
fce554cfb0
fix(es/lints): Ignore type-only imports while checking duplicates (#4163) 2022-03-26 15:25:17 +09:00
Donny/강동윤
f28134fe77
feat(es/lints): Mark catch params as binding patterns while checking duplicates (#3981) 2022-03-12 03:02:22 +00:00
Donny/강동윤
c6b5371c51
fix(es/lints): Don't visit types while collecting const (#3967) 2022-03-11 17:41:28 +09:00
Donny/강동윤
45a4374ee1
fix(wasm): Fix handling of swc_common::GLOBALS (#3936) 2022-03-10 03:59:46 +00:00
magic-akari
0181fbe63b
feat(es/lints): Support module/script mode in duplicate_bindings (#3880)
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
2022-03-07 05:49:39 +00:00
magic-akari
d10e66285b
fix(es/lints): Ignore identifiers used as types while checking for duplicate bindings (#3869) 2022-03-06 02:29:21 +09:00
magic-akari
3e29b73a2a
feat(es/lints): Implement no-dupe-args rule (#3574) 2022-02-16 11:07:42 +00:00
Artur
5d6143a53c
feat(es/lints): Implement linter for quotes of string literals (#3443) 2022-02-07 08:12:14 +00:00
Artur
5cbe4fe512
feat(es/lints): Add no-alert and a feature gate (#3394)
swc_ecma_lints:
 - Implement `no-alert`
 - Add a feature gate for non-critical rules.
2022-02-02 14:43:46 +00:00
Artur
987213797f
feat(es/lints): Implement "no-console" rule (#3269)
swc_ecma_lints:
 - Add types for general configuration.
 - Add `no-console`rule.

swc:
 - Expose the lint config via `jsc.lints`.
2022-01-26 20:39:19 +09:00
magic-akari
f4b3cb714a
fix(es/resolver): Treat a switch statement as a block scope (#3275) 2022-01-15 17:20:17 +09:00
Donny/강동윤
978de5943e
chore(ci): Configure clippy (#3250) 2022-01-13 23:06:11 +09:00
Donny/강동윤
913c82a2ab
fix(es/lints): Fix incorrect duplicate binding error (#3194)
swc_ecma_transforms_base:
 - `resolver`: Fix resolving of `const` and `let`.

swc_ecma_lints:
 - `duplicate_bindings`: Don't mark ambient function declararions as a binding. (Closes #3193)
2022-01-05 11:59:10 +09:00