@@ -56,6 +56,46 @@ export const updateDiagnostics = (
56
56
) ;
57
57
}
58
58
59
+ // check if we have any plugins that contain the name reporter in the plugins node
60
+ const reporterIndex = pluginNodes . findIndex ( ( pluginNode : parse . ObjectNode ) => {
61
+ const pluginNameNode = getASTNode (
62
+ pluginNode . children ,
63
+ 'Identifier' ,
64
+ 'name'
65
+ ) ;
66
+ const pluginName = ( pluginNameNode ?. value as parse . LiteralNode )
67
+ . value as string ;
68
+ return pluginName . toLowerCase ( ) . includes ( 'reporter' ) ;
69
+ } ) ;
70
+
71
+ if ( reporterIndex !== - 1 ) {
72
+ // check if we have any more plugins after the reporter plugin
73
+ const pluginsAfterReporter = pluginNodes . slice ( reporterIndex + 1 ) ;
74
+ // if we do, add a warning to the reporter plugin stating that it should be the last plugin
75
+ if ( pluginsAfterReporter . length > 0 ) {
76
+ // check if there are any plugins after the reporter plugin that are not reporters
77
+ const pluginAfterReporter = pluginsAfterReporter . find ( ( pluginNode : parse . ObjectNode ) => {
78
+ const pluginNameNode = getASTNode (
79
+ pluginNode . children ,
80
+ 'Identifier' ,
81
+ 'name'
82
+ ) ;
83
+ const pluginName = ( pluginNameNode ?. value as parse . LiteralNode )
84
+ . value as string ;
85
+ return ! pluginName . toLowerCase ( ) . includes ( 'reporter' ) ;
86
+ } ) ;
87
+ // if there are, add a warning to the reporter plugin
88
+ if ( pluginAfterReporter ) {
89
+ const diagnostic = new vscode . Diagnostic (
90
+ getRangeFromASTNode ( pluginNodes [ reporterIndex ] ) ,
91
+ 'Reporters should be placed after other plugins.' ,
92
+ vscode . DiagnosticSeverity . Warning
93
+ ) ;
94
+ diagnostics . push ( diagnostic ) ;
95
+ }
96
+ }
97
+ }
98
+
59
99
// does the plugin have a config section?
60
100
pluginNodes . forEach ( ( pluginNode : parse . ObjectNode ) => {
61
101
const pluginNameNode = getASTNode (
0 commit comments