Repository: eslint/eslint
File: lib/rules/no-trailing-spaces.js (JavaScript)

Code before:
				},
				additionalProperties: false,
			},
		],

		messages: {
			trailingSpace: "Trailing spaces not allowed.",
		},
	},

	create(context) {
		const sourceCode = context.sourceCode;

		const BLANK_CLASS = "[ \t\u00a0\u2000-\u200b\u3000]",
			SKIP_BLANK = `^${BLANK_CLASS}*$`,
			NONBLANK = `${BLANK_CLASS}+$`;

		const options = context.options[0] || {},
			skipBlankLines = options.skipBlankLines || false,
			ignoreComments = options.ignoreComments || false;

		/**
		 * Report the error message
		 * @param {ASTNode} node node to report
		 * @param {SourceLocation[]} location range information
		 * @param {SourceRange[]} fixRange Range based on the whole program
		 * @returns {void}
		 */
		function report(node, location, fixRange) {
			/*
			 * Passing node is a bit dirty, because message data will contain big
			 * text in `source`. But... who cares :) ?
			 * One more kludge will not make worse the bloody wizardry of this
			 * plugin.
			 */
			context.report({
				node,
				loc: location,
				messageId: "trailingSpace",
				fix(fixer) {
					return fixer.removeRange(fixRange);
				},
			});
		}

		/**
		 * Given a list of comment nodes, return the line numbers for those comments.
		 * @param {Array} comments An array of comment nodes.
		 * @returns {number[]} An array of line numbers containing comments.
		 */
		function getCommentLineNumbers(comments) {

Review comment (suggestion):
```suggestion
		 * @param {SourceLocation} location range information
		 * @param {SourceRange} fixRange Range based on the whole program
```

`SourceRange` is a tuple of elements with indices 0 and 1. That is probably why it was defined as an array of `int[]`: https://github.com/eslint/rewrite/blob/core-v0.13.0/packages/core/src/types.ts#L71-L74. Same in other files.

The previous line looks like a copy-paste error, but it's clear from the usage that this should be a `SourceLocation` and not an array.

Code after:
				},
				additionalProperties: false,
			},
		],

		messages: {
			trailingSpace: "Trailing spaces not allowed.",
		},
	},

	create(context) {
		const sourceCode = context.sourceCode;

		const BLANK_CLASS = "[ \t\u00a0\u2000-\u200b\u3000]",
			SKIP_BLANK = `^${BLANK_CLASS}*$`,
			NONBLANK = `${BLANK_CLASS}+$`;

		const options = context.options[0] || {},
			skipBlankLines = options.skipBlankLines || false,
			ignoreComments = options.ignoreComments || false;

		/**
		 * Report the error message
		 * @param {ASTNode} node node to report
		 * @param {SourceLocation} location range information
		 * @param {SourceRange} fixRange Range based on the whole program
		 * @returns {void}
		 */
		function report(node, location, fixRange) {
			/*
			 * Passing node is a bit dirty, because message data will contain big
			 * text in `source`. But... who cares :) ?
			 * One more kludge will not make worse the bloody wizardry of this
			 * plugin.
			 */
			context.report({
				node,
				loc: location,
				messageId: "trailingSpace",
				fix(fixer) {
					return fixer.removeRange(fixRange);
				},
			});
		}

		/**
		 * Given a list of comment nodes, return the line numbers for those comments.
		 * @param {Array} comments An array of comment nodes.
		 * @returns {number[]} An array of line numbers containing comments.
		 */
		function getCommentLineNumbers(comments) {