question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

eslint --init: config.extends.push

See original GitHub issue

Tell us about your environment Node version: v12.14.0 npm version: v6.13.4 Local ESLint version: v6.8.0 (Currently used) Global ESLint version: Not found

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint. I want to enable eslint for my exists TypeScript project.

eslint --init
? How would you like to use ESLint? To check syntax, find problems, and enforce code style
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? React
? Does your project use TypeScript? Yes
? Where does your code run? Browser, Node
? How would you like to define a style for your project? Inspect your JavaScript file(s)
? Which file(s), path(s), or glob(s) should be examined? ./src/**.{ts,tsx}
? What format do you want your config file to be in? JavaScript

What actually happened? Please include the actual, raw output from ESLint. Several module not found:

After install them all, It show me an error:

Determining Config: 0% [------------------------------] 0.0s elapsed, eta 0.0s Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration .
Determining Config: 100% [==============================] 0.1s elapsed, eta 0.0s

Enabled 275 out of 275 rules based on 2 files.

config.extends.push is not a function
TypeError: config.extends.push is not a function
    at processAnswers (/MY_PROJ/node_modules/eslint/lib/init/config-initializer.js:331:24)
    at /MY_PROJ/node_modules/eslint/lib/init/config-initializer.js:615:28
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Are you willing to submit a pull request to fix this bug? No, I found the problem, but don’t know how to fix it (in your way).

selected “react”:

https://github.com/eslint/eslint/blob/master/lib/init/config-initializer.js#L294

select “Inspect your JavaScript file(s)”:

https://github.com/eslint/eslint/blob/master/lib/init/config-initializer.js#L326
https://github.com/eslint/eslint/blob/master/lib/init/autoconfig.js#L336

extendFromRecommended will set config.extends to RECOMMENDED_CONFIG_NAME, there are two problems:

  • RECOMMENDED_CONFIG_NAME is a string, after extendFromRecommended return, the parent scope expect config.extends is an array
  • It drop my selection of “react” (or “vue”)

selected “typescript”:

https://github.com/eslint/eslint/blob/master/lib/init/config-initializer.js#L329

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
eslint-deprecated[bot]commented, Mar 24, 2020

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that accepted issues failing to be implemented after 90 days tend to never be implemented, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

1reaction
koenpuntcommented, Feb 5, 2020

which should install deps for you.

Ah, didn’t know this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
eslint-config-standard - npm
Shareable configs are designed to work with the extends feature of .eslintrc files. You can learn more about Shareable Configs on the official ......
Read more >
How to add a custom ESLint configuration to a Create React ...
Go to package.json at the root of the project, and remove the eslintConfig object. Add ESLint configuration.
Read more >
How To Lint and Format Code with ESLint in Visual Studio Code
Using the --init flag activates ESLint for your project. Activating or initializing ESLint will create an ESLint configuration file that will ...
Read more >
Error - ESLint: 7.32.0 ESLint couldn't find the config "standard ...
1 Answer 1 · Locally in your project, run npm init @eslint/config (will ask you some questions and generate a new .eslint.{js|yml|json} out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found