Commit graph

2308 commits

Author SHA1 Message Date
msdlisper
4c1673c2ca
feat(linter): use settings for eslint-plugin-jsx-a11y/html_has_lang (#1843)
Use eslint configuration settings e.g. defining a custom component `components` for  eslint-plugin-jsx-a11y/html_has_lang rule
2023-12-27 19:30:25 +00:00
Dunqing
b9bdf361e6
feat(semantic): improve check super implementation, reduce access nodes (#1827)
This improves the performance at which we can check that super is in a non-class.
2023-12-27 22:36:28 +08:00
Cameron
736803173b
feat(linter) oxc: only used in recursion (#1833)
Inspired by https://rust-lang.github.io/rust-clippy/master/#/only_used_in_recursion

Examples from VSCode Repo

<img width="1495" alt="Screenshot 2023-12-26 at 20 29 23" src="https://github.com/oxc-project/oxc/assets/18101008/77c14f22-112e-4423-8025-3729118a2632">
2023-12-27 22:32:26 +08:00
Dunqing
f7b7f0a512
feat(semantic): support get node id by scope id (#1826)
This is useful when we want to get the ast node that corresponds to the current scope.
2023-12-27 22:30:28 +08:00
Cameron
ea8a59b6bc
feat(linter) oxc: misrefactored assign op (#1832)
based on c9a43b18f1/clippy_lints/src/operators/misrefactored_assign_op.rs
2023-12-27 22:27:31 +08:00
Dunqing
f45a3cc2fa
feat(linter): support eslint/no-unused-private-class-members rule (#1820) 2023-12-27 22:24:12 +08:00
IWANABETHATGUY
de2f834774
chore: rename crate oxc_vscode to oxc_language_server (#1825)
1. Closed https://github.com/oxc-project/oxc/issues/1821
2023-12-26 23:01:12 +08:00
poteboy
0db2b84e24
refactor(linter): Simplify Parent Node Access in MediaHasCaption Rule (#1829)
This PR refactors the `MediaHasCaption` rule implementation, following
the suggestion in [#1822
(comment)](https://github.com/oxc-project/oxc/pull/1822#discussion_r1436430441).
The primary change involves simplifying the way the parent node is
accessed within the rule.
2023-12-26 14:25:03 +00:00
Dunqing
d63c50a5ca
refactor(semantic): improve check private identifier implementation (#1794)
The regression case in typescript is as expected since we don't
currently store `AccessorProperty` in `ClassTable`.

The following code is one of those cases

```ts
class C1 {
    accessor #a: any;
    accessor #b = 1;
    static accessor #c: any;
    static accessor #d = 2;

    constructor() {
        this.#a = 3;
        this.#b = 4;
    }

    static {
        this.#c = 5;
        this.#d = 6;
    }
}
```

But there was an error

```shell
Expect to Parse: "conformance/classes/propertyMemberDeclarations/autoAccessor2.ts"
  × Private field 'a' must be declared in an enclosing class
    ╭─[conformance/classes/propertyMemberDeclarations/autoAccessor2.ts:9:1]
  9 │     constructor() {
 10 │         this.#a = 3;
    ·              ──
 11 │         this.#b = 4;
    ╰────
```

Let's leave it alone for now. Because of the `AccessorProperty` I
haven't seen it in any repo.
2023-12-26 20:39:22 +08:00
poteboy
98895cad60
feat(linter): eslint-plugin-jsx-a11y media-has-caption (#1822)
Implemented
[eslint-plugin-jsx-a11y/media-has-caption](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/media-has-caption.md)
as part of #1141

- Ensures that every `<audio>` and `<video>` element in JSX has a
corresponding `<track kind="captions" />` element.
- If an `<audio>` or `<video>` element is muted (muted attribute
present), the rule does not require a `<track>` child element.
- When configuration or root settings map components to HTML elements,
the function `get_mapped_element_name` is utilized to determine the
correct element name.
2023-12-26 12:19:08 +00:00
Tapan Prakash
0280e06f59
feat(linter): Refine test for no-distracting-elements (#1824)
Added support for component settings for eslint-plugin-jsx-a11y
no-distracting-elements rule based on
https://github.com/oxc-project/oxc/pull/1668 PR.
Updated the test cases.
2023-12-26 12:15:37 +00:00
IWANABETHATGUY
c1bac34c76
fix(lsp): make the server available in nvim-lspconfig (#1823)
1. It seems that nvim-lspconfig diagnostics handler require **version**
of **document**, now we can use
`oxc_vscode` language server in neomvin with
[nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)


![image](https://github.com/oxc-project/oxc/assets/17974631/6b147333-341f-4226-a466-2b3d17b77215)
2023-12-26 16:37:25 +08:00
Cameron
7be3b1eec6
feat(linter) eslint plugin react: button has type (#1785) 2023-12-26 15:57:53 +08:00
msdlisper
f0ad356108
feat(linter): refine jsx-a11y settings (#1816)
refine jsx-a11y settings for #1141
2023-12-26 15:55:52 +08:00
Cameron
7d9d920148
feat(linter) oxc: approx constant (#1818)
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2023-12-26 12:19:44 +08:00
Cameron
ce851bb9a5
feat(linter) handle more cases for const-comparisons (#1817)
closes #1711
2023-12-26 10:25:26 +08:00
Dunqing
ca04312130
feat(semantic): add ClassTable (#1793) 2023-12-25 23:59:35 +08:00
IWANABETHATGUY
bd11b02cac
chore: better diagnostic when config is not a json file (#1813)
1. Closed https://github.com/oxc-project/oxc/pull/1804
2023-12-25 22:50:13 +08:00
msdlisper
d984d59e68
feat(linter): eslint-plugin-jsx-a11y lang (#1812)
lang linter for #1141
2023-12-25 18:36:55 +08:00
Boshen
601153fe8f
refactor(benchmark): use more complicated files (#1811)
closes #1806

---------

Co-authored-by: Dunqing <dengqing0821@gmail.com>
2023-12-25 17:27:02 +08:00
Boshen
c59508675d
chore(linter): remove the implementation from constructor_super
This should be implemented by a CFG
2023-12-25 15:37:49 +08:00
dependabot[bot]
868c35451d
chore(deps): bump the dependencies group with 5 updates (#1808) 2023-12-25 15:17:47 +08:00
秦宇航
ae27a8d1e6
feat(transformer): add partial support for babel-plugin-transform-instanceof (#1802) 2023-12-25 15:06:41 +08:00
Boshen
a1accdca7f
Release oxlint and vscode extension v0.0.22 2023-12-25 13:12:07 +08:00
Boshen
b4138aa657
feat(linter): change double-comparisons to correctness 2023-12-25 13:06:40 +08:00
Dunqing
d41e3fd268
feat(ast): enter/leave ClassBody and PrivateInExpression (#1792) 2023-12-25 10:52:21 +08:00
overlookmotel
1feec95a94
fix(parser) fix typo in expecting_directives variable name (#1801)
Renamves `expecting_diretives ` to `expecting_directives` to fix spelling
2023-12-24 16:51:02 +00:00
poteboy
32413f58ad
feat(linter): eslint-plugin-jsx-a11y aria-props (#1797)
Implemented eslint-plugin-jsx-a11y aria_props as part of #1141

This PR introduces the aria-props rule, implemented based on the
[WAI-ARIA 1.1
specifications](https://www.w3.org/TR/wai-aria/#state_prop_def).
2023-12-24 16:47:18 +00:00
poteboy
bf527f4fc1
feat(linter): eslint-plugin-jsx-a11y no-aria-hidden-on-focusable (#1795)
Implemented eslint-plugin-jsx-a11y no-aria-hidden-on-focusable as part
of #1141

### Key Points
- Implements `no-aria-hidden-on-focusable` as per the
[eslint-plugin-jsx-a11y
documentation](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-aria-hidden-on-focusable.md).
- Incorporates HTML's `focus()` API criteria based on the [W3C's DOM
Level 2 HTML
specification](https://www.w3.org/TR/DOM-Level-2-HTML/html.html) to
accurately identify focusable elements.
2023-12-24 09:29:40 +00:00
Cameron
3102b22c32
fix(linter) fix incorrect report in prefer-string-replace-all (#1796) 2023-12-24 09:37:32 +08:00
magic-akari
5b2696b711
refactor(parser): report this parameter error (#1788)
- follow up: #1728
2023-12-23 22:09:14 +08:00
Milo
b25f014e84
fix(linter): fix a typo in no_redeclare message (#1789) 2023-12-23 12:48:50 +00:00
Cameron
29a4a35fd8
fix(prettier) add missing closing brace for dock debug (#1786) 2023-12-23 10:59:13 +08:00
Boshen
51a243b989
perf(linter): reduce the RuleEnum enum size from 168 to 16 bytes (#1783)
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2023-12-22 22:54:41 +08:00
Dunqing
521aa2cf9d
feat(linter/eslint/no-useless-escape): support auto fix (#1743)
There are many errors in the vitest repo related to this rule.
2023-12-22 22:23:34 +08:00
Tapan Prakash
b8a90c1b9b
feat(linter): eslint-plugin-jsx-a11y no-distracting-elements rule (#1767)
Implemented eslint-plugin-jsx-a11y no-distracting-elements as part of
https://github.com/oxc-project/oxc/issues/1141 porting recommended
rules.

Doc:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-distracting-elements.md
Test:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/no-distracting-elements-test.js
2023-12-22 13:04:29 +08:00
Wenzhe Wang
18f0e20c56
docs(linter): update comments (#1779) 2023-12-22 12:20:22 +08:00
Wenzhe Wang
0bf7596949
fix(linter): support read the third item in config file (#1771)
closes: #1757
2023-12-21 22:51:57 +08:00
Boshen
2286181223
fix(linter): update snapshots 2023-12-21 22:07:53 +08:00
Boshen
5d7ea9d7a1
fix(linter): change non-error lints to warning 2023-12-21 21:55:22 +08:00
IWANABETHATGUY
fc7c857f80
fix(vscode): don't lint files in .gitignore and .eslintignore (#1765)
Closed https://github.com/oxc-project/oxc/issues/1752
2023-12-21 21:45:32 +08:00
Boshen
2e707bc1c7
perf(linter): use simd (memchr) for no-useless-escape search (#1766) 2023-12-21 19:14:16 +08:00
Boshen
82dc4035eb
chore(linter): bump oxc_resolver to v1.0.1 2023-12-21 16:43:27 +08:00
Boshen
da67fe1ca2
refactor(semantic): remove unused methods from AstNode 2023-12-21 16:08:14 +08:00
Boshen
6d4202241b
fix(linter): improve the help message for const-comparisons (#1764)
closes #1741
2023-12-21 16:04:39 +08:00
Boshen
d0cc3ec9a2
perf(linter): change regex to static in no_commented_out_tests 2023-12-21 15:35:57 +08:00
Boshen
e741b8fec4
perf(linter): precompute rule.name() (#1759)
enum static dispatch has become slow because there are 200 enum variants
2023-12-21 12:06:01 +08:00
Cameron
fc3a1a21a3
feat(linter) deepscan: bad char at comparison (#1750) 2023-12-20 12:39:27 +08:00
Cameron
a34c7fcbcc
feat(linter) deepscan: bad replace all arg (#1749) 2023-12-20 12:34:27 +08:00
Cameron
266667b892
chore: add deepscan to rulegen (#1748) 2023-12-20 12:29:28 +08:00