eslint breaks `.d.ts` files
See original GitHub issueTell us about your environment
- ESLint Version: 6.8.0
- Node Version: v12.16.1
- npm Version: 6.13.4
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
module.exports = {
root: true,
env: {
browser: true,
node: true
},
extends: [
'@nuxtjs/eslint-config-typescript',
'prettier',
'prettier/vue',
'plugin:prettier/recommended',
'plugin:nuxt/recommended'
],
plugins: [
'prettier'
],
// add your custom rules here
rules: {
},
ignorePatterns: ["docs/"]
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
declare module '*/office.gql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const AllOffices: DocumentNode;
export default defaultDocument;
}
declare module '*/p-graphql.gql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const HelloMessage: DocumentNode;
export const HelloValue1: DocumentNode;
export const HelloValue2: DocumentNode;
export const HelloValue3: DocumentNode;
export const Hi: DocumentNode;
export const HelloAndHi: DocumentNode;
export default defaultDocument;
}
yarn eslint --fix xxx.d.ts
What did you expect to happen?
declare module '*/office.gql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const AllOffices: DocumentNode;
export default defaultDocument;
}
declare module '*/p-graphql.gql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const HelloMessage: DocumentNode;
export const HelloValue1: DocumentNode;
export const HelloValue2: DocumentNode;
export const HelloValue3: DocumentNode;
export const Hi: DocumentNode;
export const HelloAndHi: DocumentNode;
export default defaultDocument;
}
What actually happened? Please include the actual, raw output from ESLint.
declare module '*/office.gql' {
import { DocumentNode, DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const AllOffices: DocumentNode;
export default defaultDocument;
}
declare module '*/p-graphql.gql' {
const defaultDocument: DocumentNode;
export const HelloMessage: DocumentNode;
export const HelloValue1: DocumentNode;
export const HelloValue2: DocumentNode;
export const HelloValue3: DocumentNode;
export const Hi: DocumentNode;
export const HelloAndHi: DocumentNode;
export default defaultDocument;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Why is eslint throwing error for .d.ts files in my node project
I have configured eslint for my typescript node project. There is also a file app.d.ts in the repo. On running the lint, I...
Read more >How to use ESLint with TypeScript | Khalil Stemmler
ESLint is a JavaScript linter that you can use to lint either TypeScript or JavaScript code. In this post, we'll walk through how...
Read more >The starting point for learning TypeScript
Learn how to write declaration files to describe existing JavaScript. Important for DefinitelyTyped contributions. Introduction · Declaration Reference ...
Read more >Rules - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >eslint-import-resolver-typescript | Yarn - Package Manager
eslint -import-resolver-typescript · import / require files with extension .cts / .mts / .ts / .tsx / .d.cts / .d.mts / .d.ts ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dora-gt thanks for the issue!
This seems to be caused by a third-party rule: import/no-duplicates
Please create an issue in the
eslint-plugin-import
repository:https://github.com/benmosher/eslint-plugin-import
Disabling
import/no-duplicates
worked! Thank you so much 🙇 I’ll report there.