Commit graph

611 commits

Author SHA1 Message Date
Boshen
8a3eff1bee
feat(linter): parse multiple script tags in astro file (#1898) 2024-01-05 16:36:31 +08:00
Boshen
4c5c61e5f9
feat(linter): add support for multiple script tags from vue and stro (#1897)
part of #1896
2024-01-05 16:30:32 +08:00
Cameron
064296cd43
perf(linter) reduce the number of diagnostics for no_sparse_arrays (#1895)
Partially address #1879

See there for more info. but tldr:

Printing a lot of diagnostics takes a lot of time - a lot longer than it
takes to create them

we speed up printing by producing less diagnostics.

we do this by making `no-sparse-arrays` report 1x per array instead of
1x per violation.

This does have the overhead of now every ArrayElement is processed 2x
(1x when we loop through in the rule, 1x when we loop through the ast).
But the perf reduction is negligble compared to the per production of
producing thousands of diagnostics vs 1 diagnostic.

This means that linting nodejs/node now takes ~1.5 seconds vs ~2:30
previously
2024-01-05 10:52:31 +08:00
Deivid Almeida
5f29e3f9f6
feat(linter): no irregular whitespace (#1877)
it was builded a loop that iterates in trivias.irregular-whitespace and
return the warning if contain some specific sequence of chars.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-01-05 02:47:29 +00:00
Boshen
a63490c1c0
feat(linter): support astro front matter --- block (#1893)
closes #1702
2024-01-05 10:05:43 +08:00
Boshen
11ca5c2bad
feat(linter): do not lint when vue file has no js section (#1891) 2024-01-04 21:24:19 +08:00
Wenzhe Wang
45156443ed
refactor(linter): get js code slice from vue source code (#1876) 2024-01-04 12:06:04 +08:00
Dunqing
dae5f628b0
perf(semantic): check duplicate parameters in Binder of FormalParameters (#1840) 2024-01-03 12:57:03 +08:00
Boshen
e914159851
chore: fix typos 2024-01-03 11:44:04 +08:00
Yuto Yoshino
8a1e894330
feat(linter): eslint-plugin-jsx-a11y prefer-tag-over-role (#1831)
Part of: https://github.com/oxc-project/oxc/issues/1141

Based on
- doc: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/prefer-tag-over-role.md
- code: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/prefer-tag-over-role.js
- test: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/prefer-tag-over-role-test.js
2024-01-02 12:55:09 +00:00
Ken-HH24
2ac26303e0
feat(linter): eslint-plugin-jsx-a11y mouse-events-have-key-events (correctness) (#1867)
Part of #1141

Based on:
 - https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/mouse-events-have-key-events.md
 - https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/mouse-events-have-key-events.js
2024-01-01 11:26:49 +00:00
Wenzhe Wang
3d4163795e
feat(linter): add Vue loader (#1814) 2023-12-31 22:25:26 +08:00
Wenzhe Wang
0feeac540d
feat(lint): add partial loader register (#1760) 2023-12-31 22:19:27 +08:00
Wenzhe Wang
8f27a98468
feat(cli): support walk vue and astro (#1745) 2023-12-31 22:15:11 +08:00
Valerii Smirnov
ba0a4a890a
feat(linter): eslint-plugin-react: jsx-no-undef (#1862)
Part of #1022 
Based on:
- doc: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
- code: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/jsx-no-undef.js
- test: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/tests/lib/rules/jsx-no-undef.js
2023-12-31 11:57:44 +00:00
msdlisper
b2a62ddaa2
fix(linter): error rule config in media_has_caption (#1864)
fix error rule config
```
serde_json::json!({
    "audio": [ "Audio" ],
    "video": [ "Video" ],
    "track": [ "Track" ],
})
```
to
```
serde_json::json!([{
    "audio": [ "Audio" ],
    "video": [ "Video" ],
    "track": [ "Track" ],
}])
```

based on the eslint docs, if a rule configuration is passed, it has to
look like `<RULE NAME>: [<SEVERITY>, config]`
2023-12-31 10:55:25 +00:00
msdlisper
1ddbe8f12d
fix(linter): unexpected unwrap panic (#1856)
While reviewing the code, I noticed that a panic will occur if the
object does not have the 'ignoreNonDOM' key, which is unexpected. And I
have moved out the code `no_focus.set_option(true);` to make the
function cleaner.
2023-12-31 12:09:58 +08:00
Rintaro Itokawa
36cb7c53c5
feat(linter): eslint-plugin-jsx-a11y: aria-unsupported-elements
Based on:
- docs:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-unsupported-elements.md
- code:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/aria-unsupported-elements.js
- test:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/aria-unsupported-elements-test.js
2023-12-30 11:18:44 +00:00
msdlisper
1c695aee3a
refactor(linter) remove duplicated code in media-has-caption (#1859) 2023-12-30 11:17:19 +00:00
Maurice Nicholson
d803a3ab5e
fix(linter): ignore false positives in eslint-plugin-react(jsx-key) (#1858)
Closes #1857

Fixes false positives where an arrow function exists within an array
2023-12-30 11:14:45 +00:00
msdlisper
af618946e5
feat(linter): eslint plugin jsx a11y: aria-role (#1849)
eslint-plugin-jsx-a11y aria-role for #1141
2023-12-29 10:29:00 +00:00
IWANABETHATGUY
4bbc977971
chore: upgrade rustc toolchain to stable 1.75.0 (#1853)
ref: 
https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html
2023-12-29 12:20:51 +08:00
Cameron
1f3f21d722
feat(linter) eslint plugin unicorn: prefer modern math apis (#1620) 2023-12-28 22:04:47 +08:00
Cameron
dda3c69d7a
feat(linter) deepscan: bad object literal comparison (#1844) 2023-12-28 21:54:36 +08:00
Cameron
00ba96ae1a
feat(linter) oxc: erasing op (#1834) 2023-12-28 09:26:12 +00:00
msdlisper
040278aa50
refactor(linter): extract common code (#1848)
extract common code
2023-12-28 14:43:47 +08:00
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
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
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
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
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
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
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
c59508675d
chore(linter): remove the implementation from constructor_super
This should be implemented by a CFG
2023-12-25 15:37:49 +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
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
Milo
b25f014e84
fix(linter): fix a typo in no_redeclare message (#1789) 2023-12-23 12:48:50 +00: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