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.

given .eslintrc in filePath is not the only one considered - but also current and user folder's

See original GitHub issue

around line 224 of index.js you are calling const config = configFinder.getConfigForFile(filePath); which ends up calling eslint/lib/config.js#getConfig() method

What I can see is that this method will compute the configuration not only using the given config file but also the current project config file, user’s config and probably other .eslintrc in the system.

In my case the manifested bug is that a .eslintrc file that doesn’t define a rule and should take the default value will nevertheless be defaulted with my current project .eslintrc (or could be my user’s .eslintrc).

If I set a ‘filePath’ in prettier-eslint I expect that only the rules defined there are applied and the others take default values. If this is how prittier-eslint should work then I think for this particular project this is causing lots of issues. But maybe you disagree?

I also tried to illustrate the issue by taking a screenshot of a breakpoint in the eslint/lib/config.js#getConfig() and printing the vector variable that contains more than one .eslintrc - the given one and another one that is in my local project - they are all merged and I think that shound’t happen

screenshot_2017-12-08_21-11-44

I just starting using pretties-eslint and is very very cool - will keep investigating the issue and try to pull request a solution - could take me a while since. But keep tit up !!! 😃

BTW - I’m developing a gallery of what code looks like using different popular eslint-configs here: https://cancerberosgx.github.io/prettier-eslint-gallery/gallery/

The idea is to compare eslint --fix with prettier-eslint and also (TODO) to generate reports of how well both formatters do the job fixing applying each the config

Versions I’m using :

node: 9.2.0 “babel-eslint”: “^8.0.3”, “eslint”: “^4.12.1”, “eslint-config-airbnb-base”: “^12.1.0”, “eslint-config-google”: “^0.9.1”, “eslint-config-gulp”: “^2.1.0”, “eslint-config-hapi”: “^11.1.0”, “eslint-config-mdcs”: “^4.2.2”, “eslint-config-standard”: “^10.2.1”, “eslint-config-walmart”: “^2.2.0”, “eslint-config-xo”: “^0.19.0”, “eslint-plugin-filenames”: “^1.2.0”, “eslint-plugin-hapi”: “^4.1.0”, “eslint-plugin-import”: “^2.8.0”, “eslint-plugin-jsx-a11y”: “^6.0.2”, “eslint-plugin-markdown”: “^1.0.0-beta.6”, “eslint-plugin-node”: “^5.2.1”, “eslint-plugin-promise”: “^3.6.0”, “eslint-plugin-react”: “^7.5.1”, “eslint-plugin-standard”: “^3.0.1”, “handlebars”: “^4.0.11”, “prettier-eslint”: “^8.2.5”,

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
zimmecommented, Jan 2, 2018

Yes, they are related. But it’s because of the way we handle provided configuration and merge that with configuration we read from file.

I’ve been thinking about changing this behaviour, but it’s a breaking change so before we make that change I need to make sure the “new” solution can handle all the use cases otherwise the change seems unnecessary.

0reactions
zimmecommented, Jan 17, 2018

Closing this as it’s working as intended, i.e. we rely on eslint’s own config resolving and I won’t be implementing my own.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration Files - 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 only target a specific directory (eslintrc, create-react-app)
I have been able to run the linter in a specific folder easily from the CLI but on compile, it targets ALL folders....
Read more >
ESLint not working in VSCode? Help build a troubleshooting ...
Sometimes, I accidentally scaffold a project in my home directory and forget to delete the hidden .eslintrc.js .
Read more >
Navigating Files and Directories - Data Carpentry
However, you can also give ls the names of other directories to view. Navigate to your home directory if you are not already...
Read more >
How To Lint and Format Code with ESLint in Visual Studio Code
1.4, and eslint v8.3.0. Step 1 — Creating JavaScript Starter Code. You need to start with a demo project. Create a directory for...
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