@@ -32,7 +32,7 @@ import { SOURCE_CODE } from './source_code.js';
3232import { settings , initSettings } from './settings.js' ;
3333
3434import type { Fix , FixFn } from './fix.ts' ;
35- import type { RuleAndContext } from './load.ts' ;
35+ import type { RuleDetails } from './load.ts' ;
3636import type { SourceCode } from './source_code.ts' ;
3737import type { Location , Ranged } from './types.ts' ;
3838
@@ -256,10 +256,10 @@ export interface Context extends FileContext {
256256/**
257257 * Create `Context` object for a rule.
258258 * @param fullRuleName - Full rule name, including plugin name e.g. `my-plugin/my-rule`
259- * @param ruleAndContext - `RuleAndContext ` object
259+ * @param ruleDetails - `RuleDetails ` object
260260 * @returns `Context` object
261261 */
262- export function createContext ( fullRuleName : string , ruleAndContext : RuleAndContext ) : Readonly < Context > {
262+ export function createContext ( fullRuleName : string , ruleDetails : RuleDetails ) : Readonly < Context > {
263263 // Create `Context` object for rule.
264264 //
265265 // All properties are enumerable, to support a pattern which some ESLint plugins use:
@@ -290,31 +290,31 @@ export function createContext(fullRuleName: string, ruleAndContext: RuleAndConte
290290 // Getter for rule options for this rule on this file
291291 get options ( ) : Readonly < unknown [ ] > {
292292 if ( filePath === null ) throw new Error ( 'Cannot access `context.options` in `createOnce`' ) ;
293- return ruleAndContext . options ;
293+ return ruleDetails . options ;
294294 } ,
295295 /**
296296 * Report error.
297297 * @param diagnostic - Diagnostic object
298298 * @throws {TypeError } If `diagnostic` is invalid
299299 */
300300 report ( diagnostic : Diagnostic ) : void {
301- // Delegate to `reportImpl`, passing rule-specific details (`RuleAndContext `)
302- reportImpl ( diagnostic , ruleAndContext ) ;
301+ // Delegate to `reportImpl`, passing rule-specific details (`RuleDetails `)
302+ reportImpl ( diagnostic , ruleDetails ) ;
303303 } ,
304304 } as unknown as Context ) ; // It seems TS can't understand `__proto__: FILE_CONTEXT`
305305}
306306
307307/**
308308 * Report error.
309309 * @param diagnostic - Diagnostic object
310- * @param ruleAndContext - `RuleAndContext ` object, containing rule-specific details e.g. `isFixable`
310+ * @param ruleDetails - `RuleDetails ` object, containing rule-specific details e.g. `isFixable`
311311 * @throws {TypeError } If `diagnostic` is invalid
312312 */
313- function reportImpl ( diagnostic : Diagnostic , ruleAndContext : RuleAndContext ) : void {
313+ function reportImpl ( diagnostic : Diagnostic , ruleDetails : RuleDetails ) : void {
314314 if ( filePath === null ) throw new Error ( 'Cannot report errors in `createOnce`' ) ;
315315
316316 // Get message, resolving message from `messageId` if present
317- let message = getMessage ( diagnostic , ruleAndContext ) ;
317+ let message = getMessage ( diagnostic , ruleDetails ) ;
318318
319319 // Interpolate placeholders {{key}} with data values
320320 if ( hasOwn ( diagnostic , 'data' ) ) {
@@ -369,22 +369,22 @@ function reportImpl(diagnostic: Diagnostic, ruleAndContext: RuleAndContext): voi
369369 message,
370370 start,
371371 end,
372- ruleIndex : ruleAndContext . ruleIndex ,
373- fixes : getFixes ( diagnostic , ruleAndContext ) ,
372+ ruleIndex : ruleDetails . ruleIndex ,
373+ fixes : getFixes ( diagnostic , ruleDetails ) ,
374374 } ) ;
375375}
376376
377377/**
378378 * Get message from diagnostic.
379379 * @param diagnostic - Diagnostic object
380- * @param ruleAndContext - `RuleAndContext ` object, containing rule-specific `messages`
380+ * @param ruleDetails - `RuleDetails ` object, containing rule-specific `messages`
381381 * @returns Message string
382382 * @throws {Error|TypeError } If neither `message` nor `messageId` provided, or of wrong type
383383 */
384- function getMessage ( diagnostic : Diagnostic , ruleAndContext : RuleAndContext ) : string {
384+ function getMessage ( diagnostic : Diagnostic , ruleDetails : RuleDetails ) : string {
385385 if ( hasOwn ( diagnostic , 'messageId' ) ) {
386386 const { messageId } = diagnostic as { messageId : string | null | undefined } ;
387- if ( messageId != null ) return resolveMessageFromMessageId ( messageId , ruleAndContext ) ;
387+ if ( messageId != null ) return resolveMessageFromMessageId ( messageId , ruleDetails ) ;
388388 }
389389
390390 if ( hasOwn ( diagnostic , 'message' ) ) {
@@ -399,12 +399,12 @@ function getMessage(diagnostic: Diagnostic, ruleAndContext: RuleAndContext): str
399399/**
400400 * Resolve a message ID to its message string, with optional data interpolation.
401401 * @param messageId - The message ID to resolve
402- * @param ruleAndContext - `RuleAndContext ` object, containing rule-specific `messages`
402+ * @param ruleDetails - `RuleDetails ` object, containing rule-specific `messages`
403403 * @returns Resolved message string
404404 * @throws {Error } If `messageId` is not found in `messages`
405405 */
406- function resolveMessageFromMessageId ( messageId : string , ruleAndContext : RuleAndContext ) : string {
407- const { messages } = ruleAndContext ;
406+ function resolveMessageFromMessageId ( messageId : string , ruleDetails : RuleDetails ) : string {
407+ const { messages } = ruleDetails ;
408408 if ( messages === null ) {
409409 throw new Error ( `Cannot use messageId '${ messageId } ' - rule does not define any messages in \`meta.messages\`` ) ;
410410 }
0 commit comments