Community Feedback: Pain Points #6121
Replies: 13 comments 54 replies
-
The main annoyance for me is how typescript-eslint overrides lint rules that are part of the ESLint core rules itself. Our config has a bunch of definitions like this: module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
// If adding a typescript-eslint version of an existing ESLint rule,
// make sure to disable the ESLint rule here.
rules: {
// TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
"default-case": "off",
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
"no-dupe-class-members": "off",
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
"no-undef": "off",
// Add TypeScript specific rules (and turn off ESLint equivalents)
"@typescript-eslint/consistent-type-assertions": "warn",
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": "warn",
// more of these…
}
} Note that this is based on an ejected But to me this shows there’s an inherent tension because of the fact that ESLint’s core doesn’t recognize TypeScript (hence the need for a custom parser) and its rules don’t either. This also leaks into the ecosystem, because when trying out some rule from NPM you often don’t know whether it’ll play nicely with TypeScript or not. If TypeScript support were first-class (see Deno or Rome), this would not be necessary. |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
For the authors of @typescript-eslint/prefer-for-of: |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Here is some feedback: I used this library a while ago, but today I wasn't able to configure it again on a new project. The documentation assume you know eslint and therefore you are able to configure typescript-eslint. I thought the documentation would help getting started from scratch, but really you have to guess on how to plug it. Do you need a plugin? Do you need a different config file? Do you need to extend eslint configuration? After reading the whole documentation you realise that it won't tell you how to set it up and that these answers are hidden behind this vague title: I understand that it's not this documentation's job to explain how eslint works, but pinpointing mandatory steps or at least stating that eslint knowledge is required to go further would be great. |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to use a TypeScript configuration file named My The only fix I found was to set |
Beta Was this translation helpful? Give feedback.
-
My only pain point is endless prereleases. |
Beta Was this translation helpful? Give feedback.
-
I don't understand why the recommended approach to adding this plugin doesn't seem to match the flat config model. Instead of exporting an object that can be added to an array of configs, it seems the recommended approach is to export a Iow, how does this... export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended
); ...map to this? export default [
// my configs
]; How does the args object in export default [
{
files: ["**/*.{js,mjs,cjs,ts,mts,jsx,tsx}"],
languageOptions: {
parser: "@typescript-eslint/parser",
// etc
}
},
// more configs...
] Maybe there is an explanation in the docs somewhere, but I couldn't find it 😞 |
Beta Was this translation helpful? Give feedback.
-
It's unclear from the documentation how to use Alternatively, why are you not importing and reusing typings from ESLint? I believe these days they provide typings you can just import. Also, what is the relation between |
Beta Was this translation helpful? Give feedback.
-
The typescript-eslint parser is incredibly slow in ways that don't make sense. For instance, I have a import Stack from '~/components/ui/layout/Stack.vue'
import Button from '~/components/ui/Button.vue'
import Label from '~/components/ui/Label.vue'
import CloudImage from '~/components/ui/CloudImage.vue'
import { type Image } from '~/models/links-v4'
import { type SuccessEventInfo } from './helpers'
import UploadWidget from './UploadWidget.vue'
withDefaults(defineProps<{
title: string
defaultImageUrl?: string
preset?: 'button' | 'product' | 'logo'
}>(), {
preset: 'button'
})
const image = defineModel<Image>({ default: { url: '' } })
const onSuccess = (info: SuccessEventInfo) => {
image.value = {
url: info.secure_url,
provider: 'CLOUDINARY',
providerId: info.public_id,
version: String(info.version)
}
} With
Parsing for just that bit of script took 5 seconds. According to the ESLint debugger, it hasn't even gotten to the linting part, which will go on to take an additional six seconds. However, if I apply
Again, according to ESLint, this is just the initial parsing stage. But with type-check rules enabled, TypeScript ESLint apparently takes 133x longer to parse (and 20x longer to lint). ESLint parsing / linting is so bad with this plugin that I'm trying to figure out ways to remove it entirely. But, ideally, these kinds of massive performance hits would not happen. I do realize that "type-aware" linting can and should take longer, but the parsing piece doesn't make sense to me. |
Beta Was this translation helpful? Give feedback.
-
Please export the recommended rulesets separately from the configs. I find the ecosystem of "helpers" in the World of Flat Configs to be unhelpful at best, and usually counter-productive. The recommended configs (everyones, not just yours) are basically opaque black boxes that stymie attempts to understand why things break when they break, which is going to happen more often now that ESLint is expanding to support other types of files beyond Javascript. I want to write my own config file so that I understand what is happening. I want to write: {
name: "TypeScript",
files: [...],
plugins: ['@typescript-eslint: tseslint],
languageOptions: {...},
rules: {...tseslint.configs.ruleSets.recommendedTypeChecked} // or whatever
} But I can't, and I have to write const tseslintRecommendedTypeCheckedRules = Object.assign(
{},
...tseslint.configs.recommendedTypeChecked.map(({rules}) => rules).filter(Boolean),
);
{
...
rules: { ...tseslintRecommendedTypeCheckedRules},
} Which is both annoying and fragile, since it depends on the "internals" of the black box, which can easily change even in a patch version. |
Beta Was this translation helpful? Give feedback.
-
My pain point right now is similar to #10538. I receive
Considering |
Beta Was this translation helpful? Give feedback.
-
this is defiened useful of individual developers |
Beta Was this translation helpful? Give feedback.
-
This discussion is intended to be a general thread where we can collect some feedback from users. We've recently seen some unstructured complaints and critiques in other repo discussions and on twitter - which is hard for us to action because we can't easily engage or collect more information in those places (off-topic spam or 140 character limit).
Discussion threads here will let us organise a bit without forcing everyone to go through filing a new issue with a template.
So please provide your feedback. Let us know what you find difficult about using TypeScript with ESLint. Please provide more than a sentence to help us understand. If you can add some examples that would be great.
You don't need to think about or provide any solutions to the problem - leave that to us! (but feel free to provide them if you want!)
We may not be able to respond to everyone, but be sure that every comment will be read by maintainers and will help us to improve the ecosystem.
Beta Was this translation helpful? Give feedback.
All reactions