File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ let cwd: string | null = null;
5656export let setupContextForFile : ( context : Context , ruleIndex : number , filePath : string ) => void ;
5757
5858// Settings for current file. Set before linting a file by `setSettingsForFile`.
59- let settings : Record < string , unknown > = { } ;
59+ let settings : Record < string , unknown > = null ;
6060
6161/**
6262 * Updates the settings record for the file.
@@ -164,6 +164,7 @@ export class Context {
164164 }
165165
166166 get settings ( ) {
167+ getInternal ( this , 'access `context.settings`' ) ;
167168 return settings ;
168169 }
169170
Original file line number Diff line number Diff line change 7575 : ^
7676 `----
7777
78+ x create-once-plugin(always-run): createOnce: settings: Cannot access `context.settings` in `createOnce`
79+ ,-[files/1.js:1:1]
80+ 1 | let x;
81+ : ^
82+ `----
83+
7884 x create-once-plugin(always-run): createOnce: sourceCode: Cannot access `context.sourceCode` in `createOnce`
7985 ,-[files/1.js:1:1]
8086 1 | let x;
207213 : ^
208214 `----
209215
216+ x create-once-plugin(always-run): createOnce: settings: Cannot access `context.settings` in `createOnce`
217+ ,-[files/2.js:1:1]
218+ 1 | let y;
219+ : ^
220+ `----
221+
210222 x create-once-plugin(always-run): createOnce: sourceCode: Cannot access `context.sourceCode` in `createOnce`
211223 ,-[files/2.js:1:1]
212224 1 | let y;
267279 : ^
268280 `----
269281
270- Found 0 warnings and 44 errors.
282+ Found 0 warnings and 46 errors.
271283Finished in Xms on 2 files using X threads.
272284```
273285
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ const alwaysRunRule: Rule = {
3434 const physicalFilenameError = tryCatch ( ( ) => context . physicalFilename ) ;
3535 const optionsError = tryCatch ( ( ) => context . options ) ;
3636 const sourceCodeError = tryCatch ( ( ) => context . sourceCode ) ;
37+ const settingsError = tryCatch ( ( ) => context . settings ) ;
3738 const reportError = tryCatch ( ( ) => context . report ( { message : 'oh no' , node : SPAN } ) ) ;
3839
3940 return {
@@ -45,6 +46,7 @@ const alwaysRunRule: Rule = {
4546 context . report ( { message : `createOnce: physicalFilename: ${ physicalFilenameError ?. message } ` , node : SPAN } ) ;
4647 context . report ( { message : `createOnce: options: ${ optionsError ?. message } ` , node : SPAN } ) ;
4748 context . report ( { message : `createOnce: sourceCode: ${ sourceCodeError ?. message } ` , node : SPAN } ) ;
49+ context . report ( { message : `createOnce: settings: ${ settingsError ?. message } ` , node : SPAN } ) ;
4850 context . report ( { message : `createOnce: report: ${ reportError ?. message } ` , node : SPAN } ) ;
4951
5052 context . report ( { message : `before hook: id: ${ context . id } ` , node : SPAN } ) ;
You can’t perform that action at this time.
0 commit comments