eslint no-unused-var for generated JS and TS types
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 301
- Forks
- 85
- Avg merge
- 1h 4m
- Merged PRs (30d)
- 4
Description
Is your feature request related to a problem? Please describe.
Given that most JS and TS projects use ESLint for code validation, I suggest adding two exceptions (// eslint-disable-next-line @typescript-eslint/no-unused-vars) to the generated types by default; otherwise, they may cause developers' linters to fail.
JS:
export const idlFactory = ({ IDL }) => {
const Hello = IDL.Record({ 'world' : IDL.Text });
return IDL.Service({
'yolo' : IDL.Func([Hello], [IDL.Text], ['query']),
});
};
export const init = ({ IDL }) => { return []; }; // ---> ESLint: 'IDL' is defined but never used.(@typescript-eslint/no-unused-vars)
TS:
import type { Principal } from '@dfinity/principal'; // ---> ESLint: 'Principal' is defined but never used.(@typescript-eslint/no-unused-vars)
import type { ActorMethod } from '@dfinity/agent';
import type { IDL } from '@dfinity/candid';
export interface Hello { 'world' : string }
export interface _SERVICE {
'yolo' : ActorMethod<[Hello], string>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the generator responsible for the JavaScript and TypeScript outputs shown in the issue and inspect how their templates are assembled. Verify the generated files with ESLint and TypeScript linting; done means the default outputs no longer report the demonstrated unused-variable warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100