diff --git a/README.md b/README.md index ffbb8a1..3a4879c 100644 --- a/README.md +++ b/README.md @@ -193,5 +193,5 @@ jest-runner-eslint maps a lot of ESLint CLI arguments to config options. For exa |parser|`espree`|`"parser": "flow"` |parserOptions|`{}`|`"parserOptions": { "myOption": true }` |plugin|`[]`|`"plugin": "prettier"` or `"plugin": ["pettier", "other"]` -|rule|`null`|`"rule": "'quotes: [2, double]'"` or `"rule": ["quotes: [2, double]", "no-console: 2"]` +|rules|`null`|`"rules": {"quotes": [2, "double"]}` or `"rules": {"quotes": [2, "double"], "no-console": 2}` |rulesdir|`[]`|`"rulesdir": "/path/to/rules/dir"` or `"env": ["/path/to/rules/dir", "/path/to/other"]` diff --git a/src/utils/__tests__/normalizeConfig.test.js b/src/utils/__tests__/normalizeConfig.test.js index 720720a..9b808e6 100644 --- a/src/utils/__tests__/normalizeConfig.test.js +++ b/src/utils/__tests__/normalizeConfig.test.js @@ -169,17 +169,15 @@ it('normalizes rulesdir', () => { }); }); -it('normalizes rule', () => { +it('normalizes rules', () => { expect(normalizeCLIOptions({})).toMatchObject({ rules: null, }); - expect(normalizeCLIOptions({ rule: ['quotes: [2, double]'] })).toMatchObject({ - rules: ['quotes: [2, double]'], - }); + const ruleOptions = { quotes: [2, 'double'], 'no-console': 2 }; - expect(normalizeCLIOptions({ rule: 'quotes: [2, double]' })).toMatchObject({ - rules: ['quotes: [2, double]'], + expect(normalizeCLIOptions({ rules: ruleOptions })).toMatchObject({ + rules: ruleOptions, }); }); diff --git a/src/utils/normalizeConfig.js b/src/utils/normalizeConfig.js index e2d55d0..46002a5 100644 --- a/src/utils/normalizeConfig.js +++ b/src/utils/normalizeConfig.js @@ -24,7 +24,7 @@ const BASE_CONFIG = { default: false, }, format: { - default: null + default: null, }, global: { name: 'globals', @@ -60,10 +60,8 @@ const BASE_CONFIG = { default: [], transform: asArray, }, - rule: { - name: 'rules', + rules: { default: null, - transform: asArray, }, rulesdir: { name: 'rulePaths',