Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eslint failing with error No "exports" main defined in ./node_modules/eslint-config-sheriff/package.json #268

Open
sangrepura opened this issue Sep 28, 2024 · 4 comments · May be fixed by #286 or #269

Comments

@sangrepura
Copy link

[Error - 7:18:00 PM] Calculating config file for file:///package.json) failed.
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in ./node_modules/eslint-config-sheriff/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:304:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:594:13)
    at resolveExports (node:internal/modules/cjs/loader:599:36)
    at Module._findPath (node:internal/modules/cjs/loader:676:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1138:27)
    at Function.resolve (node:internal/modules/helpers:190:19)
    at _resolve (./node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:241814)
    at jiti (./node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:244531)
    at ./eslint.config.ts:1:213
    at evalModule (./node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:247313

I'm using:

import sheriff from 'eslint-config-sheriff';
import { defineFlatConfig } from 'eslint-define-config';
import type { SheriffSettings } from '@sherifforg/types';

const sheriffOptions: SheriffSettings = {
 "react": true,
 "lodash": false,
 "remeda": false,
 "next": true,
 "astro": false,
 "playwright": false,
 "jest": false,
 "vitest": false
};

export default defineFlatConfig([...sheriff(sheriffOptions)])

Also:

 WARN  deprecated @sherifforg/[email protected]: the types are now exported directly from eslint-config-sheriff
 WARN  2 deprecated subdependencies found: [email protected], [email protected]
 ```
 
 Do the docs need to be updated?
@sangrepura
Copy link
Author

OK I fixed it by adding the following to my .vscode/settings.json:

"eslint.options": {
	"flags": ["unstable_ts_config"]
}

per ESlint's documentation

Maybe add this to the docs to reduce some friction for new folks?

sangrepura added a commit to sangrepura/sheriff that referenced this issue Sep 28, 2024
…s` file support (AndreaPontrandolfo#268)

ESlint > v9.9.0 includes experimental support for Typescript configuration files using the flag `unstable_ts_config`.
This adds  documentation for adding the flag to  VSCode.
@lishaduck
Copy link
Contributor

a) that docs PR looks good @AndreaPontrandolfo
b) clearly something has gone dreadfully wrong with #233 (it should never need that, it's optional)

@lishaduck
Copy link
Contributor

@AndreaPontrandolfo, this is (probably) an issue that was fixed with #271?
The issue, as far as I can tell, is that a .ts file being directly imported instead of bundled.

@lishaduck
Copy link
Contributor

@sangrepura, can you share what versions you're using?

@lishaduck lishaduck linked a pull request Nov 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants