"YAMLException: Cannot read config file: .eslintrc"
See original GitHub issue(using npm v3.3.12
in win10 x64)
Today I updated from v2.0.0 to eslint v2.1.0
.
I have the following .eslintrc
(which I have generated using the new --init
parameter) :
(located in C:\Users\Kostas
)
module.exports = {
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"accessor-pairs": 2,
"array-bracket-spacing": [
2,
"never"
],
"array-callback-return": 2,
"arrow-body-style": 2,
"arrow-parens": 2,
"arrow-spacing": 2,
"block-scoped-var": 0,
"block-spacing": 0,
"brace-style": 0,
"callback-return": 2,
"camelcase": 0,
"comma-spacing": 0,
"comma-style": [
2,
"last"
],
"complexity": 2,
"computed-property-spacing": [
2,
"never"
],
"consistent-return": 0,
"consistent-this": 2,
"curly": 2,
"default-case": 2,
"dot-location": [
2,
"property"
],
"dot-notation": 2,
"eol-last": 2,
"eqeqeq": 0,
"func-names": 0,
"func-style": [
2,
"declaration"
],
"generator-star-spacing": 2,
"global-require": 2,
"guard-for-in": 2,
"handle-callback-err": 2,
"id-blacklist": 2,
"id-length": 0,
"id-match": 2,
"indent": 0,
"init-declarations": 0,
"jsx-quotes": 2,
"key-spacing": 2,
"keyword-spacing": [
2,
{
"after": true,
"before": true
}
],
"linebreak-style": [
2,
"unix"
],
"lines-around-comment": 2,
"max-depth": 0,
"max-len": 0,
"max-nested-callbacks": 2,
"max-params": 2,
"new-parens": 2,
"newline-after-var": 0,
"newline-per-chained-call": 0,
"no-alert": 2,
"no-array-constructor": 2,
"no-bitwise": 2,
"no-caller": 2,
"no-catch-shadow": 2,
"no-confusing-arrow": 2,
"no-continue": 2,
"no-div-regex": 2,
"no-else-return": 2,
"no-empty-function": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-extend-native": 0,
"no-extra-bind": 2,
"no-extra-label": 2,
"no-extra-parens": 0,
"no-floating-decimal": 2,
"no-implicit-coercion": 2,
"no-implicit-globals": 0,
"no-implied-eval": 2,
"no-inline-comments": 0,
"no-inner-declarations": [
2,
"functions"
],
"no-invalid-this": 2,
"no-iterator": 2,
"no-label-var": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-lonely-if": 0,
"no-loop-func": 2,
"no-magic-numbers": 0,
"no-mixed-requires": 2,
"no-multi-spaces": 0,
"no-multi-str": 0,
"no-multiple-empty-lines": 0,
"no-native-reassign": 2,
"no-negated-condition": 0,
"no-nested-ternary": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-object": 2,
"no-new-require": 2,
"no-new-wrappers": 2,
"no-octal-escape": 2,
"no-param-reassign": 2,
"no-path-concat": 2,
"no-plusplus": 0,
"no-process-env": 2,
"no-process-exit": 2,
"no-proto": 2,
"no-restricted-imports": 2,
"no-restricted-modules": 2,
"no-restricted-syntax": 2,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow": [
2,
{
"builtinGlobals": false,
"hoist": "never"
}
],
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
"no-sync": 2,
"no-ternary": 0,
"no-throw-literal": 2,
"no-trailing-spaces": 2,
"no-undef-init": 2,
"no-undefined": 2,
"no-underscore-dangle": 2,
"no-unmodified-loop-condition": 2,
"no-unneeded-ternary": 2,
"no-unused-expressions": 2,
"no-use-before-define": 0,
"no-useless-call": 2,
"no-useless-concat": 0,
"no-useless-constructor": 2,
"no-var": 0,
"no-void": 2,
"no-warning-comments": 0,
"no-whitespace-before-property": 2,
"no-with": 2,
"object-curly-spacing": [
2,
"never"
],
"object-shorthand": 0,
"one-var": 0,
"one-var-declaration-per-line": [
2,
"initializations"
],
"operator-assignment": [
2,
"always"
],
"operator-linebreak": 0,
"padded-blocks": 0,
"prefer-arrow-callback": 0,
"prefer-const": 0,
"prefer-reflect": 0,
"prefer-rest-params": 0,
"prefer-spread": 0,
"prefer-template": 0,
"quote-props": 0,
"quotes": 0,
"radix": [
2,
"as-needed"
],
"require-jsdoc": 0,
"require-yield": 2,
"semi": 2,
"semi-spacing": [
2,
{
"after": true,
"before": false
}
],
"sort-imports": 2,
"sort-vars": 2,
"space-before-blocks": 0,
"space-before-function-paren": 0,
"space-in-parens": [
2,
"never"
],
"space-infix-ops": 0,
"space-unary-ops": 2,
"spaced-comment": 0,
"strict": [
2,
"never"
],
"template-curly-spacing": 2,
"valid-jsdoc": 2,
"vars-on-top": 0,
"wrap-iife": 2,
"wrap-regex": 2,
"yield-star-spacing": 2,
"yoda": [
2,
"never"
]
}
};
Here is what I get whenever I lint any file in command prompt:
C:\Users\Kostas\Desktop\1>eslint 1.js
C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:141
throw e;
^
YAMLException: Cannot read config file: C:\Users\Kostas\Desktop\1\.eslintrc
Error: end of the stream or a document separator is expected at line 2, column 10:
"env": {
^
at generateError (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\node_modules\js-yaml\lib\js-yaml\loader.js:162:10)
at throwError (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\node_modules\js-yaml\lib\js-yaml\loader.js:168:9)
at readDocument (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\node_modules\js-yaml\lib\js-yaml\loader.js:1508:5)
at loadDocuments (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\node_modules\js-yaml\lib\js-yaml\loader.js:1544:5)
at load (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\node_modules\js-yaml\lib\js-yaml\loader.js:1561:19)
at Object.safeLoad (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\node_modules\js-yaml\lib\js-yaml\loader.js:1579:10)
at loadLegacyConfigFile (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:137:21)
at loadConfigFile (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:218:22)
at Object.load (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:435:18)
at loadConfig (C:\Users\Kostas\AppData\Roaming\npm\node_modules\eslint\lib\config.js:67:33)
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Cannot read config file .eslintrc.json Error: Unexpected token
I'm exploring EsLint for my React JS ...
Read more >eslint/eslint - Gitter
When I run eslint, it says "YAMLException: cannot read config file ...." and "Error: end of the stream or a document separator is...
Read more >ESLint's new config system, Part 2: Introduction to flat config
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >eslint: Fix invalid filename validation - Merge requests - GitLab
This was happening because our ES6 files have the following structure ... match-regex": [2, "^[a-z0-9_]+(\.js)?$"] ^ YAMLException: Cannot read config file: ...
Read more >can't run eslint because relative paths to extended ... - YouTrack
Error: Cannot read config file: C:\Users\Elena.Pogorelova\AppData\Local\Temp-mirror-0\WebstormProjects\untitled\node_modules\conventions.eslintrc-es6
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you want to use a JavaScript format for your configuration file, then you need to name it
.eslintrc.js
.You mentioned that you used
--init
to create this file, did you rename it or was it created this way?(Also, there were some bugs in
--init
that we fixed in v2.1.0, so can you try upgrading to see if you can create a correct config?)CC @IanVS
the ghost issue bit me today. I tried re-name, re-edit, it still read an error version which I put false in place of 0.
Please ignore! But I will still log it here just in case someone get into a really really edge case like here.
The error here is actually a eslint-loader error bundled in webpack bundles js. This happens only in karma test stdout which have both CLI output and JS runtime output. I supposed to rebuild the dependency after I change eslintrc.