Code Monkey home page Code Monkey logo

Comments (6)

github-actions avatar github-actions commented on June 12, 2024

Uh oh! @juliusmarminge, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

from typescript-eslint.

bradzacher avatar bradzacher commented on June 12, 2024

What's the usecase that you have that is failing?
We are intentionally not compatible with the @types/eslint types in many places because the types have different philosophies.

You could point to any number of places that the types diverge and say "fix it" but without a motivating usecase we aren't going to change it.

Please help us understand your usecase with some code sample(s) that are currently broken.

from typescript-eslint.

juliusmarminge avatar juliusmarminge commented on June 12, 2024

I tried writing my config like this (basically just adding the files options to your configs:

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

/** @type {import("eslint").Linter.FlatConfig[]} */
export default [
  {
    ignores: [
      // some globally ignored files
      "pnpm-lock.yaml",
    ],
  },
  {
    files: ["**/*.js", "**/*.ts", "**/*.tsx"],
    rules: eslint.configs.recommended.rules,
  },
  ...[
    ...tseslint.configs.recommended,
    ...tseslint.configs.recommendedTypeChecked,
  ].map((conf) => ({
    files: ["**/*.js", "**/*.ts", "**/*.tsx"],
    rules: conf.rules ?? {}, // <-- this type-mismatches
  })),
  {
    languageOptions: {
      parserOptions: {
        project: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
];

from typescript-eslint.

juliusmarminge avatar juliusmarminge commented on June 12, 2024

Sure, I could do:

/** @type {import('typescript-eslint').Config} */
export default [
  ...
]

instead, but to me atleast i feel like i wanna type this using ESLint since tseslint is just a part of the config?

from typescript-eslint.

bradzacher avatar bradzacher commented on June 12, 2024

As per our docs we suggest not using the ESLint types for your config.

We have found many cases where the @types/eslint types are overly restrictive and can cause type errors where things should work fine. They have no tests to ensure compatibility with the ecosystem.

OTOH our types are intended to be more forgiving and we have integration tests in place to ensure we can accept all manner of plugins and parsers with many different tsconfigs.

from typescript-eslint.

bradzacher avatar bradzacher commented on June 12, 2024

As an example you could simplify your config with our tooling

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default tseslint.config(
  {
    ignores: [
      // some globally ignored files
      "pnpm-lock.yaml",
    ],
  },
  {
    files: ["**/*.js", "**/*.ts", "**/*.tsx"],
    extends: [eslint.configs.recommended],
  },
  {
    files: ["**/*.js", "**/*.ts", "**/*.tsx"],
    extends: [
      ...tseslint.configs.recommended,
      ...tseslint.configs.recommendedTypeChecked,
    ],
  }, 
  {
    languageOptions: {
      parserOptions: {
        project: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
); 

from typescript-eslint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.