Commit graph

760 commits

Author SHA1 Message Date
Wenzhe Wang
0c645170a8
feat(linter): valid-describe-callback(eslint-plugin-jest) (#706) 2023-08-12 16:47:49 +08:00
u9g
9566378119
feat(query): add many types to oxc_query (#724)
Adds `Name(AST)?`, `IfStatementAST`, `SpreadIntoObject(AST)?`,
`ObjectEntry(AST)?`, `DotProperty(AST)?` types

Fixes `ObjectLiteral`'s value field's output type

Added `entry` field to `ObjectLiteral(AST)?`
2023-08-12 16:43:58 +08:00
Boshen
9935eb1259 feat(resolver): pass on query string from alias fields 2023-08-11 19:46:57 +08:00
Boshen
17e525cc0f feat(resolver): complete browser_field implementation 2023-08-11 19:46:57 +08:00
Boshen
fdf288c685
refactor: improve code coverage in various places (#721) 2023-08-11 15:17:49 +08:00
u9g
c6ed90900c
feat(query): Add name to class (#720) 2023-08-11 14:36:40 +08:00
u9g
97c5cd379e
feat(query): Add right to VariableDeclaration (#718) 2023-08-11 05:40:35 +00:00
u9g
9c05866cc1
feat(query): add NumberLiteral type (#717) 2023-08-11 05:37:29 +00:00
u9g
c7fc1d99b5
feat(query): add name to interface (#716) 2023-08-11 05:22:12 +00:00
u9g
a953a96529
fix(query): make ObjectLiteralAST implement ObjectLiteral (#715) 2023-08-11 05:15:22 +00:00
Boshen
8c7109b24e
feat(resolver): check for infinite recursion (#714) 2023-08-11 12:53:42 +08:00
u9g
99a4816ce7
feat(website): add query playground (#698) 2023-08-11 10:53:21 +08:00
Boshen
17a6f63c31
refactor(resolver): remove the leading dot trim on extensions 2023-08-10 21:05:48 +08:00
Boshen
11954326b3 feat(resolver): implement main_fields 2023-08-10 19:48:30 +08:00
Boshen
f717cb02e3 feat(resolver): add exports_fields and main_fields for logging purposes. 2023-08-10 19:48:30 +08:00
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
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
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