typescript-eslint
Repos
4

:sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript

12843
2403

Converts your TSLint configuration to the closest possible ESLint equivalent. 🚀

795
88

Events

Repo: Enable one-var internally

Suggestion

https://eslint.org/docs/latest/rules/one-var

Specifically, let's enable one-var's never option?

Created at 31 minutes ago

chore: test on Node 14 (#6400)

feat(eslint-plugin): [naming-convention] improve performance by removing unnecessary selectors (#6376)

  • feat(eslint-plugin): [naming-convention] improve performance by removing unnecessary selectors

  • Non-nullable validators

  • Undo yarn.lock changes


Co-authored-by: Josh Goldberg git@joshuakgoldberg.com

feat(typescript-estree): cache project glob resolution (#6367)

  • feat(typescript-estree): cache project glob resolution

  • review

  • Fixed CacheDurationSeconds import

  • Fix lint


Co-authored-by: Josh Goldberg git@joshuakgoldberg.com

chore(deps): update rollup

Created at 39 minutes ago
feat(typescript-estree): add type checker wrapper APIs to ParserServicesWithTypeInformation

Codecov Report

Merging #6404 (506bf57) into v6 (fde95d3) will decrease coverage by 0.03%. The diff coverage is 97.73%.

@@            Coverage Diff             @@
##               v6    #6404      +/-   ##
==========================================
- Coverage   91.62%   91.60%   -0.03%     
==========================================
  Files         354      355       +1     
  Lines       12196    12155      -41     
  Branches     3582     3581       -1     
==========================================
- Hits        11175    11134      -41     
- Misses        721      723       +2     
+ Partials      300      298       -2     

| Flag | Coverage Δ | | |---|---|---| | unittest | 91.60% <97.73%> (-0.03%) | :arrow_down: |

Flags with carried forward coverage won't be shown. Click here to find out more.

| Impacted Files | Coverage Δ | | |---|---|---| | ...ges/type-utils/src/getConstrainedTypeAtLocation.ts | 0.00% <0.00%> (ø) | | | packages/type-utils/src/getDeclaration.ts | 0.00% <0.00%> (ø) | | | ...ages/typescript-estree/src/createParserServices.ts | 71.42% <71.42%> (ø) | | | ...gin-internal/src/rules/no-poorly-typed-ts-props.ts | 87.50% <100.00%> (-1.39%) | :arrow_down: | | ...lugin-internal/src/rules/plugin-test-formatting.ts | 79.76% <100.00%> (ø) | | | packages/eslint-plugin-tslint/src/rules/config.ts | 97.22% <100.00%> (ø) | | | packages/eslint-plugin/src/rules/await-thenable.ts | 100.00% <100.00%> (ø) | | | ...eslint-plugin/src/rules/consistent-type-exports.ts | 97.67% <100.00%> (-0.03%) | :arrow_down: | | packages/eslint-plugin/src/rules/dot-notation.ts | 96.29% <100.00%> (-0.14%) | :arrow_down: | | ...gin/src/rules/naming-convention-utils/validator.ts | 96.79% <100.00%> (-0.03%) | :arrow_down: | | ... and 38 more | |

Created at 1 hour ago
Created at 1 hour ago
feat(typescript-estree): add type checker wrapper APIs to ParserServicesWithTypeInformation

Nx Cloud Report

CI is running for commit 9c3838918301f32e8d9c62291d7d2bb8bcacd1f7.

📂 Click to track the progress, see the status, the terminal output, and the build insights.


Sent with 💌 from NxCloud.

Created at 1 hour ago
feat(typescript-estree): add type checker wrapper APIs to ParserServicesWithTypeInformation

Thanks for the PR, @JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Created at 1 hour ago
feat(typescript-estree): add type checker wrapper APIs to ParserServicesWithTypeInformation

PR Checklist

Overview

Adds to ParserServicesWithTypeInformation the two most commonly used TypeScript type checking APIs: getSymbolAtLocation and getTypeAtLocation. Then converts all places in code that I could find that used either after immediately retrieving the TS node for an ES node.

Also applies a few standardizations that helped me find-and-replace:

  • const services = util.getParserServices(context) - not a variable named parserServices, or variables from { ... }
  • const checker = services.program.getTypeChecker() - not a variable named typeChecker or types, and not an intermediate program variable

Updates the Custom Rules docs page to reflect this.

Created at 1 hour ago
JoshuaKGoldberg delete branch cache-glob-resolution
Created at 1 hour ago

feat(typescript-estree): cache project glob resolution (#6367)

  • feat(typescript-estree): cache project glob resolution

  • review

  • Fixed CacheDurationSeconds import

  • Fix lint


Co-authored-by: Josh Goldberg git@joshuakgoldberg.com

Created at 1 hour ago
feat(typescript-estree): cache project glob resolution

PR Checklist

  • [x] Addresses an existing open issue: https://github.com/typescript-eslint/typescript-eslint/discussions/6366
  • [x] Steps in CONTRIBUTING.md were taken

Overview

Whilst reviewing https://github.com/typescript-eslint/typescript-eslint/pull/6084 I realised we could save some time in the parser by caching the parserOptions.project glob resolution results. So I spent a bit of time throwing this together.

I tested this locally and it saved a little bit of time (~1 second) because our glob is so small (we use packages/*/tsconfig.json - which only matches 15 folders. Though it's still eye-opening to see that the tiny globbing for our repo adds up to an entire second.

I double checked these results by taking a CPU profile before and after:

$ TSESTREE_SINGLE_RUN=true node --cpu-prof ./node_modules/.bin/eslint .

Then I inspected the profiles on https://speedscope.app For reference - the profiles: PROFILES.zip

Before change: image

After change: image

I would expect that this change should show a large perf improvement in the following cases:

  • single-star glob that matches many directories (eg packages/*/tsconfig.json on something the size of babel's packages folder or bigger)
  • lots of globs matching all over the place (eg ['foo/*/tsconfig.json', 'bar/*/tsconfig.json', 'baz/*/tsconfig.json', ...])
  • really any case with double star globs
Created at 1 hour ago

feat(eslint-plugin): [naming-convention] improve performance by removing unnecessary selectors (#6376)

  • feat(eslint-plugin): [naming-convention] improve performance by removing unnecessary selectors

  • Non-nullable validators

  • Undo yarn.lock changes


Co-authored-by: Josh Goldberg git@joshuakgoldberg.com

Created at 1 hour ago
JoshuaKGoldberg delete branch naming-convention-improve-perf
Created at 1 hour ago
feat(eslint-plugin): [naming-convention] improve performance by removing unnecessary selectors

Part of my performance investigations on large codebases. Right now we always register every single node selector in naming-convention, even if the user's config will never match that selector.

This is bad because eslint registers, parses and evaluates these selectors. All totalled these selectors combined pretty-well add up to every single identifier in the codebase! Which is a lot of processing that's not required!

It's a simple change that can save 10s of seconds on codebases that don't use the default config selector.

Created at 1 hour ago