@taiga-ui/eslint-plugin-experience-next 0.484.0 → 0.486.0
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/index.esm.js +58 -29
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -876,9 +876,10 @@ var recommended = defineConfig([
|
|
|
876
876
|
'import/enforce-node-protocol-usage': ['error', 'always'],
|
|
877
877
|
'import/export': 'off',
|
|
878
878
|
'import/first': 'error',
|
|
879
|
+
'import/namespace': 'off',
|
|
879
880
|
'import/newline-after-import': ['error', { count: 1 }],
|
|
880
881
|
'import/no-absolute-path': 'error',
|
|
881
|
-
'import/no-cycle': '
|
|
882
|
+
'import/no-cycle': 'off',
|
|
882
883
|
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
883
884
|
'import/no-extraneous-dependencies': 'off',
|
|
884
885
|
'import/no-mutable-exports': 'error',
|
|
@@ -1478,25 +1479,33 @@ var recommended = defineConfig([
|
|
|
1478
1479
|
const allPackageJSONs = globSync('**/package.json', {
|
|
1479
1480
|
ignore: ['**/node_modules/**', '**/dist/**'],
|
|
1480
1481
|
}).filter((path) => !readJSON(path).private);
|
|
1481
|
-
|
|
1482
|
-
|
|
1482
|
+
function pattern(type) {
|
|
1483
|
+
return allPackageJSONs.map((p) => p.replaceAll(/\\+/g, '/').replace('package.json', type));
|
|
1484
|
+
}
|
|
1483
1485
|
var taigaSpecific = defineConfig([
|
|
1484
1486
|
{
|
|
1485
|
-
files:
|
|
1487
|
+
files: pattern('**/*.ts'),
|
|
1486
1488
|
ignores: ['**/*.spec.ts', '**/*.cy.ts'],
|
|
1487
1489
|
rules: {
|
|
1488
1490
|
'@taiga-ui/experience-next/no-deep-imports': 'off',
|
|
1489
1491
|
'@taiga-ui/experience-next/prefer-deep-imports': [
|
|
1490
1492
|
'error',
|
|
1491
1493
|
{
|
|
1492
|
-
importFilter:
|
|
1494
|
+
importFilter: allPackageJSONs
|
|
1495
|
+
.map((path) => readJSON(path).name)
|
|
1496
|
+
.filter(Boolean),
|
|
1493
1497
|
strict: !!process.env.CI,
|
|
1494
1498
|
},
|
|
1495
1499
|
],
|
|
1496
1500
|
},
|
|
1497
1501
|
},
|
|
1498
1502
|
{
|
|
1499
|
-
files:
|
|
1503
|
+
files: pattern('**/*.html'),
|
|
1504
|
+
ignores: [
|
|
1505
|
+
// Angular ESLint virtual files for inline templates in spec/cy files
|
|
1506
|
+
'**/*.spec.ts/**/*.html',
|
|
1507
|
+
'**/*.cy.ts/**/*.html',
|
|
1508
|
+
],
|
|
1500
1509
|
rules: {
|
|
1501
1510
|
'@taiga-ui/experience-next/no-restricted-attr-values': [
|
|
1502
1511
|
'error',
|
|
@@ -1508,10 +1517,6 @@ var taigaSpecific = defineConfig([
|
|
|
1508
1517
|
],
|
|
1509
1518
|
},
|
|
1510
1519
|
},
|
|
1511
|
-
{
|
|
1512
|
-
files: ['**/demo/**/*.html', '**/*.spec.ts', '**/*.cy.ts'],
|
|
1513
|
-
rules: { '@taiga-ui/experience-next/no-restricted-attr-values': 'off' },
|
|
1514
|
-
},
|
|
1515
1520
|
{
|
|
1516
1521
|
files: ['**/*.ts'],
|
|
1517
1522
|
rules: {
|
|
@@ -251894,25 +251899,42 @@ const rule$e = createRule({
|
|
|
251894
251899
|
if (!valueSpan) {
|
|
251895
251900
|
continue;
|
|
251896
251901
|
}
|
|
251897
|
-
|
|
251902
|
+
let openQuoteOffset = valueSpan.start.offset - 1;
|
|
251903
|
+
while (openQuoteOffset >= 0 &&
|
|
251904
|
+
(sourceText[openQuoteOffset] === ' ' ||
|
|
251905
|
+
sourceText[openQuoteOffset] === '\n' ||
|
|
251906
|
+
sourceText[openQuoteOffset] === '\r' ||
|
|
251907
|
+
sourceText[openQuoteOffset] === '\t')) {
|
|
251908
|
+
openQuoteOffset--;
|
|
251909
|
+
}
|
|
251910
|
+
const openingQuote = sourceText[openQuoteOffset];
|
|
251911
|
+
const isQuotedAttribute = openingQuote === SINGLE_QUOTE ||
|
|
251912
|
+
openingQuote === DOUBLE_QUOTE;
|
|
251913
|
+
let closeQuoteOffset = valueSpan.end.offset;
|
|
251914
|
+
if (isQuotedAttribute) {
|
|
251915
|
+
while (closeQuoteOffset < sourceText.length &&
|
|
251916
|
+
(sourceText[closeQuoteOffset] === ' ' ||
|
|
251917
|
+
sourceText[closeQuoteOffset] === '\n' ||
|
|
251918
|
+
sourceText[closeQuoteOffset] === '\r' ||
|
|
251919
|
+
sourceText[closeQuoteOffset] === '\t')) {
|
|
251920
|
+
closeQuoteOffset++;
|
|
251921
|
+
}
|
|
251922
|
+
}
|
|
251923
|
+
const closingQuote = sourceText[closeQuoteOffset];
|
|
251924
|
+
const hasMatchingQuotes = isQuotedAttribute && openingQuote === closingQuote;
|
|
251925
|
+
const rawValue = hasMatchingQuotes
|
|
251926
|
+
? sourceText.slice(openQuoteOffset + 1, closeQuoteOffset)
|
|
251927
|
+
: sourceText.slice(valueSpan.start.offset, valueSpan.end.offset);
|
|
251898
251928
|
if (rawValue.includes(EXPECTED_QUOTE)) {
|
|
251899
251929
|
continue;
|
|
251900
251930
|
}
|
|
251901
|
-
const openingQuote = sourceText[valueSpan.start.offset - 1];
|
|
251902
|
-
const closingQuote = sourceText[valueSpan.end.offset];
|
|
251903
|
-
const hasMatchingQuotes = (openingQuote === SINGLE_QUOTE ||
|
|
251904
|
-
openingQuote === DOUBLE_QUOTE) &&
|
|
251905
|
-
openingQuote === closingQuote;
|
|
251906
251931
|
if (hasMatchingQuotes && openingQuote !== EXPECTED_QUOTE) {
|
|
251907
251932
|
context.report({
|
|
251908
251933
|
data: {
|
|
251909
251934
|
actual: `single(${openingQuote})`,
|
|
251910
251935
|
expected: `double(${EXPECTED_QUOTE})`,
|
|
251911
251936
|
},
|
|
251912
|
-
fix: (fixer) => fixer.replaceTextRange([
|
|
251913
|
-
valueSpan.start.offset - 1,
|
|
251914
|
-
valueSpan.end.offset + 1,
|
|
251915
|
-
], `${EXPECTED_QUOTE}${rawValue}${EXPECTED_QUOTE}`),
|
|
251937
|
+
fix: (fixer) => fixer.replaceTextRange([openQuoteOffset, closeQuoteOffset + 1], `${EXPECTED_QUOTE}${rawValue}${EXPECTED_QUOTE}`),
|
|
251916
251938
|
loc: sourceSpanToLoc(attr.sourceSpan),
|
|
251917
251939
|
messageId: MESSAGE_IDS$2.UNEXPECTED,
|
|
251918
251940
|
});
|
|
@@ -252056,17 +252078,24 @@ const rule$b = createRule({
|
|
|
252056
252078
|
|
|
252057
252079
|
const MESSAGE_ID$4 = 'invalid';
|
|
252058
252080
|
const VALID_CONTAINERS = new Set(['menu', 'ol', 'ul']);
|
|
252081
|
+
/**
|
|
252082
|
+
* Duck-type check for TmplAstElement — avoids instanceof which breaks when
|
|
252083
|
+
* the plugin's bundled-angular-compiler differs from the one used by the
|
|
252084
|
+
* template parser (e.g. when the plugin is consumed from a different project).
|
|
252085
|
+
*/
|
|
252086
|
+
function isElement(node) {
|
|
252087
|
+
return (typeof node === 'object' &&
|
|
252088
|
+
node !== null &&
|
|
252089
|
+
typeof node['name'] === 'string' &&
|
|
252090
|
+
Array.isArray(node['children']));
|
|
252091
|
+
}
|
|
252059
252092
|
function getClosestParentElement(node) {
|
|
252060
|
-
let
|
|
252061
|
-
while (
|
|
252062
|
-
if (
|
|
252063
|
-
return
|
|
252064
|
-
}
|
|
252065
|
-
if (parent instanceof dist$4.TmplAstTemplate) {
|
|
252066
|
-
parent = parent.parent;
|
|
252067
|
-
continue;
|
|
252093
|
+
let current = node['parent'];
|
|
252094
|
+
while (current !== null && current !== undefined) {
|
|
252095
|
+
if (isElement(current)) {
|
|
252096
|
+
return current;
|
|
252068
252097
|
}
|
|
252069
|
-
|
|
252098
|
+
current = current['parent'];
|
|
252070
252099
|
}
|
|
252071
252100
|
return null;
|
|
252072
252101
|
}
|