@html-validate/prettier-config 3.1.2 → 3.1.4
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/dist/sort-package-json.mjs +14 -14
- package/package.json +2 -2
|
@@ -1964,6 +1964,9 @@ var import_sort_object_keys = __toESM(require_sort_object_keys(), 1);
|
|
|
1964
1964
|
var INDENT_REGEX = /^(?:( )+|\t+)/;
|
|
1965
1965
|
var INDENT_TYPE_SPACE = "space";
|
|
1966
1966
|
var INDENT_TYPE_TAB = "tab";
|
|
1967
|
+
function shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, value) {
|
|
1968
|
+
return ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && value === 1;
|
|
1969
|
+
}
|
|
1967
1970
|
function makeIndentsMap(string, ignoreSingleSpaces) {
|
|
1968
1971
|
const indents = /* @__PURE__ */ new Map();
|
|
1969
1972
|
let previousSize = 0;
|
|
@@ -1973,39 +1976,36 @@ function makeIndentsMap(string, ignoreSingleSpaces) {
|
|
|
1973
1976
|
if (!line) {
|
|
1974
1977
|
continue;
|
|
1975
1978
|
}
|
|
1976
|
-
let indent;
|
|
1977
|
-
let indentType;
|
|
1978
|
-
let use;
|
|
1979
|
-
let weight;
|
|
1980
|
-
let entry;
|
|
1981
1979
|
const matches = line.match(INDENT_REGEX);
|
|
1982
1980
|
if (matches === null) {
|
|
1983
1981
|
previousSize = 0;
|
|
1984
1982
|
previousIndentType = "";
|
|
1985
1983
|
} else {
|
|
1986
|
-
indent = matches[0].length;
|
|
1987
|
-
indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
1988
|
-
if (ignoreSingleSpaces
|
|
1984
|
+
const indent = matches[0].length;
|
|
1985
|
+
const indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
1986
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) {
|
|
1989
1987
|
continue;
|
|
1990
1988
|
}
|
|
1991
1989
|
if (indentType !== previousIndentType) {
|
|
1992
1990
|
previousSize = 0;
|
|
1993
1991
|
}
|
|
1994
1992
|
previousIndentType = indentType;
|
|
1995
|
-
use = 1;
|
|
1996
|
-
weight = 0;
|
|
1993
|
+
let use = 1;
|
|
1994
|
+
let weight = 0;
|
|
1997
1995
|
const indentDifference = indent - previousSize;
|
|
1998
1996
|
previousSize = indent;
|
|
1999
1997
|
if (indentDifference === 0) {
|
|
2000
1998
|
use = 0;
|
|
2001
1999
|
weight = 1;
|
|
2002
2000
|
} else {
|
|
2003
|
-
const absoluteIndentDifference = indentDifference
|
|
2001
|
+
const absoluteIndentDifference = Math.abs(indentDifference);
|
|
2002
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) {
|
|
2003
|
+
continue;
|
|
2004
|
+
}
|
|
2004
2005
|
key = encodeIndentsKey(indentType, absoluteIndentDifference);
|
|
2005
2006
|
}
|
|
2006
|
-
entry = indents.get(key);
|
|
2007
|
-
|
|
2008
|
-
indents.set(key, entry);
|
|
2007
|
+
const entry = indents.get(key);
|
|
2008
|
+
indents.set(key, entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight]);
|
|
2009
2009
|
}
|
|
2010
2010
|
}
|
|
2011
2011
|
return indents;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-validate/prettier-config",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "Prettier sharable config used by the various HTML-validate packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prettier"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"lint-staged": "16.
|
|
29
|
+
"lint-staged": "16.2.3",
|
|
30
30
|
"prettier": "3.6.2"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|