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())),
];
```
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
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.
**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`
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