AndreaPontrandolfo / sheriff

A comprehensive and opinionated Typescript-first ESLint configuration.
https://www.eslint-config-sheriff.dev
MIT License
111 stars 7 forks source link

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

Closed sangrepura closed 4 days ago

sangrepura commented 1 month ago
[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/jiti@1.21.6/node_modules/jiti/dist/jiti.js:1:241814)
    at jiti (./node_modules/.pnpm/jiti@1.21.6/node_modules/jiti/dist/jiti.js:1:244531)
    at ./eslint.config.ts:1:213
    at evalModule (./node_modules/.pnpm/jiti@1.21.6/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/types@4.1.1: the types are now exported directly from eslint-config-sheriff
 WARN  2 deprecated subdependencies found: glob@7.1.7, inflight@1.0.6
 ```
 
 Do the docs need to be updated?
sangrepura commented 1 month ago

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?

lishaduck commented 1 month ago

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 commented 3 weeks ago

@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 commented 2 weeks ago

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

lishaduck commented 4 days ago

Duplicate of #201?

AndreaPontrandolfo commented 4 days ago

@lishaduck Im doing a PR that will resolve both.