solidjs-community / eslint-plugin-solid

Solid-specific linting rules for ESLint.
MIT License
216 stars 26 forks source link

types missing #146

Open huseeiin opened 1 month ago

huseeiin commented 1 month ago

Describe the bug

when importing eslint-plugin-solid/configs/recommended.js (what is shown in the docs) there are no types, but when importing eslint-plugin-solid/dist/configs/recommended.js there are correct types.

To Reproduce

Expected behavior

Screenshots

Environment (please complete the following information):

Additional context

OrbitalOperator commented 1 month ago

I think it's related so I'm gonna comment here.

Describe the bug

When using the import for the flat typescript configuration as per the doc :

import solid from "eslint-plugin-solid/configs/typescript";

I got the following error

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/my-repo/node_modules/eslint-plugin-solid/configs/typescript' imported from my-repo/eslint.config.js
Did you mean to import "eslint-plugin-solid/configs/typescript.js"?

When doing this suggested import, ie adding the .js, it does work but then my IDE is showing me the follwing warning

Cannot resolve symbol 'eslint-plugin-solid/configs/typescript.js' 

To Reproduce

npm install eslint-plugin-solid@0.14.1

Use the following configuration (copy pasted as is from the doc on the 07/20/2024):

import js from "@eslint/js";
import solid from "eslint-plugin-solid/configs/typescript";
import * as tsParser from "@typescript-eslint/parser";

export default [
  js.configs.recommended,
  {
    files: ["**/*.{ts,tsx}"],
    ...solid,
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        project: "tsconfig.json",
      },
    },
  },
];

Expected behavior

The import should work without adding an extra .js.

Environment

OS: `Fedora Linux 40 (Workstation Edition) Linux 6.9.5-200.fc40.x86_64
Node version: `v20.15.0`
Package Manager: pnpm@9.5.0+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903
eslint-plugin-solid: 0.14.1
esling: 9.7.0
eagerestwolf commented 2 weeks ago

I'm going to look into this. I am not on the core team, but it's been driving me nuts too. It's probably just something in the TSUP config. (correction: this project doesn't use TSUP, not sure why I thought it did).

The main issue is this package is relying on native node module resolution, which on node versions 20 and greater requires the .js extension. I'll look into creating a PR to implement a bundler of some sort once I wake up. In the meantime, this issue will persist