@@ -6,8 +6,6 @@ import rule from "./no-config-imports.js";
66
77const ROOT = process . cwd ( ) ;
88const resolve = ( p ) => path . resolve ( ROOT , p ) ;
9- const CONFIG_FILE_PATH = resolve ( "src/common/config.js" ) ;
10- const ALLOWED_CONFIG_VALUE_IMPORT_FILES = [ resolve ( "src/index.ts" ) , resolve ( "src/resources/common/config.ts" ) ] ;
119
1210const ruleTester = new RuleTester ( {
1311 languageOptions : {
@@ -23,22 +21,18 @@ describe("no-config-imports", () => {
2321 {
2422 filename : resolve ( "src/some/module.ts" ) ,
2523 code : 'import type { UserConfig } from "../common/config.js";\n' ,
26- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
2724 } ,
2825 {
2926 filename : resolve ( "src/some/module.ts" ) ,
3027 code : 'import { something } from "../common/logger.js";\n' ,
31- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
3228 } ,
3329 {
3430 filename : resolve ( "src/some/module.ts" ) ,
3531 code : 'import type * as Cfg from "../common/config.js";\n' ,
36- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
3732 } ,
3833 {
39- filename : ALLOWED_CONFIG_VALUE_IMPORT_FILES [ 1 ] ,
34+ filename : resolve ( "src/index.ts" ) ,
4035 code : 'import { driverOptions } from "../common/config.js";\n' ,
41- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
4236 } ,
4337 ] ,
4438 invalid : [ ] ,
@@ -52,25 +46,21 @@ describe("no-config-imports", () => {
5246 {
5347 filename : resolve ( "src/another/module.ts" ) ,
5448 code : 'import { driverOptions } from "../common/config.js";\n' ,
55- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
5649 errors : [ { messageId : "noConfigImports" } ] ,
5750 } ,
5851 {
5952 filename : resolve ( "src/another/module.ts" ) ,
6053 code : 'import configDefault from "../common/config.js";\n' ,
61- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
6254 errors : [ { messageId : "noConfigImports" } ] ,
6355 } ,
6456 {
6557 filename : resolve ( "src/another/module.ts" ) ,
6658 code : 'import * as cfg from "../common/config.js";\n' ,
67- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
6859 errors : [ { messageId : "noConfigImports" } ] ,
6960 } ,
7061 {
7162 filename : resolve ( "src/another/module.ts" ) ,
7263 code : 'import { type UserConfig, driverOptions } from "../common/config.js";\n' ,
73- options : [ { configFilePath : CONFIG_FILE_PATH , allowedFiles : ALLOWED_CONFIG_VALUE_IMPORT_FILES } ] ,
7464 errors : [ { messageId : "noConfigImports" } ] ,
7565 } ,
7666 ] ,
0 commit comments