Skip to content
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: make utils/TSESLint export typed classes instead of just types #526

Merged
merged 2 commits into from May 16, 2019

Conversation

bradzacher
Copy link
Member

@bradzacher bradzacher commented May 14, 2019

  • made the utils/TSESLint exports export classes instead of just types.
    • This means that users won't need to directly depend on eslint, and they won't have to do any dual import shenanigans.
// OLD
import { RuleTester as ESLintRuleTester } from 'eslint';
import { TSESLint } from '@typescript-eslint/experimental-utils';

const RuleTester : TSESLint.RuleTester = ESLintRuleTester;
const ruleTester = new RuleTester({ ... });
// NEW
import { TSESLint } from '@typescript-eslint/experimental-utils';

const ruleTester = new TSESLint.RuleTester({ ... });
  • removed dependency @types/eslint completely
    • this means that people can't accidentally import anything from eslint which will have the wrong types.
  • refactored eslint-plugin-tslint so that it has the same file structure as a normal plugin.
  • fixed imports in eslint-plugin which means that we can remove the direct dependency on parser.
    • doesn't really make any difference, but it's a nice side-effect
  • added typed CLIEngine to experimental-utils
    • just wanted to complete the set!

@bradzacher bradzacher added the enhancement New feature or request label May 14, 2019
@codecov

This comment has been minimized.

JamesHenry
JamesHenry previously approved these changes May 15, 2019
@bradzacher bradzacher merged commit 370ac72 into master May 16, 2019
@bradzacher bradzacher deleted the utils-export-values branch May 16, 2019 00:35
@kevinmarrec
Copy link

kevinmarrec commented Jun 14, 2019

@bradzacher Sounds you indirectly instaured breaking change by moving parser from dependencies to peerDependencies.

Cause before you just had to install @typescript-eslint/eslint-plugin that was shipping it and now ther's a need of installing @typescript-eslint/eslint-plugin as well.

For people with dep lock file it will keep working unless they regenerated it, but for new projects it will break if following https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin that does not say explictly to install the parser.

It have been notice by me and some of Nuxt users tha followed our guide here : https://nuxtjs.org/guide/typescript which became outdated due to this breaking change.

@bradzacher
Copy link
Member Author

@kevinmarrec - please avoid commenting on old PRs to report issues - open a new issue instead.
Merged PRs are hard to search for, so if people have the same issue as you, they won't easily find your comment, increasing the likelihood of duplicate postings.


It was originally a dependency because we directly imported code from the parser. With this PR there is no longer that import dependency, so it was moved to a peer dependency.

It is only a breaking change if you were not following the installation instructions set out in our readme https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#installation

The exact dependencies of a package are ultimately an implementation detail, not a contract. As such you should not rely upon them to remain consistent between versions.

@kevinmarrec
Copy link

Alright thanks for clarifications @bradzacher

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants