Boshen
9e06bd7797
feat(linter): remove the --timings feature ( #2049 )
...
For a various reasons:
This features bloats the code size.
We have many tools for profiling in Rust (as compared to ESLint where the feature came from),
so a built-in feature is not really needed anymore.
ESLint needed `--timings` because it needs to monitor plugins.
We control all our code so we don't need this.
2024-01-16 14:21:04 +08:00
Valerii Smirnov
c60c31521e
feat(linter): eslint-plugin-import no-named-as-default-member rule ( #1988 )
...
- Docs:
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md
- Code:
https://github.com/import-js/eslint-plugin-import/blob/main/src/rules/no-named-as-default-member.js
- Tests:
https://github.com/import-js/eslint-plugin-import/blob/main/tests/src/rules/no-named-as-default-member.js
2024-01-15 11:03:04 +00:00
Boshen
3b40fbdbac
fix(linter): false positive for filename_case where filename doesn't have a proper casing ( #2032 )
2024-01-15 14:36:48 +08:00
Boshen
68606c4d6d
fix(linter): keep rules disabled if the rule is not enabled in the config ( #2031 )
...
relates #1969
2024-01-15 05:32:51 +00:00
Yuto Yoshino
530d1bea56
feat(linter): eslint-plugin-jsx-a11y no-redundant-roles rule ( #1981 )
...
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/no-redundant-roles.md
- code: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/no-redundant-roles.js
- test: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/no-redundant-roles-test.js
2024-01-14 21:03:58 +00:00
keita hino
198f0e5d73
feat(linter): eslint-plugin-jsx-a11y aria-activedescendant-has-tabindex ( #2012 )
...
Part of: #1141
Based on:
- docs: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-activedescendant-has-tabindex.md
- code: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/aria-activedescendant-has-tabindex.js
- test: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/aria-activedescendant-has-tabindex-test.js
2024-01-14 11:34:07 +00:00
kaykdm
a356918d83
feat(linter): eslint-plugin-next: no-document-import-in-page ( #1997 )
...
Part of: https://github.com/oxc-project/oxc/issues/1929
Based on:
- https://github.com/vercel/next.js/blob/canary/packages/eslint-plugin-next/src/rules/no-document-import-in-page.ts
- https://nextjs.org/docs/messages/no-document-import-in-page
---------
Co-authored-by: Cameron <cameron.clark@hey.com>
2024-01-13 17:52:47 +00:00
kaykdm
c70a065191
feat(linter): eslint-plugin-next: no-head-element ( #2006 )
...
Part of: https://github.com/oxc-project/oxc/issues/1929
Based on:
- code: https://github.com/vercel/next.js/blob/canary/packages/eslint-plugin-next/src/rules/no-head-element.ts
- test: https://github.com/vercel/next.js/blob/canary/test/unit/eslint-plugin-next/no-head-element.test.ts
- doc: https://nextjs.org/docs/messages/no-head-element
---------
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-01-13 17:47:32 +00:00
kaykdm
8f0f824a6a
feat(linter): eslint-plugin-next: no-typos ( #1978 )
...
Part of: https://github.com/oxc-project/oxc/issues/1929
Based on:
https://github.com/vercel/next.js/blob/canary/packages/eslint-plugin-next/src/rules/no-typos.ts
2024-01-13 17:42:11 +00:00
Yuji Sugiura
04540f749d
feat(linter): eslint-plugin-jsx-a11y click-events-have-key-events ( #1976 )
...
( #1974 was lost due to mishandling. 🙈 )
Part of #1141
### Refs
-
4c7e7815c1/docs/rules/click-events-have-key-events.md
-
4c7e7815c1/src/rules/click-events-have-key-events.js
-
4c7e7815c1/__tests__/src/rules/click-events-have-key-events-test.js
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-01-13 09:27:26 +00:00
Boshen
b386177af2
refactor(linter): move away from tuples for test cases ( #2011 )
...
closes #1956
2024-01-13 16:23:16 +08:00
Cameron
107a32ea48
fix(linter): fix false positive for erasing-op in 0/0 case ( #2009 )
2024-01-13 10:32:26 +08:00
Boshen
c342875b55
chore(linter): change react/no-unknown-property to restriction
...
There's a lot of false positives in non-standard jsx usages.
For example the usage of `css` or `class` attribute.
2024-01-12 20:44:04 +08:00
cin
d51c9f19f9
feat(linter): eslint-plugin-jest: no-test-return-statement ( #1979 )
...
Rule Detail:
[link](https://github.com/eryue0220/eslint-plugin-jest/blob/main/src/rules/no-test-return-statement.ts )
2024-01-11 23:01:52 +08:00
Boshen
fb5d0a740c
feat(linter): add support for same rule name but different plugin names ( #1992 )
...
e.g.
```
{
"rules": {
"semi": "off",
"@typescript-eslint/semi": "error"
}
}
```
closes #1975
2024-01-11 18:05:05 +08:00
Boshen
b7ea4e53fb
feat(linter): support vue generic component ( #1989 )
...
closes #1938
2024-01-11 15:48:56 +08:00
fi3ework
e0da12a868
fix(linter): allow eslintrc to add rule when overriding ( #1984 )
...
Fix a bug introduced in https://github.com/oxc-project/oxc/pull/1966 .
Ideally, the rules in eslintrc should be merged into final rules as
described:
> The rules will start with the categories we apply, and then merge all
the configurations stated in the rules field.
>
> For example, if we begin with -D correctness with 80 rules, then
>
> "no-empty-file": "off" will remove the rule, yielding 79 rules
> "no-empty": "error" (restriction) will add the rule, yield 81 rules
> ""no-empty": ["error", { "allowEmptyCatch": true }]` add the rule's
configuration
However, the implementation did not include the newly added rules in the
eslintrc. As a test case and example, I added a new fixture to
`crates/oxc_cli/fixtures/no_undef`. No warn or deny will be found
without this PR.
This is my first Rust PR ever. Any nitpicking suggestions are welcome.
Thanks! 😊
2024-01-11 11:43:02 +08:00
kaykdm
c5887bcb2b
feat(linter): implement @typescript-eslint/triple-slash-reference ( #1903 )
...
implement @typescript-eslint/triple-slash-reference
Related issue: https://github.com/oxc-project/oxc/issues/503
original
- doc:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/triple-slash-reference.md
- code:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/triple-slash-reference.ts
2024-01-11 11:12:46 +08:00
Maurice Nicholson
d4acd140ad
fix(linter): jsx-key: handle anonymous functional components in arrays that have a function body ( #1983 )
...
Closes #1982
2024-01-10 22:46:17 +00:00
Yuto Yoshino
ac704cce14
feat(linter): eslint-plugin-jsx-a11y autocomplete-valid ( #1901 )
...
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/autocomplete-valid.md
- code: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/autocomplete-valid.js
- test: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/autocomplete-valid-test.js
2024-01-10 10:17:33 +00:00
zhangrunzhao
40dbfae3c2
feat(linter): eslint-plugin-react: no-direct-mutation-state ( #1892 )
...
#1022
Based on:
- code: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/no-direct-mutation-state.js
- doc: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
- test: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/tests/lib/rules/no-direct-mutation-state.js
Co-authored-by: 张润钊 <zhangrunzhao@bytedance.com>
2024-01-10 08:32:19 +00:00
Boshen
856b9a59eb
feat(linter): support overriding oxlint rules by eslint config ( #1966 )
...
Previously if .eslintrc.json contains
```
{
"rules": {
"no-empty": "off"
}
}
```
Then no rules will be enabled.
---
This PR changes how we configure oxlint's rules.
The rules will start with the categories we apply, and then merge all
the configurations stated in the `rules` field.
For example, if we begin with `-D correctness` with 80 rules, then
* `"no-empty-file": "off"` will remove the rule, yielding 79 rules
* `"no-empty": "error"` (restriction) will add the rule, yield 81 rules
* ""no-empty": ["error", { "allowEmptyCatch": true }]` add the rule's
configuration
2024-01-10 15:44:53 +08:00
Boshen
a6717db423
refactor(formatter,linter,codegen): remove oxc_formatter ( #1968 )
...
closes #1941
2024-01-10 06:41:20 +00:00
Hao Cheng
b5f4f1eb68
fix(linter): fix plugin name parsing when reading config file ( #1972 )
...
This PR fixes the plugin parsing logic when reading a config file.
Specifically, the plugin names defined in `RuleEnum`s use snake-case
("jsx_a11y") while in the config file they are written as "jsx-a11y".
This inconsistency causes some rules to be filtered out.
I tested the change with the config json file provided in #1969 .
- Before the change: `Finished in 21ms on 1 file with 157 rules using 8
threads.`
- After the change: `Finished in 23ms on 1 file with 178 rules using 8
threads.`
Related issue: #1969
2024-01-10 11:46:56 +08:00
Cameron
64310fa9b1
refactor(linter): remove duplicate get_jsx_attribute_name ( #1971 )
2024-01-10 11:45:34 +08:00
kaykdm
78916703c5
feat(linter): eslint-plugin-react: require-render-return ( #1946 )
...
Related issue: https://github.com/oxc-project/oxc/issues/1022
Based on:
- doc: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
- code: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/require-render-return.js
2024-01-09 22:50:02 +00:00
keita hino
8d9894ad40
fix(linter): Support cases where aria-hidden includes expressions ( #1964 )
...
The rule for
[jsx-a11y/img-redundant-alt](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/img-redundant-alt.md )
states that if aria-hidden is true, the rule will always succeed:
> The rule will first check if aria-hidden is true to determine whether
to enforce the rule. If the image is hidden, then rule will always
succeed.
The [img_redundant_alt
rule](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/jsx_a11y/img_redundant_alt.rs ),
ported to Oxlint, was in an incompatible state because an error occurred
even when including aria-hidden={true}, as demonstrated below:
```jsx
// error
<img alt='photo of cool person' aria-hidden={true} />
```
This issue arose because the
[is_hidden_from_screen_reader](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/utils/react.rs#L77-L95 ),
responsible for obtaining the state of aria-hidden, was not handling
cases where aria-hidden includes expressions. This PR addresses the
situation by adding support for cases where expressions are passed to
aria-hidden.
2024-01-09 22:33:55 +00:00
Yuto Yoshino
2b7ca5962f
feat(linter): eslint-plugin-jsx-a11y role-has-required-aria-props ( #1881 )
...
partof: https://github.com/oxc-project/oxc/issues/1141
Based on:
- doc: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-has-required-aria-props.md
- code: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/role-has-required-aria-props.js
- test: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/role-has-required-aria-props-test.js
2024-01-09 15:21:11 +00:00
Boshen
66e95a5968
fix(linter): change severity of no-sparse-arrays to warnings
2024-01-09 14:41:42 +08:00
Rintaro Itokawa
f6047b6531
feat(linter): eslint-plugin-jsx-a11y role-support-aria-props ( #1961 )
...
## Summary
partof: #1141
I re-implemented role-support-aria-props rule for jsx_a11y.
originals:
- docs:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-supports-aria-props.md
- code:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/role-supports-aria-props.js
- test:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/role-supports-aria-props-test.js
2024-01-09 13:54:06 +08:00
Boshen
897869b6d4
Revert "feat(linter): eslint-plugin-jsx-a11y role-support-aria-props" ( #1960 )
...
Reverts oxc-project/oxc#1949
2024-01-09 12:41:22 +08:00
Rintaro Itokawa
fd5856e5d1
feat(linter): eslint-plugin-jsx-a11y role-support-aria-props ( #1949 )
...
## Summary
partof: #1141
I re-implemented role-support-aria-props rule for jsx_a11y.
originals:
- docs:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-supports-aria-props.md
- code:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/role-supports-aria-props.js
- test:
https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/__tests__/src/rules/role-supports-aria-props-test.js
2024-01-09 12:23:24 +08:00
Cameron
0bcc9e7e6b
feat(linter) eslint-plugin-next no-head-import-in-document ( #1957 )
2024-01-09 11:41:31 +08:00
Cameron
d9ca086eb6
feat(linter) add support for custom filenames in tests ( #1955 )
2024-01-09 11:35:34 +08:00
Cameron
18d1c29a62
feat(linter) eslint-plugin-next no-script-component-in-head ( #1954 )
2024-01-09 11:29:32 +08:00
Cameron
039e6fc9c5
feat(linter) eslint-plugin-next no-sync-scripts ( #1953 )
2024-01-09 11:22:27 +08:00
Cameron
a3754e20ca
feat(linter) eslint-plugin-next no-title-in-document-head ( #1952 )
2024-01-09 11:16:42 +08:00
Cameron
bce9060095
feat(linter) eslint-plugin-next no-img-element ( #1951 )
2024-01-09 11:12:01 +08:00
Cameron
ac3b44bd0c
feat: nextjs plugin ( #1948 )
...
https://github.com/oxc-project/oxc/issues/1929#issuecomment-1880369624
2024-01-09 11:08:11 +08:00
dependabot[bot]
b97a536df7
chore(deps): bump the dependencies group with 5 updates ( #1943 )
2024-01-08 14:54:17 +08:00
Cameron
73a5b7f7da
feat(linter) eslint-plugin-next no-css-tags ( #1937 )
2024-01-08 12:38:53 +08:00
Cameron
149f53edd6
feat(linter) eslint-plugin-next no-async-client-component ( #1936 )
2024-01-08 12:13:27 +08:00
Cameron
c06d939460
feat(linter) eslint-plugin-next no-assign-module-variable ( #1935 )
2024-01-08 12:09:32 +08:00
Cameron
0f15099f6f
feat(linter) eslint-plugin-next next-script-for-ga ( #1934 )
2024-01-08 12:04:32 +08:00
Cameron
0475bcbd92
feat(linter) eslint-plugin-next inline-script-id ( #1933 )
2024-01-08 11:59:47 +08:00
Cameron
3d00d31c1e
feat(linter) eslint-plugin-next google-font-preconnect ( #1932 )
2024-01-08 11:54:30 +08:00
Cameron
d24738d3fc
feat(linter) eslint-plugin-next google-font-display ( #1931 )
2024-01-08 11:49:40 +08:00
IWANABETHATGUY
fe48bfae0c
feat(lsp): support vue, astro and svelte ( #1923 )
...

Closed https://github.com/oxc-project/oxc/issues/1915
2024-01-08 11:38:25 +08:00
Valerii Smirnov
c6eb519417
feat(linter): eslint-plugin-react: no-unknown-property ( #1875 )
...
Based on:
- tests: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/tests/lib/rules/no-unknown-property.js
- docs: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
- code: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/no-unknown-property.js
2024-01-07 12:23:32 +00:00
Boshen
c2e8ef56a5
feat(linter): disable no-unused-labels for svelte ( #1919 )
2024-01-07 00:25:52 +08:00