brenolf / polyjuice

A utility to convert JSHint and JSCS files into ESLint files and vice-versa
MIT License
275 stars 15 forks source link

Configuration for rule "max-depth" is invalid #2

Closed pdehaan closed 9 years ago

pdehaan commented 9 years ago

I'm running polyjuice globally from the CLI on this repo's .jshintrc file and am getting an error when I try and run ESLint:

➜  polyjuice git:(master) ✗ polyjuice .jshintrc > .eslintrc
➜  polyjuice git:(master) ✗ eslint .

/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/config-validator.js:88
        throw new Error(message.join(""));
              ^
Error: /Users/pdehaan/dev/github/polyjuice/.eslintrc:
    Configuration for rule "max-depth" is invalid:
    Value "3" must be an enum value.

    at validateRuleOptions (/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/config-validator.js:88:15)
    at /Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/config-validator.js:101:13
    at Array.forEach (native)
    at Object.validate (/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/config-validator.js:100:35)
    at loadConfig (/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/config.js:107:19)
    at getLocalConfig (/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/config.js:243:23)
    at Config.getConfig (/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/config.js:371:22)
    at processText (/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/cli-engine.js:181:27)
    at processFile (/Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/cli-engine.js:224:12)
    at /Users/pdehaan/.npm-packages/lib/node_modules/eslint/lib/cli-engine.js:320:26

And the generated .eslintrc file is:

{
  "env": {
    "browser": true,
    "browserify": true,
    "couch": false,
    "devel": true,
    "dojo": false,
    "jquery": false,
    "mootools": false,
    "node": false,
    "prototypejs": false,
    "rhino": false,
    "wsh": true
  },
  "rules": {
    "linebreak-style": 2,
    "comma-style": [
      2,
      "last"
    ],
    "no-debuger": 2,
    "strict": 0,
    "semi": 0,
    "eqeqeq": 2,
    "no-eval": 0,
    "no-unused-expressions": 0,
    "guard-for-in": 0,
    "no-use-before-define": 2,
    "no-loop-func": 0,
    "no-caller": 2,
    "no-script-url": 0,
    "no-shadow": 2,
    "no-new-func": 2,
    "no-new-wrappers": 2,
    "no-unused-vars": 2,
    "no-undef": 2,
    "max-depth": 3,
    "max-params": 4
  }
}

So the max-depth and max-params values aren't getting set correctly (should probably be "max-depth: [2, 3] and max-params: [2, 4] respectively.