Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 7803507

Browse files
Merge pull request #52 from nhsuk/feature/prefer-destructuring
✨ Turn on prefer-destructuring option
2 parents 33890a0 + 311cb79 commit 7803507

File tree

4 files changed

+87
-251
lines changed

4 files changed

+87
-251
lines changed

.eslintrc.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ module.exports = {
4444
allowForLoopAfterthoughts: true,
4545
},
4646
],
47-
'prefer-destructuring': 'off',
47+
'prefer-destructuring': [
48+
'error',
49+
{
50+
array: true,
51+
object: true,
52+
},
53+
{
54+
enforceForRenamedProperties: true,
55+
},
56+
],
4857
'sort-keys': [
4958
'error',
5059
'asc',

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
0.22.0 / TBC
1+
0.22.0 / 2019-10-08
22
===================
33
- Disallow empty lines at BOF and EOF
4+
- Turn `prefer-destructuring` on for both `object` and `array`
5+
- Update npm dependencies
46

57
0.21.2 / 2019-09-25
68
===================

test/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const CLIEngine = require('eslint').CLIEngine;
1+
const { CLIEngine } = require('eslint');
22
const chai = require('chai');
33
const rules = require('../.eslintrc');
44

5-
const expect = chai.expect;
5+
const { expect } = chai;
66

77
describe('the ruleset exported from index.js', () => {
88
it('should not flag any errors or warnings when linting the code base', () => {
@@ -11,16 +11,15 @@ describe('the ruleset exported from index.js', () => {
1111

1212
const report = cli.executeOnFiles(['.']);
1313

14-
const errors = report.errorCount;
15-
const warnings = report.warningCount;
14+
const { errorCount, warningCount } = report;
1615

17-
if (errors + warnings > 0) {
16+
if (errorCount + warningCount > 0) {
1817
const formatter = cli.getFormatter();
1918
// eslint-disable-next-line no-console
2019
console.error(formatter(report.results));
2120
}
2221

23-
expect(errors).to.be.equal(0);
24-
expect(warnings).to.be.equal(0);
22+
expect(errorCount).to.be.equal(0);
23+
expect(warningCount).to.be.equal(0);
2524
});
2625
});

0 commit comments

Comments
 (0)