Commit graph

1090 commits

Author SHA1 Message Date
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
Boshen
3b9cc474e9
feat(resolver): port the rest of the exports field tests (#659) 2023-07-30 01:03:10 +08:00
阿良仔
e090b560be
feat(minifier): initialize conditions folding (#658)
related: #401
2023-07-30 01:02:32 +08:00
Boshen
ee211baabc
Release oxlint v0.0.7 2023-07-29 13:40:35 +08:00
Boshen
4b34c447f4
chore(linter): only check no-this-alias in TypeScript 2023-07-29 12:42:35 +08:00
Boshen
92348f1830
chore(linter): change no-loss-of-precision to nursery 2023-07-29 12:40:57 +08:00
Don Isaac
6628fc8d9c
perf(linter): reduce mallocs (#654)
Reduces mallocs via `clones()` (particularly of `Atom`s), and vec
allocations.

Affects the following rules:
- [x] eslint/no-dupe-keys
- [x] eslint/no-global-assign
- [x] eslint/no-loss-of-precision _(only partially optimized, needs more
work later)_
~- [ ] typescript-eslint/ajacent-overload-signatures~ (_will be
addressed in following pr_)
2023-07-29 12:02:53 +08:00
Boshen
976aa28f67
chore(linter): move no-var-requires to restriction
The code is not wrong, nor useless, it is just a restriction in typescript
2023-07-29 11:49:07 +08:00
Boshen
c42a61f34f feat(cli): separate warnings and errors numbers and print separately 2023-07-29 11:02:51 +08:00
Boshen
f23a0347fd chore(linter): move adjacent-overload-signatures to style
Per the typescript-eslint v6 change
2023-07-29 11:02:51 +08:00
Boshen
f5c9908550 fix(linter): improve the span for no-inner-declarations 2023-07-29 11:02:51 +08:00
Boshen
e4020d6fb2 fix(linter): change no-control-regex to severity warning 2023-07-29 11:02:51 +08:00
Boshen
fe54b1fbc9 chore(linter): move no-return-await to pedantic
Since this is not a eslint recommended rule
2023-07-29 11:02:51 +08:00
Boshen
1bc564eafc feat(linter): add style category and change no-empty-interface to style
It's officially change in typescript-eslint
2023-07-29 11:02:51 +08:00
Boshen
ad51157ea9 fix(linter): make disable directives work with plugin rule names 2023-07-29 11:02:51 +08:00
Boshen
edb3f8b634 fix(cli): improve the TIMING=1 table alignment 2023-07-29 11:02:51 +08:00
Devin-Yeung
72afdf6d19
feat(linter): eslint/no-loss-of-precision (#649)
Close #613
2023-07-28 20:59:20 +08:00
Boshen
fc0a4110d4
chore: update .git-blame-ignore-revs 2023-07-28 13:57:29 +08:00
Boshen
217997bd7c
chore(rust): run cargo fmt --all -- crates/**/*.rs 2023-07-28 13:57:12 +08:00
SoonIter
786cf8252f
feat(linter): implement no-global-assign (#624)
closes #598
2023-07-28 10:20:38 +08:00
Boshen
6631336f5c
feat(resolver): implement more of exports field (#648) 2023-07-28 10:19:29 +08:00
Boshen
5e0edf14fe
ci: remove accident push trigger from website.yml 2023-07-27 18:25:17 +08:00
Boshen
252d3342a1
feat(linter): add a run_once callback (#647)
For situations where you want to inspect the scopes and trivias.
2023-07-27 18:15:15 +08:00
Boshen
b338f5f53d
ci: ignore more crates from when running benchmark 2023-07-27 18:11:37 +08:00
Boshen
a760068eef
chore(Cargo.toml): update homepage link 2023-07-27 14:16:58 +08:00
Boshen
14164b22ed
chore(oxc): remove mention of nightly 2023-07-27 14:14:56 +08:00
Boshen
b52ec3f344
ci: remove cargo-udeps 2023-07-27 14:09:42 +08:00
Boshen
df90bf21ec
chore: update MAINTAINANCE.md 2023-07-27 14:09:39 +08:00
Boshen
1012d8300c
chore: release crates as v0.1.0 2023-07-27 13:54:17 +08:00
Boshen
d587065436
chore(rust): update crate info, add minimal rust-version, add categories 2023-07-27 13:33:18 +08:00
Boshen
45c1650631
chore(oxc_query): do not publish yet, it is not ready 2023-07-27 13:17:33 +08:00