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.

--print-config outputs empty config if called not from config file directory

See original GitHub issue

What version of ESLint are you using?

2.11.1

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

e:\DOC\prg\js\node\.eslintrc.json

{
  "root": true,

  "extends": [
    "eslint:recommended",
    "airbnb-base"
  ],

  "parserOptions": {
    "ecmaVersion": 7,
    "sourceType": "script"
  },

  "env": {
    "browser": false,
    "es6": true,
    "node": true
  },

  "rules": {
    "eqeqeq": "error",
    "no-console": "off",
    "no-extra-parens": ["error", "all"],
    "quotes": ["error", "single"],
    "spaced-comment": ["error", "always", { "exceptions": ["/", "*"] }],
    "strict": ["error", "global"]
  }
}

What did you do? Please include the actual source code causing the issue.

I have a simple test script in the subdirectory relative to the config directory:

e:\DOC\prg\js\node\-test\test.js:

'use strict';



console.log(1);

eslint output (to be sure eslint really uses all the rules frome the additional configs):

e:\DOC\prg\js\node\-test>eslint test.js

E:\DOC\prg\js\node\-test\test.js
  4:2  error  More than 2 blank lines not allowed  no-multiple-empty-lines

✖ 1 problem (1 error, 0 warnings)

I want to see all the config set via eslint --print-config test.js.

What did you expect to happen?

All the rules from .eslintrc.json + eslint:recommended + airbnb-base should be shown.

What actually happened? Please include the actual, raw output from ESLint.

The output is:

{
  "globals": {},
  "env": {},
  "rules": {},
  "parserOptions": {}
}

However, if I place test.js in the same directory with .eslintrc.json, the output is a big proper rule set.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
vsemozhetbytcommented, Jun 8, 2016

@platinumazure the bug depends not on path and not on relation between path and config file, but from relation between CWD and config file. If you call eslint for subfolder/bar.js from the same folder with config file, it is OK.

0reactions
ilyavolodincommented, Jun 8, 2016

@nzakas That’s what I assumed as well. However, that’s not what is happening. eslint --print-config . is working in the case that you have .eslintrc in the current directory, which is strange and not what I expected. But the tests that I posted are done on the file, not on the pattern. So it seems that there might be two bugs here. First one, --print-config on a file in the subdirectory returns an empty object. Second one, --print-config seems to work on patterns, when it shouldn’t.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ConfigParser - print config.sections() returns [] - Stack Overflow
It returns an empty list ( [] ) when the config file is empty or when there is no file named config.ini ,...
Read more >
configparser — Configuration file parser — Python 3.11.1 ...
This is designed so that you can specify an iterable of potential configuration file locations (for example, the current directory, the user's home...
Read more >
Painless Configuration — Confuse 1.7.0 documentation
The first parameter is required; it's the name of your application, which will be used to search the system for a config file...
Read more >
git-config Documentation - Git
Output only the names of config variables for --list or --get-regexp . ... If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is...
Read more >
Command Line Interface - ESLint - Pluggable JavaScript Linter
eslint [options] file.js [file.js] [dir] Basic configuration: --no-eslintrc Disable use of configuration from .eslintrc.* -c, --config path::String Use this ...
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