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

Lint script fails due to parsing errors #532

Open
mike-phillips opened this issue Aug 17, 2022 · 0 comments
Open

Lint script fails due to parsing errors #532

mike-phillips opened this issue Aug 17, 2022 · 0 comments

Comments

@mike-phillips
Copy link

Issue Summary

yarn run lint fails for a brand new project created with gatsby-starter-ghost

➜  gatsby-starter-ghost git:(main) yarn run lint
yarn run v1.22.19
$ eslint . --ext .js --cache

/Users/mike/src/gatsby-starter-ghost/.eslintrc.js
  0:0  error  Parsing error: require() of ES Module /Users/mike/src/gatsby-starter-ghost/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/mike/src/gatsby-starter-ghost/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
Instead change the require of definition.js in /Users/mike/src/gatsby-starter-ghost/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules
...

To Reproduce

  1. gatsby new example-project https://github.com/TryGhost/gatsby-starter-ghost.git
  2. cd example-project
  3. yarn install
  4. yarn run lint

I think this is a bug because it adds work to getting basic CI/CD up-and-running for every new project created with this tool.

The impact may be minor if the user is capable of debugging and resolving the issues. Probably depends on the experience of the developer and how much they care about having these commands working.

Technical details:

  • Ghost Version: N/A as far as I'm aware
  • Gatsby CLI version: 4.20.0
  • Gatsby version: 4.15.2
  • gatsby-starter-ghost Version: 2.0.0
  • Node Version: 16.16.0
  • OS: Mac

Resolution Notes

Others encountering this issue have resolved the problem by migrating from babel-eslint (deprecated as of March 2020) to @babel/eslint-parser.

I plan to put up a pull request that:

  1. does the migration from babel-eslint to @babel/eslint-parser
  2. adds a lint-fix script
  3. applies automated fixes to any existing eslint issues
  4. applies inline ignores to any remaining eslint issues (unless the fixes are obvious)

It'd be great to add a github action that ensures the linting is passing for any pull requests to the main branch but that seems out of scope for the initial fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant