html-validate 6.1.4 → 6.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # html-validate changelog
2
2
 
3
+ ### [6.1.5](https://gitlab.com/html-validate/html-validate/compare/v6.1.4...v6.1.5) (2021-12-28)
4
+
5
+ ### Bug Fixes
6
+
7
+ - **config:** dont process extends multiple times ([f014311](https://gitlab.com/html-validate/html-validate/commit/f01431147a74272142dd6ddcfe5d53bf68c80aa9))
8
+ - **config:** elements from extended configs should be loaded first not last ([d19519e](https://gitlab.com/html-validate/html-validate/commit/d19519e5ee97e7b5c375bca80f01dcbaa5eb0373))
9
+
3
10
  ### [6.1.4](https://gitlab.com/html-validate/html-validate/compare/v6.1.3...v6.1.4) (2021-12-04)
4
11
 
5
12
  ### Bug Fixes
package/dist/cjs/core.js CHANGED
@@ -2929,7 +2929,7 @@ var TRANSFORMER_API;
2929
2929
  /** @public */
2930
2930
  const name = "html-validate";
2931
2931
  /** @public */
2932
- const version = "6.1.4";
2932
+ const version = "6.1.5";
2933
2933
  /** @public */
2934
2934
  const homepage = "https://html-validate.org";
2935
2935
  /** @public */
@@ -9790,9 +9790,11 @@ class Config {
9790
9790
  this.configurations = this.loadConfigurations(this.plugins);
9791
9791
  this.extendMeta(this.plugins);
9792
9792
  /* process extended configs */
9793
- for (const extend of (_a = this.config.extends) !== null && _a !== void 0 ? _a : []) {
9794
- this.config = this.extendConfig(extend);
9795
- }
9793
+ this.config = this.extendConfig((_a = this.config.extends) !== null && _a !== void 0 ? _a : []);
9794
+ /* reset extends as we already processed them, this prevents the next config
9795
+ * from reapplying config from extended config as well as duplicate entries
9796
+ * when merging arrays */
9797
+ this.config.extends = [];
9796
9798
  /* rules explicitly set by passed options should have precedence over any
9797
9799
  * extended rules, not the other way around. */
9798
9800
  if (options && options.rules) {
@@ -9890,15 +9892,23 @@ class Config {
9890
9892
  merge(rhs) {
9891
9893
  return new Config(mergeInternal(this.config, rhs.config));
9892
9894
  }
9893
- extendConfig(entry) {
9894
- let base;
9895
- if (this.configurations.has(entry)) {
9896
- base = this.configurations.get(entry);
9895
+ extendConfig(entries) {
9896
+ if (entries.length === 0) {
9897
+ return this.config;
9897
9898
  }
9898
- else {
9899
- base = Config.fromFile(entry).config;
9899
+ let base = {};
9900
+ for (let i = 0; i < entries.length; i++) {
9901
+ const entry = entries[i];
9902
+ let extended;
9903
+ if (this.configurations.has(entry)) {
9904
+ extended = this.configurations.get(entry);
9905
+ }
9906
+ else {
9907
+ extended = Config.fromFile(entry).config;
9908
+ }
9909
+ base = mergeInternal(base, extended);
9900
9910
  }
9901
- return mergeInternal(this.config, base);
9911
+ return mergeInternal(base, this.config);
9902
9912
  }
9903
9913
  /**
9904
9914
  * Get element metadata.
@@ -9973,6 +9983,7 @@ class Config {
9973
9983
  }
9974
9984
  });
9975
9985
  }
9986
+ delete config.extends;
9976
9987
  return config;
9977
9988
  }
9978
9989
  /**