Commit graph

2171 commits

Author SHA1 Message Date
Cameron
c61ea76b73
fix(linter) improve diagnostic for no useless spread (#1698)
closes #1697
2023-12-16 17:47:55 +00:00
Boshen
03a02c8b99
chore(CONTRIBUTING): use the website content 2023-12-16 21:02:52 +08:00
Boshen
38ed86972c
ci: bump upload-artifact and download-artifact to v4 for release oxlint 2023-12-16 20:56:36 +08:00
Cameron
73a655f5b5
fix(linter) remove parsing of extends eslint config (#1695)
See https://github.com/oxc-project/oxc/issues/1672

we can bring this back (or a version of it) once we work out how we
want`extends` to work.
2023-12-16 12:46:27 +00:00
msdlisper
6a90cd4af4
feat(linter): add jsx-a11y settings (#1668)
When we developed linter for #1141 , we needed to configure some
settings for `jsx-a11y`, which was not supported before, but I am trying
to support it now.
like this:
```
fn config() -> serde_json::Value {
    serde_json::json!([2,{
        "ignoreNonDOM": true
    }])
}

fn settings() -> serde_json::Value {
    serde_json::json!({
        "jsx-a11y": {
            "components": {
                "Button": "button",
            }
        }
    })
}

let pass = vec![
    ("<Button />", Some(config()), Some(settings())),
];
```
2023-12-16 13:45:14 +08:00
Boshen
cf91379d1b
ci: fix codecov not executing on conformance tests 2023-12-16 13:38:40 +08:00
Cameron
6268f3f2f4
fix(linter) Fix false positives in prefer string start, ends with, port more test cases (#1689)
closes #1687 - uses `intersection` instead of `||`:
 - this improves performance as it combines the flags into a single bitmask instead of doing two seperate checks
 - 

Adds missing test cases from eslint-plugin-unicorn
2023-12-15 17:08:42 +00:00
Andy Armstrong
d101acf833
fix(linter): prefer-string-starts-ends-with: ignore i and m modifiers. (#1688)
Fixes: #1687
2023-12-15 17:00:43 +00:00
Cameron
9f990ce677
fix(linter) false positive in jsx key (#1686) 2023-12-15 22:25:14 +08:00
Cameron
0d7e166f4b
refactor: use new_without_config for jsx_key (#1685) 2023-12-15 11:40:07 +00:00
Cameron
0a8746c751
fix(linter): Panic in prefer string starts, ends with (#1684)
Closes #1683
2023-12-15 11:35:01 +00:00
zoomdong
0f77e5dc52
chore: remove unsless oxc_resolve ci files (#1682) 2023-12-15 10:37:46 +00:00
Dunqing
32db5d29b3
feat(tasks/transformer): add function name plugin (#1676)
The plugin is added at https://github.com/oxc-project/oxc/pull/1510.
2023-12-15 11:29:34 +08:00
yoshi2no
cf0793b675
feat(linter): tabindex-no-positive for eslint-plugin-jsx-a11y (#1677)
partof: #1141

I've implemented `tabindex-no-positive` rule for jsx_a11y

originals:

- doc:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/tabindex-no-positive.md
- code:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/tabindex-no-positive.js
- test:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/tabindex-no-positive-test.js
2023-12-15 11:17:38 +08:00
Herrington Darkholme
c63f5123b3
feat(parser/napi): add flexbuffer to AST transfer (2x speedup) (#1680)
Hi! I have created a proof of concept of improving using oxc in
JavaScript. The method is not polished but it provides valuable insights
for future direction!

Feel free to close~ It is for reference only :)

# Context 

This is a proof of concept implementation of passing binary AST to
JavaScript. JavaScript can selectively read flexbuffers-based AST nodes
on demand to avoid the deserialization toll. More context
[here](https://dev.to/herrington_darkholme/benchmark-typescript-parsers-demystify-rust-tooling-performance-2go8).

# Changes

* Add a `parseSyncBuffer` napi method to return a binary AST from Rust
to JavaScript. The AST is in flexbuffer format.
* Add a `test_buffer.js` to test usage of flexbuffers in JavaScript. It
is in cjs format because flexbuffers does not support ESM :/

# Result
Some preliminary results, for reference only.

```
~ node test_buffer.js
testJSON: 4.043s
testBuffer: 2.395s
```

Buffer based API is 100% faster than JSON.

# Future Ideas
* Flexbuffers itself is slow. A better binary protocol is desired!
* Using binary reader to traverse AST is undesirable. A proxy-based API
to emulate object behavior will be nice.
2023-12-15 02:52:33 +00:00
IWANABETHATGUY
37d5152cce
feat(vscode): use icon to represent enabled status (#1675) 2023-12-14 20:59:26 +08:00
RiESAEX
e5752a5462
fix(linter): fix excape_case panicing on unicode strings (#1673)
fix: #1671
2023-12-14 20:32:16 +08:00
Boshen
ddab18f5af
chore: update snapshots - upgrading bun fixes this??? 2023-12-14 16:58:47 +08:00
Cameron
9275c749ca
feat(linter) Parse eslint configuration (#1146)
**DRAFT**

Adds support for parsing `eslint` configuration files.

Example: 
```sh
cargo run --bin=oxc_cli lint --config-path ./.eslintrc.json .
```

This isn't a full implementation of how eslint parses configs but should
be fine for now:

Currently supported `extends`:
 - `eslint:recommended` -> `eslint`
 - `plugin:react/recommended` -> `react`
 - `plugin:@typescript-eslint/recommended` -> `typescript`
 - `plugin:react-hooks/recommended` -> `react`
 - `plugin:unicorn/recommended` -> `unicorn`
 - `plugin:jest/recommended` -> `jest`

These defaults can _all_ be overridden by configuring the rule in the
`rules` section of the estlint config:

e.g.
```json
{
    "extends": [
        "eslint:recommended"
    ],
    "rules": {
        "eqeqeq": "off"
    },
}
```

This would enable of of the rules within the `eslint` group. But would
not enable `eqeqeq` as it is explicitly disabled

Note, we do not currently support the following:
 - supplying a `filter` and `config-path`
 - supplying a `plugin` and `config-path`
2023-12-14 16:29:27 +08:00
Hao Cheng
c9589b5447
feat(linter): eslint-plugin-unicorn/prefer-prototype-methods (#1660) 2023-12-14 14:55:03 +08:00
Boshen
8edcab82f2
chore(lexer): document the accessor keyword 2023-12-14 12:55:55 +08:00
IWANABETHATGUY
e529b38e32
feat: add option to control enable/disable oxc linter (#1665)
1. Closed https://github.com/oxc-project/oxc/issues/1655
2023-12-14 12:45:34 +08:00
Wenzhe Wang
d719af473c
refactor(linter): make some jest rules report more detailed (#1666) 2023-12-14 11:05:06 +08:00
IWANABETHATGUY
7594a9d10f
chore: format typescript and json file in editors/vscode (#1667)
1. just format, nothing else
2023-12-14 02:01:24 +08:00
Wenzhe Wang
90524c83f7
feat(linter): add eslint-plugin-import(export) rule (#1654) 2023-12-13 23:12:45 +08:00
Wenzhe Wang
c49a1f6b32
feat(prettier): add print_binaryish_expressions (#1664) 2023-12-13 22:52:53 +08:00
Dunqing
f58b6279c8
feat(transformer): add arrow_functions plugin (#1663) 2023-12-13 20:46:28 +08:00
Dunqing
67b7cc0f51
feat(ast): support visit more jsx ast in visit (#1662) 2023-12-13 20:41:44 +08:00
Ken-HH24
282771afc4
feat(linter): eslint-plugin-unicorn prefer-dom-node-text-content(style) (#1658)
Implement [prefer-dom-node-text-content](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md) for #684 .
2023-12-13 12:19:00 +00:00
Dunqing
00806384ff
perf(linter/react): find class node by symbols in get_parent_es6_component (#1657)
This way we can get the class node faster. But I don't know if this is a
good way. In `eslint-plugin-react`, they get class node by scope. But
oxc cannot do the same way
2023-12-13 13:48:53 +08:00
Dunqing
864176a051
feat(transformer/react-jsx): returns ThisExpression when identifier is this (#1661) 2023-12-13 13:47:54 +08:00
Boshen
31600ac8de
Release oxlint and vscode extension v0.0.20 2023-12-13 13:37:06 +08:00
Boshen
425e318e9a
chore: update homepage links 2023-12-13 13:36:27 +08:00
Boshen
4ced3f949c
refactor(linter): separate out the category in the output of --rules 2023-12-13 13:23:52 +08:00
Boshen
ca009d5995
chore(linter): move prefer-array-flat to pedantic 2023-12-13 13:16:18 +08:00
IWANABETHATGUY
e63576d03c
feat(vscode): add a option to control oxc lint timing (#1659)
1. Closed https://github.com/oxc-project/oxc/issues/1653
2. Now you use `oxc-client.run` to control the lint timing.


[录屏 2023年12月12日
23时39分16秒.webm](https://github.com/oxc-project/oxc/assets/17974631/123326dc-6110-4f2e-9d48-ef1a3b0a4536)
2023-12-13 11:40:39 +08:00
Boshen
117d95f0ae
fix(linter): improve the span message for no-accumulating-spread 2023-12-12 16:28:37 +08:00
Wenzhe Wang
ea293c4e94
chore(ci): change to labeler-v5's style (#1656) 2023-12-12 12:35:43 +08:00
dependabot[bot]
5fa3b43d93
chore(deps): bump actions/labeler from 4 to 5 (#1652) 2023-12-11 14:33:48 +08:00
dependabot[bot]
a3b52fb548
chore(deps): bump the dependencies group with 7 updates (#1651) 2023-12-11 14:21:56 +08:00
Boshen
69c056be79
chore: remove crates/oxc_parser/README.md 2023-12-11 13:59:03 +08:00
Cameron
295822d7d4
feat(linter) eslint plugin unicorn: prefer array flat (#1650) 2023-12-10 23:19:30 +08:00
Cameron
ef740c3754
fix: improve span for no accumulating spread (#1644)
Closes #1643
2023-12-10 23:18:39 +08:00
Ken-HH24
e331cc2677
feat(transformer): duplicate keys (#1649) 2023-12-10 18:07:32 +08:00
Cameron
65c07728fc
fix: remove escapes in no array reduce test cases (#1647) 2023-12-10 09:42:40 +00:00
Cameron
a09060be33
fix: remove escapes in prefer regexp test test cases (#1645) 2023-12-10 09:37:41 +00:00
Cameron
9bea2780d9
feat(linter) eslint-plugin-react: react-in-jsx-scope (#1025)
Co-authored-by: wenzhe <mysteryven@gmail.com>
2023-12-10 17:08:43 +08:00
Ken-HH24
b425b73087
feat(linter): eslint-plugin-unicorn prefer-modern-dom-apis(style) (#1646) 2023-12-10 16:10:59 +08:00
Dunqing
0c19991471
feat(prettier): print CallExpression arguments correctly (#1631) 2023-12-10 15:59:13 +08:00
Boshen
e2d5763d22
fix(vscode): fix the broken package path 2023-12-08 21:19:00 +08:00