diff --git a/lib/rules/sort-collections.js b/lib/rules/sort-collections.js index cea67e32..875fe059 100644 --- a/lib/rules/sort-collections.js +++ b/lib/rules/sort-collections.js @@ -30,10 +30,10 @@ module.exports = { ] }, - create: function (context) { + create: function(context) { const toSort = context.options[0] || defaultCollections; return { - 'Property:exit': (node) => { + 'Property:exit': node => { if (!isPackageJson(context.getFilename())) { return; } @@ -63,12 +63,13 @@ module.exports = { collection, JSON.stringify( desiredOrder.reduce((out, property) => { - out[property.key.value] = - JSON.parse( - context - .getSourceCode() - .getText(property.value) - ); + out[ + property.key.value + ] = JSON.parse( + context + .getSourceCode() + .getText(property.value) + ); return out; }, {}), null, diff --git a/lib/rules/valid-package-def.js b/lib/rules/valid-package-def.js index f6ae5312..25c6ad84 100644 --- a/lib/rules/valid-package-def.js +++ b/lib/rules/valid-package-def.js @@ -18,8 +18,8 @@ const unusedErrorPatterns = [ /^author field should have name/i ]; -const isUsableError = (errorText) => - unusedErrorPatterns.every((pattern) => !pattern.test(errorText)); +const isUsableError = errorText => + unusedErrorPatterns.every(pattern => !pattern.test(errorText)); module.exports = { meta: { @@ -32,9 +32,9 @@ module.exports = { fixable: null // or "code" or "whitespace" }, - create: function (context) { + create: function(context) { return { - 'Program:exit': (node) => { + 'Program:exit': node => { if (!isPackageJson(context.getFilename())) { return; } @@ -47,7 +47,7 @@ module.exports = { if (critical || errors) { const allErrors = [...(critical || []), ...errors]; allErrors.filter(isUsableError).forEach( - (message) => + message => message && context.report({ node: packageRoot,