Coder Social home page Coder Social logo

Comments (3)

bradzacher avatar bradzacher commented on June 12, 2024 2

Wow they committed the cardinal sin of using Object.

https://github.com/eslint/rewrite/blob/d5a04961b99e4e3e529d631089a51b68581bb741/packages/compat/src/types.ts#L13-L15

Honestly I think that this is a bug in their types, not ours. You'll find that their types also don't work with @types/eslint.

They've ultimately defined these super loose janky types that nobody can align with.

We already define super loose types for this assignment to be permissive and accept many things - but they're even looser than we are which is insane to consider.

export type LooseRuleDefinition =
// TODO - ESLint v9 will remove support for RuleCreateFunction
| LooseRuleCreateFunction
| {
meta?: object | undefined;
create: LooseRuleCreateFunction;
};
/*
eslint-disable-next-line @typescript-eslint/no-explicit-any --
intentionally using `any` to allow bi-directional assignment (unknown and
never only allow unidirectional)
*/
export type LooseRuleCreateFunction = (context: any) => Record<
string,
/*
eslint-disable-next-line @typescript-eslint/ban-types --
intentionally use Function here to give us the basic "is a function" validation
without enforcing specific argument types so that different AST types can still
be passed to configs
*/
Function | undefined
>;

So yeah I'd file an issue upstream and get them to define something that'll work with the existing ecosystem.

((separately they should consider using our recommended rule set on their TS files to catch such issues))

from typescript-eslint.

karlhorky avatar karlhorky commented on June 12, 2024 2

Good point, thanks! I also was able to confirm that the @eslint/compat types are incompatible with the Linter.FlatConfig[] type from @types/eslint.

I reported it over here:

from typescript-eslint.

bradzacher avatar bradzacher commented on June 12, 2024 1

I'll close this out then as there's nothing for us to action from our side.

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.