File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,21 @@ function installPlugin(plugin) {
276
276
if ( typeof plugin . name !== "string" ) {
277
277
throw new Error ( "Linter plugin name must be a string" ) ;
278
278
}
279
- // TODO(bartlomieju): lowercase and dashes for plugin.name
279
+ if ( ! / ^ [ a - z - ] + $ / . test ( plugin . name ) ) {
280
+ throw new Error (
281
+ "Linter plugin name must only contain lowercase letters (a-z) or hyphens (-)." ,
282
+ ) ;
283
+ }
284
+ if ( plugin . name . startsWith ( "-" ) || plugin . name . endsWith ( "-" ) ) {
285
+ throw new Error (
286
+ "Linter plugin name must start and end with a lowercase letter." ,
287
+ ) ;
288
+ }
289
+ if ( plugin . name . includes ( "--" ) ) {
290
+ throw new Error (
291
+ "Linter plugin name must not have consequtive hyphens." ,
292
+ ) ;
293
+ }
280
294
if ( typeof plugin . rules !== "object" ) {
281
295
throw new Error ( "Linter plugin rules must be an object" ) ;
282
296
}
You can’t perform that action at this time.
0 commit comments