obsidianmd / obsidianmd/obsidian-sample-plugin

File eslint.config.mts from the template contains typescript errors

Open
#173 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.5k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

File eslint.config.mts from the template contains TypeScript errors:

  • Cannot find module 'eslint/config' or its corresponding type declarations.ts(2307)
  • 'obsidianmd.configs' is possibly 'undefined'.ts(18048)
  • Type 'LegacyConfigObject<RulesConfig, RulesConfig> | ConfigObject | ConfigObject[]' must have a 'Symbol.iterator' method that returns an iterator.ts(2488)

How to replicate: Make a new repository from the template, install dependencies, open eslint.config.mts and observe the errors in your IDE.

Expected behaviour: No typescript errors upon initialization from the template.

Here's the code and where the errors happen for reference:

import tseslint from 'typescript-eslint';
import obsidianmd from "eslint-plugin-obsidianmd";
import globals from "globals";
import { globalIgnores } from "eslint/config";  // Cannot find module 'eslint/config' or its corresponding type declarations.ts(2307)

export default tseslint.config(
	{
		languageOptions: {
			globals: {
				...globals.browser,
			},
			parserOptions: {
				projectService: {
					allowDefaultProject: [
						'eslint.config.js',
						'manifest.json'
					]
				},
				tsconfigRootDir: import.meta.dirname,
				extraFileExtensions: ['.json']
			},
		},
	},
        // 'obsidianmd.configs' is possibly 'undefined'.ts(18048)
        // Type 'LegacyConfigObject<RulesConfig, RulesConfig> | ConfigObject<RulesConfig> | ConfigObject<RulesConfig>[]' must have a '[Symbol.iterator]()' method that returns an iterator.ts(2488)
	...obsidianmd.configs.recommended,
	globalIgnores([
		"node_modules",
		"dist",
		"esbuild.config.mjs",
		"eslint.config.js",
		"version-bump.mjs",
		"versions.json",
		"main.js",
	]),
);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with eslint.config.mts in a repository created from the template and reproduce the three TypeScript errors in an IDE. Trace the imports and obsidianmd configuration shown in the issue, then verify that a newly initialized repository reports no TypeScript errors in this file.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.