Commit graph

1120 commits

Author SHA1 Message Date
Boshen
caf1dfbfcd fix(resolver): fix a case where package name and specifier is the wrong order 2023-08-10 19:48:30 +08:00
Boshen
66c9d764d1 fix(resolver): add a case with multi-dot filename 2023-08-10 19:48:30 +08:00
Boshen
8ae345bde0
chore(parser): add an AST Send example (#712)
relates #709

The allocator and lifetime gets in the way if we want to parse in
parallel but process them in a single thread.

This example uses `ouroboros` to provide a safe API for working with
this unsafe behavior.
2023-08-10 15:56:31 +08:00
Kei Sakamoto
3adca1ce08
feat(linter): implement @typescript-eslint/prefer-as-const (#707)
implement @typescript-eslint/prefer-as-const
Related issue: #503.
2023-08-10 15:48:24 +08:00
Boshen
2f48bdf26f
fix(parser,semantic): make semantic own Trivias (#711)
closes #708

Making the parser return Rc<Trivias> is not a good API, and ideally
`Semantic` should just own `Trivias` so it can process or mutate it.
2023-08-10 15:30:32 +08:00
Boshen
9714e46a02
feat(resolver): add tracing (#710) 2023-08-10 13:51:28 +08:00
Boshen
909d037f0d
refactor(resolver): clean up some code and tests 2023-08-09 23:21:03 +08:00
Alexandr Metreniuc
f8358a148a
feat(linter): @typescript-eslint/no-namespace (#703) 2023-08-09 23:02:24 +08:00
Boshen
17acbc4e02
fix(resolver): add derive to serde 2023-08-09 21:53:19 +08:00
Boshen
08a9ba3d5e
refactor(resolver): clean up the tests a little bit 2023-08-09 21:21:56 +08:00
Boshen
fdded5e97c
refactor(resolver): remove the identity-hash crate 2023-08-09 19:01:26 +08:00
Boshen
341c678b2f
fix(resolver): fix a case with multi-dot file extensions (#704) 2023-08-09 18:31:17 +08:00
Boshen
09761b4f8b
refactor(resolver): add a EnforceExtension tri state 2023-08-09 16:49:34 +08:00
Boshen
7c5ff9e27d
refactor(resolver): make Resolution::full_path not owned 2023-08-09 16:03:07 +08:00
Boshen
91fd375a3b
refactor(resolver): return package json error immediately instead of saving it (#702)
The error is propagated so there is no need to save it.
2023-08-09 14:28:44 +08:00
Boshen
89b49bdb07
doc(ast): document why Directive.directive is a raw string 2023-08-09 14:06:25 +08:00
Yunfei He
35167599bc
refactor(ast): use atom for Directive and Hashbang (#701)
The main reason is using Atom to remove the lifetime for convenience.

And after removing the lifetime of these nodes, the `Program<'a>`
doesn't rely on `&'a source` anymore, which allows us to [specify more
accurate
lifetimes](https://github.com/web-infra-dev/oxc/discussions/700).
2023-08-09 13:52:56 +08:00
Boshen
f5b8690309
refactor(resolver): improve code by looking at the code coverage (#697) 2023-08-08 15:44:37 +08:00
Boshen
43ae471fcc
ci: fix paths-ignore for conformance.yml 2023-08-08 14:36:49 +08:00
Boshen
abc7c9d608
chore: update codecov link 2023-08-08 14:31:52 +08:00
Boshen
5baa9b9d45
ci: filter out more files that trigger the CI jobs 2023-08-08 14:13:39 +08:00
Boshen
290a0e073f
ci: fix codecov not being uploaded from main 2023-08-08 14:04:38 +08:00
u9g
9c3005ff64
A bunch of improvements to the playground (#696) 2023-08-08 10:16:57 +08:00
Boshen
f4ba5d48e6
feat(resolver): implement recursive alias, file as alias and exports field with query / fragment (#695) 2023-08-07 21:10:49 +08:00
Makoto Tateno
c6245f855a
feat(linter): implement no-undef (#672)
Closes https://github.com/web-infra-dev/oxc/issues/619

I have tried to implement https://eslint.org/docs/latest/rules/no-undef

Note: Unsupported items are excluded from test cases in this PR by
commenting them out..
2023-08-07 21:02:56 +08:00
Boshen
9b2d3fce6b
feat(resolver): implement resolveToContext (#694) 2023-08-07 14:30:32 +08:00
Boshen
59f5dc1906
feat(resolver): implement restrictions (path only) (#693) 2023-08-07 13:50:42 +08:00
Don Isaac
38fb4c296a
test(semantic): test harness (#679)
A test harness for checking results of semantic analysis.

I got tired of writing ad-hoc test cases when finding bugs in semantic
analysis, so I made this.
2023-08-07 10:43:05 +08:00
Boshen
3bfa314e95
refactor(resolver): clean some code (#692) 2023-08-06 21:42:54 +08:00
阿良仔
8a915cec5c
feat: vscode extension (#690)
related: #688 .
There are some unfinished things that need to be finalised by Boshen.

1. Official icon and description for the package.
2. Publishing strategy ( It's probably not a good idea to use
`package.json` as a probe to publish extension, as there's too much
vscode configuration coupled to it, a git tag like `vscode_v0.0.x` might
be worth considering ).
3. License for the extension.
2023-08-06 21:28:49 +08:00
Boshen
658ef676f6
feat(resolver): implement the basics of ESM (#691) 2023-08-05 22:04:57 +08:00
Makoto Tateno
c5ff534b08
feat(semantic): add node_id to Reference (#689)
Closes #685 

Intend to use this in the following ways in #672.
```rs
let node = ctx.nodes().get_node(reference.node_id());
if !self.type_of && has_typeof_operator(node, ctx) {
    return;
}
```
2023-08-05 12:45:22 +08:00
Alexandr Metreniuc
d1531cd144
feat(linter): add no-extra-boolean-cast rule (#677)
Closes https://github.com/web-infra-dev/oxc/issues/596

Rule: [Docs](https://eslint.org/docs/latest/rules/no-extra-boolean-cast)
|
[Source](https://github.com/eslint/eslint/blob/main/lib/rules/no-extra-boolean-cast.js)
| [Tests
](https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-extra-boolean-cast.js)
2023-08-04 18:46:50 +08:00
Boshen
d21307827d
feat(resolver): implement fully specified (#687)
This is for turning off ESM's forced extension functionality.
2023-08-04 17:50:43 +08:00
Boshen
702d5b0120
refactor(resolver): change internal funcs to non-pub by moving to unit tests (#682) 2023-08-02 16:24:16 +08:00
Boshen
2e3934db49
feat(resolver): imports field (#681) 2023-08-02 15:54:07 +08:00
Wenzhe Wang
de110828cc
fix(task): update taggedTemplateExpression template (#676)
For generate test cases like:

```js
{
    code: dedent`
      afterAll(async (done) => {
        await myAsyncTask();
        done();
      });
    `,
    errors: [{ messageId: 'useAwaitInsteadOfCallback', line: 1, column: 17 }],
},
```
2023-08-02 11:46:15 +08:00
Don Isaac
e7d8d4ba46
feat(linter): enable module record builder 2023-08-02 11:44:27 +08:00
Boshen
c4669e1f78
feat(resolver): finish most of exports field (#674)
Found a behaviour mismatch: when an array is provided in exports field,
enhanced-resolve will try to read the file and try the next one if it
fails. But in the spec, the path is not read, it's only tested against
"invalid package target".

```
For each item targetValue in target, do
1. Let resolved be the result of PACKAGE_TARGET_RESOLVE( packageURL, targetValue, patternMatch, isImports, conditions), continuing the loop on any Invalid Package Target error.
2. If resolved is undefined, continue the loop.
3. Return resolved.
```

I tested against node.js and verifies node.js conforms to the spec.
2023-08-01 15:53:31 +08:00
Boshen
98e4240fe1
refactor(linter): manually declare lint rules because cargo fmt breaks (#671) 2023-07-31 15:16:21 +08:00
Devin-Yeung
ba8dbf5446
fix(linter): fix false positives in loss-of-precision lint (#664)
Almost rewrite the no-loss-of-precision lint, fix known false positives,
close #656

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2023-07-31 14:48:00 +08:00
Boshen
c956f7e897
refactor(cli): remove experimental code "module_tree_handler" (#670)
This code will eventually be superseded by
https://github.com/web-infra-dev/oxc/pull/530, removing this for now so
others don't have to touch this.
2023-07-31 12:40:14 +08:00
EliLichtblau
5e54bd0537
Adding types to the symbol table - consistent export type sample rule implemented (#667)
Fixes 11 TS conformance tests and 18 babel tests.

Adds types to the symbol table functionally conformant to TS behavior
but symbol flags implemented slightly differently.

Symbol redeclaration check is also not entirely conformant but fixing
this seems like a separate PR.

For testing purposes - consistent-export-type was also implemented
(WIP).
2023-07-31 12:33:47 +08:00
Don Isaac
d3accc1ee3
fix(semantic): nested references (#661)
Addresses #660
2023-07-31 12:29:15 +08:00
u9g
8b7b1381b5
chore(query): abstract away testing boilerplate (#669) 2023-07-31 10:05:24 +08:00
Don Isaac
47541339a9
feat(ast): AstKind::debug_name() (#665)
Adds `AstKind::debug_name()`, which returns the name of an AstKind
struct with a few minor details as applicable. I intentionally did not
make `AstKind` implement `Display`, as this method returns minimal
information. Additionally, this method only exists in debug builds. I've
hidden it behind a `#[cfg(debug_assertions)]`, so it won't affect
release builds.

This code was extracted from #642, where it as created while debugging
iteration over ancestor nodes. I figured it belonged in its own PR and
may be useful to other devs.
2023-07-31 10:04:52 +08:00
u9g
08e78bce16
feat(query): add ast counterpart to JSXOpeningElement (#668) 2023-07-30 19:51:25 -04:00
u9g
228cab9269
feat(query): add ast counterpart to ObjectLiteral (#666) 2023-07-30 18:15:57 -04:00
u9g
29ddca52b7
chore(query): condense XAST and X resolvers into one (#663)
No need to needlessly duplicate code.

**Future work:**

1. remove any breakout function that calls getspan...
2. maybe: make every type that can implement span (why don't we already)
2023-07-30 11:34:34 -04:00
Wenzhe Wang
3cf08a256c
feat(linter): no-focused-test(eslint-jest-plugin) (#609) 2023-07-30 20:57:30 +08:00