Skip to content

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

@keyvanm

Description

@keyvanm

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",
	]),
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions