antfu / eslint-typegen

Generate types from ESLint rule schemas, with auto-completion and type-checking for rule options.
MIT License
185 stars 4 forks source link

JSONParserError: Token "definitions" does not exist. #3

Closed pnodet closed 7 months ago

pnodet commented 7 months ago

Describe the bug

> esno scripts/typegen.ts

Failed to compile schema PerfectionistSortImports for rule perfectionist/sort-imports. Falling back to unknown.

{
  stack: 'JSONParserError: Token "definitions" does not exist.\n' +
    '    at Pointer.resolve (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js:103:23)\n' +
    '    at $Ref.resolve (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js:81:28)\n' +
    '    at $Refs._resolve (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js:158:21)\n' +
    '    at dereference$Ref (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js:152:27)\n' +
    '    at crawl (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js:87:40)\n' +
    '    at crawl (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js:97:44)\n' +
    '    at crawl (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js:97:44)\n' +
    '    at crawl (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js:97:44)\n' +
    '    at dereference (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js:43:26)\n' +
    '    at $RefParser.dereference (/eslint-config/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.5.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js:182:42)',
  code: 'EUNMATCHEDRESOLVER',
  name: 'MissingPointerError',
  message: 'Token "definitions" does not exist.',
  source: /eslint-config/',
  path: null,
  toJSON: [Function: toJSON],
  footprint: 'null+/eslint-config/+EUNMATCHEDRESOLVER+Token "definitions" does not exist.',
  toString: [Function: toString]
}

Reproduction

/

System Info

System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 79.64 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/Library/Caches/fnm_multishells/33657_1711591886088/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 9.6.7 - ~/Library/Caches/fnm_multishells/33657_1711591886088/bin/npm
    pnpm: 8.15.5 - /opt/homebrew/bin/pnpm
    bun: 1.0.35 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 117.0.5938.62
    Safari: 17.4

Used Package Manager

pnpm

Validations

pnodet commented 7 months ago

Hi @antfu

I use a fork of your eslint-config but running into this issue.

File : https://github.com/nivalis-studio/eslint-config/blob/main/scripts/typegen.ts

antfu commented 7 months ago

It's perfectionist/sort-imports schema is not correct, I haven't look into it but you can safely ignore this warning

pnodet commented 7 months ago

Sure, I wasn't too worried about it but I wanted to let you know in case you had not run into the issue