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

TypeError: Cannot use 'in' operator to search for 'start' in undefined #520

Closed
4 tasks done
EthanShoeDev opened this issue Jan 14, 2024 · 0 comments · Fixed by #521 or #523
Closed
4 tasks done

TypeError: Cannot use 'in' operator to search for 'start' in undefined #520

EthanShoeDev opened this issue Jan 14, 2024 · 0 comments · Fixed by #521 or #523
Labels
👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on

Comments

@EthanShoeDev
Copy link
Contributor

EthanShoeDev commented Jan 14, 2024

Initial checklist

Affected packages and versions

"eslint-plugin-mdx": "^3.1.4"

Link to runnable example

https://codesandbox.io/p/devbox/eslint-plugin-mdx-typeerror-remark-lint-xqwl2v

Steps to reproduce

Steps to reproduce:

  1. Start with MDX Loader with Next.js codesandbox from issue template.
  2. Install eslint and eslint-mdx
npm i -D eslint-plugin-mdx eslint
  1. Add eslint config file .eslintrc. Config pulled directly from readme.
{
  "extends": ["plugin:mdx/recommended"],
  "settings": {
    "mdx/code-blocks": true,
    "mdx/language-mapper": {}
  }
}
  1. Install remark-lint. reference
npm install vfile-reporter remark remark-preset-lint-consistent remark-preset-lint-recommended remark-lint-list-item-indent --save-dev
  1. Setup remark config by adding remarkConfig to package.json. Config pulled directly from remark-lint readme.
  2. Remove the trailing new line from pages\index.mdx.
  3. Run npx eslint . --ext mdx and result is:
/workspace git:(master) ✗ npx eslint . --ext mdx

Oops! Something went wrong! :(

ESLint: 8.56.0

TypeError: Cannot use 'in' operator to search for 'start' in undefined
Occurred while linting /workspace/pages/index.mdx:1
Rule: "mdx/remark"
    at Program (/workspace/node_modules/eslint-plugin-mdx/lib/rules/remark.js:67:38)
    at ruleErrorHandler (/workspace/node_modules/eslint/lib/linter/linter.js:1076:28)
    at /workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/workspace/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/workspace/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/workspace/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (/workspace/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:803:23)
    at /workspace/node_modules/eslint/lib/linter/linter.js:1111:32

Expected behavior

eslint should output:

/workspace git:(master) ✗ npx eslint . --ext mdx

/workspace/pages/index.mdx
  1:1  warning  Missing newline character at end of file  remark-lint-final-newline

✖ 1 problem (0 errors, 1 warning)
  0 errors and 1 warning potentially fixable with the `--fix` option.

Actual behavior

eslint outputs:

/workspace git:(master) ✗ npx eslint . --ext mdx

Oops! Something went wrong! :(

ESLint: 8.56.0

TypeError: Cannot use 'in' operator to search for 'start' in undefined
Occurred while linting /workspace/pages/index.mdx:1
Rule: "mdx/remark"
    at Program (/workspace/node_modules/eslint-plugin-mdx/lib/rules/remark.js:67:38)
    at ruleErrorHandler (/workspace/node_modules/eslint/lib/linter/linter.js:1076:28)
    at /workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/workspace/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/workspace/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/workspace/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (/workspace/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:803:23)
    at /workspace/node_modules/eslint/lib/linter/linter.js:1111:32

Runtime

Node v20

Package manager

npm v9

OS

Linux

Build and bundle tools

Next.js

EthanShoeDev added a commit to EthanShoeDev/eslint-mdx that referenced this issue Jan 14, 2024
Many remark-lint errors do not set a place variable in the vFile
message. This code should accept undefined for this field.

fixes mdx-js#520
@JounQin JounQin added 🙆 yes/confirmed This is confirmed and ready to be worked on 👍 phase/yes Post is accepted and can be worked on labels Jan 14, 2024
JounQin added a commit that referenced this issue Jan 14, 2024
Many remark-lint errors do not set a place variable in the vFile
message. This code should accept undefined for this field.

fixes #520

Co-authored-by: JounQin <admin@1stg.me>
JounQin added a commit that referenced this issue Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on
2 participants