Repository: tclindner/npm-package-json-lint (ts)

Issue:
Support for "require-module"?
The [`module` property](https://github.com/dherman/defense-of-dot-js/blob/master/proposal.md)  is like the `main` property but for ES6 Import-Export modules.

Pull request:
Closes #52 - add new require-module rule

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ffcfc7..0e153c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 ### Removed
 
 
+## [2.11.0] - 2017-09-02
+### Added
+- New rule: [require-module](https://github.com/tclindner/npm-package-json-lint/wiki/require-module)
+
 ## [2.10.0] - 2017-09-02
 ### Changed
 - Addressed issues, from @moshest, [#57](https://github.com/tclindner/npm-package-json-lint/issues/57) and [#58](https://github.com/tclindner/npm-package-json-lint/issues/58). This change gives better recommendations for what change is required by the user to resolve the lint issue. It also no longer throws an error when a property exists in the package.json file that doesn't exist in the preferred property order array. Thanks @moshest.
diff --git a/package.json b/package.json
index 03eb9f7..1c0e1c9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "npm-package-json-lint",
-  "version": "2.10.0",
+  "version": "2.11.0",
   "description": "CLI app for linting package.json files.",
   "keywords": [
     "lint",
diff --git a/src/rules/require-module.js b/src/rules/require-module.js
new file mode 100644
index 0000000..8e01f1c
--- /dev/null
+++ b/src/rules/require-module.js
@@ -0,0 +1,18 @@
+'use strict';
+
+const LintIssue = require('./../LintIssue');
+const lintId = 'require-module';
+const nodeName = 'module';
+const message = 'module is required';
+const ruleType = 'standard';
+
+const lint = function(packageJsonData, lintType) {
+  if (!packageJsonData.hasOwnProperty(nodeName)) {
+    return new LintIssue(lintId, lintType, nodeName, message);
+  }
+
+  return true;
+};
+
+module.exports.lint = lint;
+module.exports.ruleType = ruleType;


Test patch:
diff --git a/tests/unit/rules/require-module.test.js b/tests/unit/rules/require-module.test.js
new file mode 100644
index 0000000..72ac626
--- /dev/null
+++ b/tests/unit/rules/require-module.test.js
@@ -0,0 +1,39 @@
+'use strict';
+
+const chai = require('chai');
+const ruleModule = require('./../../../src/rules/require-module');
+const lint = ruleModule.lint;
+const ruleType = ruleModule.ruleType;
+
+const should = chai.should();
+
+describe('require-module Unit Tests', function() {
+  context('a rule type value should be exported', function() {
+    it('it should equal "standard"', function() {
+      ruleType.should.equal('standard');
+    });
+  });
+
+  context('when package.json has node', function() {
+    it('true should be returned', function() {
+      const packageJsonData = {
+        module: 'module'
+      };
+      const response = lint(packageJsonData, 'error');
+
+      response.should.be.true;
+    });
+  });
+
+  context('when package.json does not have node', function() {
+    it('LintIssue object should be returned', function() {
+      const packageJsonData = {};
+      const response = lint(packageJsonData, 'error');
+
+      response.lintId.should.equal('require-module');
+      response.lintType.should.equal('error');
+      response.node.should.equal('module');
+      response.lintMessage.should.equal('module is required');
+    });
+  });
+});