1hella / eslint-config-airbnb-es5

An unofficial Airbnb ESLint configuration, following Airbnb's ES5 JavaScript style guide.
MIT License
28 stars 27 forks source link

The package is unusable due to syntax errors #2

Closed honzajavorek closed 9 years ago

honzajavorek commented 9 years ago

My settings:

package.json

...
"devDependencies": {
    "babel-eslint": "^4.1.1",
    "chai": "^3.2.0",
    "eslint": "^1.3.1",
    "eslint-config-airbnb-es5": "^1.0.6",
    "eslint-plugin-react": "^3.3.1",
    "mocha": "^2.3.0"
  }
...

.eslintrc (I get the same result with or without the // ... comment)

// See https://github.com/1hella/eslint-config-airbnb-es5
{
  "extends": "eslint-config-airbnb-es5"
}

On eslint <directory> I get an error:

Users/honzajavorek/Workspace/metamorphoses/node_modules/eslint/lib/config.js:171
                    throw e;
                          ^
SyntaxError: Unexpected token '
Referenced from: /Users/honzajavorek/Workspace/metamorphoses/.eslintrc
    at Object.parse (native)
    at Object.<anonymous> (/Users/honzajavorek/Workspace/metamorphoses/node_modules/eslint-config-airbnb-es5/index.js:8:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at readConfigFromFile (/Users/honzajavorek/Workspace/metamorphoses/node_modules/eslint/lib/config.js:113:44)
    at loadConfig (/Users/honzajavorek/Workspace/metamorphoses/node_modules/eslint/lib/config.js:134:22)
honzajavorek commented 9 years ago

After some investigation I found out the .eslintrc file included in this repository is not a valid JSON file. Even after removing comments, the rules at the bottom (mostly those prefixed react/...) are with single quotes ' instead of double quotes ", which causes the parser to throw a syntax error.

I'm willing to work on a fix and send a PR, but I noticed https://github.com/1hella/eslint-config-airbnb-es5/pull/1 is pending and such change would solve the problem, too.

1hella commented 9 years ago

@honzajavorek Sorry about that. It should be working in version 1.0.8 now. The comments are removed in the index.js file, but the single quotes and something in one of the react rules were causing errors.

honzajavorek commented 9 years ago

Thanks! I cannot verify as I realized most of the code I was about to lint was CoffeeScript anyway and I was forced to use coffeelint instead. However, in case I'm going to use ES5 anywhere in the future, I'll surely go with this package.

I believe it's fixed now, so I'm closing the issue.