Comments (8)
ahh I see - ok - yah that works, I can pin my version to be the same. thanks for the quick help @Shinigami92!
Going to leave this open for the community in case someone else runs into the same thing, but feel free to close if you want.
from eslint-define-config.
@Shinigami92 - I actually changed my approach a bit so that this libs types override anything from eslint so I no longer have the problem at all. (even without the patch) - I do appreciate your quick attention to this though! 🙌🏻
from eslint-define-config.
Hope that issue was clear, thanks!
Not 100% yet, could you link me the definitely typed and maybe also provide a reproducible so I understand better what the issue is?
from eslint-define-config.
https://stackblitz.com/edit/typescript-zgntds?file=index.ts
import type { Rules } from 'eslint-define-config';
import type { Linter } from 'eslint';
const rules1: Rules = {};
const rules2: Linter.RulesRecord = {};
const rules: Linter.RulesRecord = {
...rules1,
...rules2,
};
Yes here is a minimal example showing the problem with a stackblitz. In strict mode Rules
are not assignable to Linter.RulesRecord
from eslint-define-config.
eslint-define-config
uses
Could you try downgrading and pin your @types/eslint
to that? And try again?
The version did change really much and sometimes breaking changes are not covered in semver for TS types.
So maybe I just then need to bump the deps and recreate the Rules and everything. But when I have the time...
from eslint-define-config.
ahh I see - ok - yah that works, I can pin my version to be the same. thanks for the quick help @Shinigami92!
Going to leave this open for the community in case someone else runs into the same thing, but feel free to close if you want.
Perfect 👍
Thanks for the info
I will act when I have the time
from eslint-define-config.
I had a first look and it takes more time than just some minutes
I need to update many rules especially the generation for eslint-plugin-{node/N}
and there seems not to be two changes that might have made my own type-defs incompatible with eslint new defs
// These are my own types
export type RuleSeverity = 'off' | 'warn' | 'error' | 0 | 1 | 2;
export type RuleConfig<Options extends unknown[] = unknown[]> =
| RuleSeverity
| [RuleSeverity, ...Options];
// These are the new eslint types
type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
? Result
: never;
type Severity = 0 | 1 | 2;
type RuleLevel = Severity | "off" | "warn" | "error";
type RuleLevelAndOptions<Options extends any[] = any[]> = Prepend<Partial<Options>, RuleLevel>;
type RuleEntry<Options extends any[] = any[]> = RuleLevel | RuleLevelAndOptions<Options>;
- it extends
any[]
instead ofunknown[]
- It uses
Partial
forOptions
I assume one of these both breaks it
But also that way my types are stronger!
Maybe I could even harden the types on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/808bf075ca716aab85e3e317b49d8638cacc23a5/types/eslint/index.d.ts#L717-L719 instead of loosing my types
The biggest problem!: I cannot use @types/eslint
in my src
!!! Because then I would enforce @types/eslint
to be installed for everyone using my plugin. But it is "just" a devDependency and so I would need to sync my types with them somehow.
... I need more time to investigate this and dig deeper (so sadly maybe not today)
from eslint-define-config.
@spence-s would you like to give me feedback if everything is working as needed?
from eslint-define-config.
Related Issues (20)
- Manually fix known ESLint schema mistakes HOT 2
- `parserOptions.project` is missing the `true` value
- Many rule allow unwanted additionalProperties HOT 11
- Overly restrictive `engines.pnpm` causes errors HOT 7
- Can't import types HOT 7
- Comparison with JSDocs
- LanguageOptions.parser is not accepting objects
- Add eslint-plugin-yml HOT 1
- Predefined string configurations in flat config seem to be deprecated HOT 3
- Support augmented global properties HOT 4
- Types are not correct for native ESM modules and cannot be imported there HOT 3
- Missing build files HOT 2
- v1.24.1 prevents installing on node 16 HOT 3
- suggestion: Move config types to DefinitelyTyped/eslint HOT 8
- Avoid shipping src
- Deep freeze flat config in `defineFlatConfig` HOT 2
- CJS type declarations are not created HOT 2
- Should I use triple slash reference when using @eslint-types/typescript-eslint or something else?
- FlatESLintConfig does not support custom plugins HOT 2
- Converting from old eslint config to flat config gives error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-define-config.