@@ -109,23 +109,29 @@ impl ConfigStoreBuilder {
109109 }
110110
111111 {
112- let all_rules = builder. cache . borrow ( ) ;
113-
114112 if !extends. is_empty ( ) {
115- let config_file_path = builder. config . path . as_ref ( ) . and_then ( |p| p. parent ( ) ) ;
113+ let config_path = builder. config . path . clone ( ) ;
114+ let config_path_parent = config_path. as_ref ( ) . and_then ( |p| p. parent ( ) ) ;
116115 for path in & extends {
117116 // resolve path relative to config path
118- let path = match config_file_path {
117+ let path = match config_path_parent {
119118 Some ( config_file_path) => & config_file_path. join ( path) ,
120119 None => path,
121120 } ;
122121 // TODO: throw an error if this is a self-referential extend
123122 // TODO(perf): use a global config cache to avoid re-parsing the same file multiple times
124123 match Oxlintrc :: from_file ( path) {
125124 Ok ( extended_config) => {
126- extended_config
127- . rules
128- . override_rules ( & mut builder. rules , all_rules. as_slice ( ) ) ;
125+ // TODO(refactor): can we merge this together? seems redundant to use `override_rules` and then
126+ // use `ConfigStoreBuilder`, but we don't have a better way of loading rules from config files other than that.
127+ // Use `override_rules` to apply rule configurations and add/remove rules as needed
128+ extended_config. rules . override_rules ( & mut builder. rules , & RULES ) ;
129+ // Use `ConfigStoreBuilder` to load extended config files and then apply rules from those
130+ let extended_config_store =
131+ ConfigStoreBuilder :: from_oxlintrc ( true , extended_config) ?;
132+ for rule in extended_config_store. rules {
133+ builder = builder. with_rule ( rule) ;
134+ }
129135 }
130136 Err ( err) => {
131137 return Err ( ConfigBuilderError :: InvalidConfigFile {
@@ -137,6 +143,8 @@ impl ConfigStoreBuilder {
137143 }
138144 }
139145
146+ let all_rules = builder. cache . borrow ( ) ;
147+
140148 oxlintrc_rules. override_rules ( & mut builder. rules , all_rules. as_slice ( ) ) ;
141149 }
142150
@@ -179,7 +187,6 @@ impl ConfigStoreBuilder {
179187 self . config . plugins
180188 }
181189
182- #[ cfg( test) ]
183190 pub ( crate ) fn with_rule ( mut self , rule : RuleWithSeverity ) -> Self {
184191 self . rules . insert ( rule) ;
185192 self
0 commit comments