function main( context ) {
	var source = context.getSourceCode();

	/**
	* Reports the error message.
	*
	* @private
	* @param {Object} loc - lines of code (object with `start` and `end` properties)
	*/
	function report( loc ) {
		context.report({
			'node': null,
			'message': 'Missing empty line before comment',
			'loc': loc,
			'fix': fix
		});

		/**
		* Fixes the lint error by inserting an empty line before the comment.
		*
		* @private
		* @param {Object} fixer - ESLint fixer
		* @returns {Object} fix
		*/
		function fix( fixer ) {
			var range = [
				source.getIndexFromLoc({
					'line': loc.start.line,
					'column': 0
				}),
				source.getIndexFromLoc( loc.end )
			];
			return fixer.insertTextBeforeRange( range, '\n' );
		}
	}

	/**
	* Checks whether comments are preceded by empty lines.
	*
	* @private
	* @param {ASTNode} node - node to examine
	*/
	function validate( node ) {
		var startsLine;
		var prevLine;
		var comments;
		var current;
		var token;
		var line;
		var i;

		comments = source.getCommentsInside( node );
		if ( isArray( comments ) && comments.length > 0 ) {
			for ( i = 0; i < comments.length; i++ ) {
				current = comments[ i ];
				line = current.loc.start.line;
				prevLine = source.lines[ line-2 ] || '';
				token = source.getTokenBefore( current );

				if ( isObject( token ) ) {
					if ( token.loc.start.line === line ) {
						startsLine = false;
					} else {
						startsLine = true;
					}
					if (
						// Flag single-line comments which are not preceded by an empty line:
						prevLine !== '' &&

						// Only flag comments that start a line:
						startsLine &&

						// Don't raise an error when the comment is preceded by the opening curly brace of e.g. an object literal or if-clause:
						token.value !== '{' &&

						// Don't raise an error when the comment is preceded by the opening square bracket of an array literal:
						token.value !== '[' &&

						// Don't raise an error when the comment is after the end of a preceding code block:
						token.value !== '}' &&

						// Don't raise an error when the comment is at the start of the condition of an if-clause:
						token.value !== '(' &&

						// Don't raise an error when the comment is after a case statement:
						!CASE_STATEMENT.test( prevLine ) &&

						// Don't raise an error for return annotations in example code:
						!RETURN_ANNOTATION_REGEXP.test( current.value )
					) {
						report( current.loc );
					}
				}
			}
		}
	}

	return {
		'Program': validate
	};
}
Rule for validating that comments are preceded by empty lines.

@param {Object} context - ESLint context
@returns {Object} validators