-
-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(linter): Implement jsdoc/check-access #2642
Conversation
@Boshen These are some concerns noticed when I tried it. What do you think? Is it OK to use
|
Base work for #2642 🏃🏻 - [x] struct - [x] bool flags - [x] tagNamePreferences
CodSpeed Performance ReportMerging #2642 will improve performances by 6.82%Comparing Summary
Benchmarks breakdown
|
This is the work flow: oxc/crates/oxc_linter/src/lib.rs Lines 107 to 129 in 53a8e7f
We try to avoid visiting the AST twice.
Do this instead: impl<'a> JSDocTag<'a> {
fn kind(&self) -> JSDocTagKind<'a> {
self.kind
}
}
impl<'a> JSDocTagKind<'a> {
fn is_deprecated(&self) -> bool {
matches!(self, Self::Deprecated)
}
fn parameter(&self) -> Option<&Param<'a>> {
if let Self::Parameter(param) = self {
Some(param)
} else {
None
}
}
} I think this is easier than many nodes containing |
Thanks!
Many of In these cases, for node in semantic.nodes().iter() {
for (rule_name, rule) in &self.rules {
ctx.with_rule_name(rule_name);
rule.run(node, &ctx); // this run() fn is almost empty 👀
}
} Does this mean negligibly cheep? Or should consider something like: for node in semantic.nodes().iter() {
for (rule_name, rule) in &self.rules {
if rule.can_skip_run { continue; } // <-
ctx.with_rule_name(rule_name);
rule.run(node, &ctx);
}
} ? |
This comment was marked as resolved.
This comment was marked as resolved.
Thank you! Sorry I missed the PR. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [oxlint](https://oxc-project.github.io) ([source](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint)) | [`0.2.14` -> `0.2.17`](https://renovatebot.com/diffs/npm/oxlint/0.2.14/0.2.17) | [![age](https://developer.mend.io/api/mc/badges/age/npm/oxlint/0.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxlint/0.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxlint/0.2.14/0.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxlint/0.2.14/0.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>oxc-project/oxc (oxlint)</summary> ### [`v0.2.17`](https://github.com/oxc-project/oxc/releases/tag/oxlint_v0.2.17): oxlint v0.2.17 [Compare Source](https://github.com/oxc-project/oxc/compare/7066d55153ad70f95ae975adc3958c1010f9c5ff...df11d10a2220e9aa7a33d9ab39ed662c2ba6fdb5) ##### What's Changed - feat(linter): eslint-plugin-jest/prefer-lowercase-title by [@​eryue0220](https://github.com/eryue0220) in [https://github.com/oxc-project/oxc/pull/2911](https://github.com/oxc-project/oxc/pull/2911) - feat(linter): typescript-eslint/consistent-type-definitions by [@​todor-a](https://github.com/todor-a) in [https://github.com/oxc-project/oxc/pull/2885](https://github.com/oxc-project/oxc/pull/2885) - fix(cli): fix `oxlint --format json` yields 0 files to lint by [@​Boshen](https://github.com/Boshen) in [https://github.com/oxc-project/oxc/pull/2940](https://github.com/oxc-project/oxc/pull/2940) - fix(cli): if format is json do not print summary information ([#​2899](https://github.com/oxc-project/oxc/issues/2899)) by [@​kalvenschraut](https://github.com/kalvenschraut) in [https://github.com/oxc-project/oxc/pull/2925](https://github.com/oxc-project/oxc/pull/2925) - fix(linter): import/no-cycle ignore type-only imports by [@​JohnDaly](https://github.com/JohnDaly) in [https://github.com/oxc-project/oxc/pull/2924](https://github.com/oxc-project/oxc/pull/2924) - refactor(semantic/jsdoc): Rework JSDoc struct for better Span handling by [@​leaysgur](https://github.com/leaysgur) in [https://github.com/oxc-project/oxc/pull/2917](https://github.com/oxc-project/oxc/pull/2917) ##### New Contributors - [@​bradzacher](https://github.com/bradzacher) made their first contribution in [https://github.com/oxc-project/oxc/pull/2938](https://github.com/oxc-project/oxc/pull/2938) **Full Changelog**: oxc-project/oxc@oxlint_v0.2.16...oxlint_v0.2.17 ### [`v0.2.16`](https://github.com/oxc-project/oxc/releases/tag/oxlint_v0.2.16): oxlint v0.2.16 [Compare Source](https://github.com/oxc-project/oxc/compare/e7307ed23ca9b0707586b6bf4220cafb221ae86e...7066d55153ad70f95ae975adc3958c1010f9c5ff) #### What's Changed - feat(linter): [@​typescript-eslint/prefer-for-of](https://github.com/typescript-eslint/prefer-for-of) by [@​charnog](https://github.com/charnog) in [https://github.com/oxc-project/oxc/pull/2789](https://github.com/oxc-project/oxc/pull/2789) - feat(linter): Implement jsdoc/check-access by [@​leaysgur](https://github.com/leaysgur) in [https://github.com/oxc-project/oxc/pull/2642](https://github.com/oxc-project/oxc/pull/2642) - feat(linter): Implement jsdoc/empty-tags by [@​leaysgur](https://github.com/leaysgur) in [https://github.com/oxc-project/oxc/pull/2893](https://github.com/oxc-project/oxc/pull/2893) - feat(linter): eslint-plugin-jest/prefer-mock-promise-sorthand by [@​eryue0220](https://github.com/eryue0220) in [https://github.com/oxc-project/oxc/pull/2864](https://github.com/oxc-project/oxc/pull/2864) - feat(linter/import): Add `ignoreTypes` option for the `import/no-cycle` rule by [@​JohnDaly](https://github.com/JohnDaly) in [https://github.com/oxc-project/oxc/pull/2905](https://github.com/oxc-project/oxc/pull/2905) - fix(ast): `FinallyClause` won't get visited as `BlockStatement` anymore. by [@​rzvxa](https://github.com/rzvxa) in [https://github.com/oxc-project/oxc/pull/2881](https://github.com/oxc-project/oxc/pull/2881) - fix(linter): handle self closing script tags in astro partial loader ([#​2017](https://github.com/oxc-project/oxc/issues/2017)) by [@​kalvenschraut](https://github.com/kalvenschraut) in [https://github.com/oxc-project/oxc/pull/2907](https://github.com/oxc-project/oxc/pull/2907) - fix(linter): svelte partial loader handle generics ([#​2875](https://github.com/oxc-project/oxc/issues/2875)) by [@​kalvenschraut](https://github.com/kalvenschraut) in [https://github.com/oxc-project/oxc/pull/2906](https://github.com/oxc-project/oxc/pull/2906) #### New Contributors - [@​charnog](https://github.com/charnog) made their first contribution in [https://github.com/oxc-project/oxc/pull/2789](https://github.com/oxc-project/oxc/pull/2789) - [@​kalvenschraut](https://github.com/kalvenschraut) made their first contribution in [https://github.com/oxc-project/oxc/pull/2906](https://github.com/oxc-project/oxc/pull/2906) - [@​JohnDaly](https://github.com/JohnDaly) made their first contribution in [https://github.com/oxc-project/oxc/pull/2905](https://github.com/oxc-project/oxc/pull/2905) **Full Changelog**: oxc-project/oxc@oxlint_v0.2.15...oxlint_v0.2.16 ### [`v0.2.15`](https://github.com/oxc-project/oxc/releases/tag/oxlint_v0.2.15): oxlint v0.2.15 [Compare Source](https://github.com/oxc-project/oxc/compare/b1343d7bcbd490105583b561946f057ac91e40cf...e7307ed23ca9b0707586b6bf4220cafb221ae86e) #### What's Changed - feat(linter): default_param_last by [@​JoSeBu1](https://github.com/JoSeBu1) in [https://github.com/oxc-project/oxc/pull/2756](https://github.com/oxc-project/oxc/pull/2756) - feat(linter): eslint-plugin-jest/no-untyped-mock-factory by [@​eryue0220](https://github.com/eryue0220) in [https://github.com/oxc-project/oxc/pull/2807](https://github.com/oxc-project/oxc/pull/2807) - feat(linter): eslint-plugin-jest/prefer-comparison-matcher by [@​eryue0220](https://github.com/eryue0220) in [https://github.com/oxc-project/oxc/pull/2806](https://github.com/oxc-project/oxc/pull/2806) - feat(linter): eslint-plugin-react checked-requires-onchange-or-readonly by [@​keita-hino](https://github.com/keita-hino) in [https://github.com/oxc-project/oxc/pull/2754](https://github.com/oxc-project/oxc/pull/2754) - feat(linter): eslint/no-iterator by [@​JoSeBu1](https://github.com/JoSeBu1) in [https://github.com/oxc-project/oxc/pull/2758](https://github.com/oxc-project/oxc/pull/2758) - feat(linter): fallback to the default tsconfig path by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2842](https://github.com/oxc-project/oxc/pull/2842) - feat(linter): no_script_url by [@​JoSeBu1](https://github.com/JoSeBu1) in [https://github.com/oxc-project/oxc/pull/2761](https://github.com/oxc-project/oxc/pull/2761) - feat(linter/import) check deep namespace in namespace rule by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2805](https://github.com/oxc-project/oxc/pull/2805) - feat(linter/import) check module import in no_duplicates by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2771](https://github.com/oxc-project/oxc/pull/2771) - feat(linter/import) check type import in no_duplicates by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2777](https://github.com/oxc-project/oxc/pull/2777) - feat(linter/import) support allow_computed option in namespace by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2840](https://github.com/oxc-project/oxc/pull/2840) - feat(linter/import) support check re-export in named by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2769](https://github.com/oxc-project/oxc/pull/2769) - feat(linter/import): ignore type-only imports and exports in no_unresolved by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2849](https://github.com/oxc-project/oxc/pull/2849) - fix(linter/import): false positive for indirect export in namespace by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2862](https://github.com/oxc-project/oxc/pull/2862) - fix(linter/import): ignore export declaration in no-duplicates by [@​Dunqing](https://github.com/Dunqing) in [https://github.com/oxc-project/oxc/pull/2863](https://github.com/oxc-project/oxc/pull/2863) - fix(linter/max-lines): only report codes that exceed the line limit by [@​mysteryven](https://github.com/mysteryven) in [https://github.com/oxc-project/oxc/pull/2778](https://github.com/oxc-project/oxc/pull/2778) - fix(parser): add support for empty module declaration by [@​rzvxa](https://github.com/rzvxa) in [https://github.com/oxc-project/oxc/pull/2834](https://github.com/oxc-project/oxc/pull/2834) #### New Contributors - [@​rzvxa](https://github.com/rzvxa) made their first contribution in [https://github.com/oxc-project/oxc/pull/2764](https://github.com/oxc-project/oxc/pull/2764) **Full Changelog**: oxc-project/oxc@oxlint_v0.2.14...oxlint_v0.2.15 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
Part of #1170, Finally... 🗻
Some preparation PRs may be needed in advance.
Span
for diagnostics feat(semantic/jsdoc): AddSpan
for JSDoc, JSDocTag #2815Implement plugin itself.
I'll send a PR to make this plugin public after confirming that a few more rules can be implemented without any problems.