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

Commit

Permalink
Merge pull request #52 from nhsuk/feature/prefer-destructuring
Browse files Browse the repository at this point in the history
✨ Turn on prefer-destructuring option
  • Loading branch information
neilbmclaughlin authored Oct 8, 2019
2 parents 33890a0 + 311cb79 commit 7803507
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 251 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ module.exports = {
allowForLoopAfterthoughts: true,
},
],
'prefer-destructuring': 'off',
'prefer-destructuring': [
'error',
{
array: true,
object: true,
},
{
enforceForRenamedProperties: true,
},
],
'sort-keys': [
'error',
'asc',
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
0.22.0 / TBC
0.22.0 / 2019-10-08
===================
- Disallow empty lines at BOF and EOF
- Turn `prefer-destructuring` on for both `object` and `array`
- Update npm dependencies

0.21.2 / 2019-09-25
===================
Expand Down
13 changes: 6 additions & 7 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const CLIEngine = require('eslint').CLIEngine;
const { CLIEngine } = require('eslint');
const chai = require('chai');
const rules = require('../.eslintrc');

const expect = chai.expect;
const { expect } = chai;

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

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

const errors = report.errorCount;
const warnings = report.warningCount;
const { errorCount, warningCount } = report;

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

expect(errors).to.be.equal(0);
expect(warnings).to.be.equal(0);
expect(errorCount).to.be.equal(0);
expect(warningCount).to.be.equal(0);
});
});
Loading

0 comments on commit 7803507

Please sign in to comment.