/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;


// VARIABLES //

var rule;


// FUNCTIONS //

/**
* Rule for validating that modules do not require themselves.
*
* @param {Object} context - ESLint context
* @returns {Object} validators
*/
function main( context ) {
	/**
	* Reports the error message.
	*
	* @private
	* @param {ASTNode} node - node to report
	*/
	function report( node ) {
		context.report({
			'node': node,
			'message': 'module requires itself'
		});
	}

	/**
	* Tests whether a node requires the current file.
	*
	* @private
	* @param {Object} context - ESLint context
	* @param {ASTNode} node - node to examine
	* @param {string} id - module identifiers
	*/
	function isSelfRequire( context, node, id ) {
		var filePath = context.getFilename();
		if (
			filePath &&
			id &&
			filePath === resolve( id )
		) {
			report( node );
		}
	}

	/**
	* Tests whether an import statement attempts to import the current file.
	*
	* @private
	* @param {ASTNode} node - node to examine
	*/
	function validateImport( node ) {
		isSelfRequire( context, node, node.source.value );
	}

	/**
	* Checks whether a require expression attempts to load the current file.
	*
	* @private
	* @param {ASTNode} node - node to examine
	*/
	function validateRequire( node ) {
		var requirePath;
		if ( node.callee.name === 'require' ) {
			requirePath = node.arguments[ 0 ].value;
			isSelfRequire( context, node, requirePath );
		}
	}

	return {
		'ImportDeclaration': validateImport,
		'CallExpression': validateRequire
	};
}


// MAIN //

rule = {
	'meta': {
		'docs': {
			'description': 'enforce that modules do not requires themselves'
		},
		'schema': []
	},
	'create': main
};


// EXPORTS //

module.exports = rule;

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;


// VARIABLES //

var rule;


// FUNCTIONS //

/**
* Rule for validating that modules do not require themselves.
*
* @param {Object} context - ESLint context
* @returns {Object} validators
*/
function main( context ) {
	/**
	* Reports the error message.
	*
	* @private
	* @param {ASTNode} node - node to report
	*/
	function report( node ) {
		context.report({
			'node': node,
			'message': 'module requires itself'
		});
	}

	/**
	* Tests whether a node requires the current file.
	*
	* @private
	* @param {Object} context - ESLint context
	* @param {ASTNode} node - node to examine
	* @param {string} id - module identifier
	*/
	function isSelfRequire( context, node, id ) {
		var filePath = context.getFilename();
		if (
			filePath &&
			id &&
			filePath === resolve( id )
		) {
			report( node );
		}
	}

	/**
	* Tests whether an import statement attempts to import the current file.
	*
	* @private
	* @param {ASTNode} node - node to examine
	*/
	function validateImport( node ) {
		isSelfRequire( context, node, node.source.value );
	}

	/**
	* Checks whether a require expression attempts to load the current file.
	*
	* @private
	* @param {ASTNode} node - node to examine
	*/
	function validateRequire( node ) {
		var requirePath;
		if ( node.callee.name === 'require' ) {
			requirePath = node.arguments[ 0 ].value;
			isSelfRequire( context, node, requirePath );
		}
	}

	return {
		'ImportDeclaration': validateImport,
		'CallExpression': validateRequire
	};
}


// MAIN //

rule = {
	'meta': {
		'docs': {
			'description': 'enforce that modules do not requires themselves'
		},
		'schema': []
	},
	'create': main
};


// EXPORTS //

module.exports = rule;

Change to singular