@taiga-ui/eslint-plugin-experience-next 0.539.0 → 0.540.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/README.md +1 -0
- package/index.d.ts +3 -0
- package/index.esm.js +222 -56
- package/package.json +1 -1
- package/rules/recommended/no-redundant-fs-encoding.d.ts +5 -0
- package/rules/utils/ast/comma-separated.d.ts +3 -0
package/README.md
CHANGED
|
@@ -104,6 +104,7 @@ from third-party plugins. The exact severities and file globs live in
|
|
|
104
104
|
| [no-playwright-empty-fill](https://github.com/taiga-family/toolkit/tree/main/projects/eslint-plugin-experience-next/docs/no-playwright-empty-fill.md) | Enforce `clear()` over `fill('')` in Playwright tests | ✅ | 🔧 | |
|
|
105
105
|
| [no-project-as-in-ng-template](https://github.com/taiga-family/toolkit/tree/main/projects/eslint-plugin-experience-next/docs/no-project-as-in-ng-template.md) | `ngProjectAs` has no effect inside `<ng-template>` or dynamic outlets | ✅ | | |
|
|
106
106
|
| [no-restricted-attr-values](https://github.com/taiga-family/toolkit/tree/main/projects/eslint-plugin-experience-next/docs/no-restricted-attr-values.md) | Disallow configured attribute values in Angular templates | | | |
|
|
107
|
+
| [no-redundant-fs-encoding](https://github.com/taiga-family/toolkit/tree/main/projects/eslint-plugin-experience-next/docs/no-redundant-fs-encoding.md) | Remove redundant default utf8 encoding from Node.js file write calls | ✅ | 🔧 | |
|
|
107
108
|
| [no-redundant-type-annotation](https://github.com/taiga-family/toolkit/tree/main/projects/eslint-plugin-experience-next/docs/no-redundant-type-annotation.md) | Disallow redundant type annotations when the type is already inferred from the initializer | ✅ | 🔧 | |
|
|
108
109
|
| [no-repeated-signal-in-conditional](https://github.com/taiga-family/toolkit/tree/main/projects/eslint-plugin-experience-next/docs/no-repeated-signal-in-conditional.md) | Disallow reading the same nullable Angular signal more than once in a conditional expression | ✅ | 🔧 | |
|
|
109
110
|
| [no-side-effects-in-computed](https://github.com/taiga-family/toolkit/tree/main/projects/eslint-plugin-experience-next/docs/no-side-effects-in-computed.md) | Disallow side effects and effectful helper calls inside Angular `computed()` callbacks | ✅ | | |
|
package/index.d.ts
CHANGED
|
@@ -123,6 +123,9 @@ declare const plugin: {
|
|
|
123
123
|
'no-project-as-in-ng-template': import("eslint").Rule.RuleModule & {
|
|
124
124
|
name: string;
|
|
125
125
|
};
|
|
126
|
+
'no-redundant-fs-encoding': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noRedundantFsEncoding", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
127
|
+
name: string;
|
|
128
|
+
};
|
|
126
129
|
'no-redundant-type-annotation': import("@typescript-eslint/utils/ts-eslint").RuleModule<"redundantTypeAnnotation", [({
|
|
127
130
|
ignoreTupleContextualTyping?: boolean;
|
|
128
131
|
} | undefined)?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
package/index.esm.js
CHANGED
|
@@ -1326,6 +1326,7 @@ var recommended = defineConfig([
|
|
|
1326
1326
|
'@taiga-ui/experience-next/no-implicit-public': 'error',
|
|
1327
1327
|
'@taiga-ui/experience-next/no-import-assertions': 'error',
|
|
1328
1328
|
'@taiga-ui/experience-next/no-infinite-loop': 'error',
|
|
1329
|
+
'@taiga-ui/experience-next/no-redundant-fs-encoding': 'error',
|
|
1329
1330
|
'@taiga-ui/experience-next/no-redundant-type-annotation': 'error',
|
|
1330
1331
|
'@taiga-ui/experience-next/no-repeated-signal-in-conditional': 'error',
|
|
1331
1332
|
'@taiga-ui/experience-next/no-side-effects-in-computed': 'error',
|
|
@@ -15668,7 +15669,7 @@ function getLastIndexFix(fixer, sourceCode, node, call) {
|
|
|
15668
15669
|
}
|
|
15669
15670
|
return null;
|
|
15670
15671
|
}
|
|
15671
|
-
const rule$
|
|
15672
|
+
const rule$Z = createRule({
|
|
15672
15673
|
create(context) {
|
|
15673
15674
|
const typeAwareContext = getTypeAwareRuleContext(context);
|
|
15674
15675
|
const compilerOptions = typeAwareContext.tsProgram.getCompilerOptions();
|
|
@@ -47474,7 +47475,7 @@ function buildMultilineStartTag(node, sourceText) {
|
|
|
47474
47475
|
closing,
|
|
47475
47476
|
].join(lineBreak);
|
|
47476
47477
|
}
|
|
47477
|
-
const rule$
|
|
47478
|
+
const rule$Y = createRule({
|
|
47478
47479
|
name: 'attrs-newline',
|
|
47479
47480
|
rule: {
|
|
47480
47481
|
create(context) {
|
|
@@ -47560,7 +47561,7 @@ const rule$X = createRule({
|
|
|
47560
47561
|
},
|
|
47561
47562
|
});
|
|
47562
47563
|
|
|
47563
|
-
const rule$
|
|
47564
|
+
const rule$X = createRule({
|
|
47564
47565
|
create(context) {
|
|
47565
47566
|
const sourceCode = context.sourceCode;
|
|
47566
47567
|
return {
|
|
@@ -47663,7 +47664,7 @@ function sameOrder(a, b) {
|
|
|
47663
47664
|
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
47664
47665
|
}
|
|
47665
47666
|
|
|
47666
|
-
const rule$
|
|
47667
|
+
const rule$W = createRule({
|
|
47667
47668
|
create(context, [order]) {
|
|
47668
47669
|
const decorators = new Set(Object.keys(order));
|
|
47669
47670
|
return {
|
|
@@ -47799,7 +47800,7 @@ function getNodeLabel(node) {
|
|
|
47799
47800
|
}
|
|
47800
47801
|
return node instanceof dist.TmplAstBoundText ? 'binding' : 'text';
|
|
47801
47802
|
}
|
|
47802
|
-
const rule$
|
|
47803
|
+
const rule$V = createRule({
|
|
47803
47804
|
name: 'element-newline',
|
|
47804
47805
|
rule: {
|
|
47805
47806
|
create(context) {
|
|
@@ -47939,7 +47940,7 @@ const PRESETS = {
|
|
|
47939
47940
|
$VUE: ['$CLASS', '$ID', '$VUE_ATTRIBUTE'],
|
|
47940
47941
|
$VUE_ATTRIBUTE: /^v-/,
|
|
47941
47942
|
};
|
|
47942
|
-
const rule$
|
|
47943
|
+
const rule$U = createRule({
|
|
47943
47944
|
create(context, [options]) {
|
|
47944
47945
|
const sourceCode = context.sourceCode;
|
|
47945
47946
|
const settings = {
|
|
@@ -48270,7 +48271,7 @@ const config$4 = {
|
|
|
48270
48271
|
type: 'suggestion',
|
|
48271
48272
|
},
|
|
48272
48273
|
};
|
|
48273
|
-
const rule$
|
|
48274
|
+
const rule$T = createRule({
|
|
48274
48275
|
name: 'html-logical-properties',
|
|
48275
48276
|
rule: config$4,
|
|
48276
48277
|
});
|
|
@@ -48848,7 +48849,7 @@ function isImportUsedOnlyAsAngularDiFirstArg(node, sourceCode) {
|
|
|
48848
48849
|
}
|
|
48849
48850
|
return hasSafeRuntimeUsage;
|
|
48850
48851
|
}
|
|
48851
|
-
const rule$
|
|
48852
|
+
const rule$S = createRule({
|
|
48852
48853
|
create(context) {
|
|
48853
48854
|
const { checker, esTreeNodeToTSNodeMap, sourceCode, tsProgram } = getTypeAwareRuleContext(context);
|
|
48854
48855
|
const checkCycles = context.options[0]?.checkCycles ?? true;
|
|
@@ -49570,7 +49571,7 @@ function getNgDevModeDeclarationFix(program, fixer, sourceCode) {
|
|
|
49570
49571
|
? fixer.insertTextBefore(firstStatement, `declare const ngDevMode: boolean;${lineBreak}${lineBreak}`)
|
|
49571
49572
|
: fixer.insertTextBeforeRange([0, 0], `declare const ngDevMode: boolean;${lineBreak}`);
|
|
49572
49573
|
}
|
|
49573
|
-
const rule$
|
|
49574
|
+
const rule$R = createRule({
|
|
49574
49575
|
create(context) {
|
|
49575
49576
|
const { sourceCode } = context;
|
|
49576
49577
|
const program = sourceCode.ast;
|
|
@@ -49619,7 +49620,7 @@ const rule$Q = createRule({
|
|
|
49619
49620
|
name: 'injection-token-description',
|
|
49620
49621
|
});
|
|
49621
49622
|
|
|
49622
|
-
const rule$
|
|
49623
|
+
const rule$Q = createRule({
|
|
49623
49624
|
create(context) {
|
|
49624
49625
|
const { sourceCode } = context;
|
|
49625
49626
|
const namespaceImports = new Map();
|
|
@@ -49714,7 +49715,7 @@ const DEFAULT_OPTIONS = {
|
|
|
49714
49715
|
importDeclaration: '^@taiga-ui*',
|
|
49715
49716
|
projectName: String.raw `(?<=^@taiga-ui/)([-\w]+)`,
|
|
49716
49717
|
};
|
|
49717
|
-
const rule$
|
|
49718
|
+
const rule$P = createRule({
|
|
49718
49719
|
create(context) {
|
|
49719
49720
|
const { currentProject, deepImport, ignoreImports, importDeclaration, projectName, } = { ...DEFAULT_OPTIONS, ...context.options[0] };
|
|
49720
49721
|
const hasNonCodeExtension = (source) => {
|
|
@@ -49806,7 +49807,7 @@ const nearestFileUpCache = new Map();
|
|
|
49806
49807
|
const markerCache = new Map();
|
|
49807
49808
|
const indexFileCache = new Map();
|
|
49808
49809
|
const indexExportsCache = new Map();
|
|
49809
|
-
const rule$
|
|
49810
|
+
const rule$O = createRule({
|
|
49810
49811
|
create(context) {
|
|
49811
49812
|
const parserServices = dist$4.ESLintUtils.getParserServices(context);
|
|
49812
49813
|
const program = parserServices.program;
|
|
@@ -50000,13 +50001,13 @@ const noDuplicateAttributesRule = angular.templatePlugin.rules?.['no-duplicate-a
|
|
|
50000
50001
|
if (!noDuplicateAttributesRule) {
|
|
50001
50002
|
throw new Error('angular-eslint template rule "no-duplicate-attributes" is not available');
|
|
50002
50003
|
}
|
|
50003
|
-
const rule$
|
|
50004
|
+
const rule$N = createRule({
|
|
50004
50005
|
name: 'no-duplicate-attrs',
|
|
50005
50006
|
rule: noDuplicateAttributesRule,
|
|
50006
50007
|
});
|
|
50007
50008
|
|
|
50008
50009
|
const MESSAGE_ID$e = 'duplicateId';
|
|
50009
|
-
const rule$
|
|
50010
|
+
const rule$M = createRule({
|
|
50010
50011
|
name: 'no-duplicate-id',
|
|
50011
50012
|
rule: {
|
|
50012
50013
|
create(context) {
|
|
@@ -50064,7 +50065,7 @@ function getTrackingKey(node) {
|
|
|
50064
50065
|
? 'link[rel=canonical]'
|
|
50065
50066
|
: null;
|
|
50066
50067
|
}
|
|
50067
|
-
const rule$
|
|
50068
|
+
const rule$L = createRule({
|
|
50068
50069
|
name: 'no-duplicate-in-head',
|
|
50069
50070
|
rule: {
|
|
50070
50071
|
create(context) {
|
|
@@ -50120,7 +50121,7 @@ const rule$K = createRule({
|
|
|
50120
50121
|
});
|
|
50121
50122
|
|
|
50122
50123
|
const COMPONENT_DECORATORS = new Set(['Component']);
|
|
50123
|
-
const rule$
|
|
50124
|
+
const rule$K = createRule({
|
|
50124
50125
|
create(context) {
|
|
50125
50126
|
const { sourceCode } = context;
|
|
50126
50127
|
return {
|
|
@@ -50599,7 +50600,7 @@ const ANGULAR_SIGNALS_UNTRACKED_GUIDE_URL = 'https://angular.dev/guide/signals#r
|
|
|
50599
50600
|
const ANGULAR_SIGNALS_ASYNC_GUIDE_URL = 'https://angular.dev/guide/signals#reactive-context-and-async-operations';
|
|
50600
50601
|
const createUntrackedRule = createRule;
|
|
50601
50602
|
|
|
50602
|
-
const rule$
|
|
50603
|
+
const rule$J = createUntrackedRule({
|
|
50603
50604
|
create(context) {
|
|
50604
50605
|
const { checker, esTreeNodeToTSNodeMap, program } = getTypeAwareRuleContext(context);
|
|
50605
50606
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -50672,7 +50673,7 @@ const config$3 = {
|
|
|
50672
50673
|
type: 'problem',
|
|
50673
50674
|
},
|
|
50674
50675
|
};
|
|
50675
|
-
const rule$
|
|
50676
|
+
const rule$I = createRule({
|
|
50676
50677
|
name: 'no-href-with-router-link',
|
|
50677
50678
|
rule: config$3,
|
|
50678
50679
|
});
|
|
@@ -50723,7 +50724,7 @@ function getPublicModifierInsertion(options) {
|
|
|
50723
50724
|
text: 'public ',
|
|
50724
50725
|
};
|
|
50725
50726
|
}
|
|
50726
|
-
const rule$
|
|
50727
|
+
const rule$H = createRule({
|
|
50727
50728
|
create(context) {
|
|
50728
50729
|
const sourceCode = context.sourceCode;
|
|
50729
50730
|
const checkImplicitPublic = (node) => {
|
|
@@ -50777,7 +50778,7 @@ const rule$G = createRule({
|
|
|
50777
50778
|
name: 'no-implicit-public',
|
|
50778
50779
|
});
|
|
50779
50780
|
|
|
50780
|
-
const rule$
|
|
50781
|
+
const rule$G = createRule({
|
|
50781
50782
|
create(context) {
|
|
50782
50783
|
const { sourceCode } = context;
|
|
50783
50784
|
return {
|
|
@@ -50817,7 +50818,7 @@ function isInfiniteLoopLiteral(node) {
|
|
|
50817
50818
|
function isInfiniteLoopTest(test) {
|
|
50818
50819
|
return test == null || isInfiniteLoopLiteral(test);
|
|
50819
50820
|
}
|
|
50820
|
-
const rule$
|
|
50821
|
+
const rule$F = createRule({
|
|
50821
50822
|
create(context) {
|
|
50822
50823
|
return {
|
|
50823
50824
|
DoWhileStatement(node) {
|
|
@@ -50862,7 +50863,7 @@ const rule$E = createRule({
|
|
|
50862
50863
|
});
|
|
50863
50864
|
|
|
50864
50865
|
const LEGACY_PEER_DEPS_PATTERN = /^legacy-peer-deps\s*=\s*true$/i;
|
|
50865
|
-
const rule$
|
|
50866
|
+
const rule$E = createRule({
|
|
50866
50867
|
create(context) {
|
|
50867
50868
|
return {
|
|
50868
50869
|
Program(node) {
|
|
@@ -50954,7 +50955,7 @@ function getAvailableLabelParent(stack, node, labelsWithControl) {
|
|
|
50954
50955
|
? parent
|
|
50955
50956
|
: null;
|
|
50956
50957
|
}
|
|
50957
|
-
const rule$
|
|
50958
|
+
const rule$D = createRule({
|
|
50958
50959
|
name: 'no-nested-interactive',
|
|
50959
50960
|
rule: {
|
|
50960
50961
|
create(context) {
|
|
@@ -51175,7 +51176,7 @@ function createLetFixes(node, baseName, unavailableNames, text) {
|
|
|
51175
51176
|
reference: name,
|
|
51176
51177
|
};
|
|
51177
51178
|
}
|
|
51178
|
-
const rule$
|
|
51179
|
+
const rule$C = createRule({
|
|
51179
51180
|
name: 'no-nested-ternary-in-template',
|
|
51180
51181
|
rule: {
|
|
51181
51182
|
create(context) {
|
|
@@ -51713,7 +51714,7 @@ const OBSOLETE_HTML_ATTRS = {
|
|
|
51713
51714
|
};
|
|
51714
51715
|
|
|
51715
51716
|
const MESSAGE_ID$9 = 'obsolete';
|
|
51716
|
-
const rule$
|
|
51717
|
+
const rule$B = createRule({
|
|
51717
51718
|
name: 'no-obsolete-attrs',
|
|
51718
51719
|
rule: {
|
|
51719
51720
|
create(context) {
|
|
@@ -51791,7 +51792,7 @@ const OBSOLETE_HTML_TAGS = new Set([
|
|
|
51791
51792
|
]);
|
|
51792
51793
|
|
|
51793
51794
|
const MESSAGE_ID$8 = 'unexpected';
|
|
51794
|
-
const rule$
|
|
51795
|
+
const rule$A = createRule({
|
|
51795
51796
|
name: 'no-obsolete-tags',
|
|
51796
51797
|
rule: {
|
|
51797
51798
|
create(context) {
|
|
@@ -51818,7 +51819,7 @@ const rule$z = createRule({
|
|
|
51818
51819
|
},
|
|
51819
51820
|
});
|
|
51820
51821
|
|
|
51821
|
-
const rule$
|
|
51822
|
+
const rule$z = createRule({
|
|
51822
51823
|
create(context) {
|
|
51823
51824
|
const { checker, esTreeNodeToTSNodeMap, sourceCode } = getTypeAwareRuleContext(context);
|
|
51824
51825
|
return {
|
|
@@ -51962,11 +51963,175 @@ const config$2 = {
|
|
|
51962
51963
|
type: 'problem',
|
|
51963
51964
|
},
|
|
51964
51965
|
};
|
|
51965
|
-
const rule$
|
|
51966
|
+
const rule$y = createRule({
|
|
51966
51967
|
name: 'no-project-as-in-ng-template',
|
|
51967
51968
|
rule: config$2,
|
|
51968
51969
|
});
|
|
51969
51970
|
|
|
51971
|
+
function getCommaAfter(sourceCode, node) {
|
|
51972
|
+
const token = sourceCode.getTokenAfter(node);
|
|
51973
|
+
return token?.value === ',' ? token : null;
|
|
51974
|
+
}
|
|
51975
|
+
function getCommaBefore(sourceCode, node) {
|
|
51976
|
+
const token = sourceCode.getTokenBefore(node);
|
|
51977
|
+
return token?.value === ',' ? token : null;
|
|
51978
|
+
}
|
|
51979
|
+
function removeStandaloneLine(sourceCode, fixer, node) {
|
|
51980
|
+
const lineStart = getLineStartOffset(sourceCode.text, node.range[0]);
|
|
51981
|
+
const nextLineStart = getNextLineStartOffset(sourceCode.text, node.range[1]);
|
|
51982
|
+
return fixer.removeRange([lineStart, nextLineStart]);
|
|
51983
|
+
}
|
|
51984
|
+
function isStandaloneListItem(node, previousNode, nextNode) {
|
|
51985
|
+
const startsOwnLine = previousNode === null || previousNode.loc.end.line < node.loc.start.line;
|
|
51986
|
+
const endsOwnLine = nextNode === null || nextNode.loc.start.line > node.loc.end.line;
|
|
51987
|
+
return startsOwnLine && endsOwnLine;
|
|
51988
|
+
}
|
|
51989
|
+
function removeCommaSeparatedNode(sourceCode, fixer, node, previousNode, nextNode) {
|
|
51990
|
+
if (isStandaloneListItem(node, previousNode, nextNode)) {
|
|
51991
|
+
return removeStandaloneLine(sourceCode, fixer, node);
|
|
51992
|
+
}
|
|
51993
|
+
const commaAfter = getCommaAfter(sourceCode, node);
|
|
51994
|
+
if (nextNode && commaAfter) {
|
|
51995
|
+
return fixer.removeRange([node.range[0], nextNode.range[0]]);
|
|
51996
|
+
}
|
|
51997
|
+
const commaBefore = getCommaBefore(sourceCode, node);
|
|
51998
|
+
if (commaBefore) {
|
|
51999
|
+
return fixer.removeRange([
|
|
52000
|
+
commaBefore.range[0],
|
|
52001
|
+
commaAfter?.range[1] ?? node.range[1],
|
|
52002
|
+
]);
|
|
52003
|
+
}
|
|
52004
|
+
return commaAfter ? fixer.removeRange([node.range[0], commaAfter.range[1]]) : null;
|
|
52005
|
+
}
|
|
52006
|
+
|
|
52007
|
+
const WRITE_METHODS = new Set([
|
|
52008
|
+
'appendFile',
|
|
52009
|
+
'appendFileSync',
|
|
52010
|
+
'writeFile',
|
|
52011
|
+
'writeFileSync',
|
|
52012
|
+
]);
|
|
52013
|
+
const FS_NAMESPACE_NAMES = new Set(['fs', 'fsPromises']);
|
|
52014
|
+
function isWriteMethod(name) {
|
|
52015
|
+
return name !== null && WRITE_METHODS.has(name);
|
|
52016
|
+
}
|
|
52017
|
+
function isFsNamespaceObject(node) {
|
|
52018
|
+
if (node.type === dist$4.AST_NODE_TYPES.Identifier) {
|
|
52019
|
+
return FS_NAMESPACE_NAMES.has(node.name);
|
|
52020
|
+
}
|
|
52021
|
+
if (node.type !== dist$4.AST_NODE_TYPES.MemberExpression) {
|
|
52022
|
+
return false;
|
|
52023
|
+
}
|
|
52024
|
+
const isFsPromisesNamespace = node.object.type === dist$4.AST_NODE_TYPES.Identifier &&
|
|
52025
|
+
node.object.name === 'fs' &&
|
|
52026
|
+
getMemberExpressionPropertyName(node) === 'promises';
|
|
52027
|
+
return isFsPromisesNamespace;
|
|
52028
|
+
}
|
|
52029
|
+
function getWriteMethodName(callee) {
|
|
52030
|
+
if (callee.type === dist$4.AST_NODE_TYPES.Identifier) {
|
|
52031
|
+
return callee.name;
|
|
52032
|
+
}
|
|
52033
|
+
return callee.type === dist$4.AST_NODE_TYPES.MemberExpression &&
|
|
52034
|
+
isFsNamespaceObject(callee.object)
|
|
52035
|
+
? getMemberExpressionPropertyName(callee)
|
|
52036
|
+
: null;
|
|
52037
|
+
}
|
|
52038
|
+
function isRedundantUtf8Encoding(node) {
|
|
52039
|
+
const value = getStaticStringValue(node);
|
|
52040
|
+
if (value === null) {
|
|
52041
|
+
return false;
|
|
52042
|
+
}
|
|
52043
|
+
const normalizedValue = value.toLowerCase();
|
|
52044
|
+
return normalizedValue === 'utf8' || normalizedValue === 'utf-8';
|
|
52045
|
+
}
|
|
52046
|
+
function hasSpreadProperty(node) {
|
|
52047
|
+
return node.properties.some((property) => property.type === dist$4.AST_NODE_TYPES.SpreadElement);
|
|
52048
|
+
}
|
|
52049
|
+
function findRedundantEncodingProperty(node) {
|
|
52050
|
+
if (hasSpreadProperty(node)) {
|
|
52051
|
+
return null;
|
|
52052
|
+
}
|
|
52053
|
+
const encodingProperties = node.properties.filter((property) => property.type === dist$4.AST_NODE_TYPES.Property &&
|
|
52054
|
+
getObjectPropertyName(property) === 'encoding');
|
|
52055
|
+
if (encodingProperties.length !== 1) {
|
|
52056
|
+
return null;
|
|
52057
|
+
}
|
|
52058
|
+
const encodingProperty = encodingProperties[0];
|
|
52059
|
+
return encodingProperty && isRedundantUtf8Encoding(encodingProperty.value)
|
|
52060
|
+
? encodingProperty
|
|
52061
|
+
: null;
|
|
52062
|
+
}
|
|
52063
|
+
function getObjectPropertyFix(sourceCode, fixer, objectExpression, property) {
|
|
52064
|
+
const propertyIndex = objectExpression.properties.indexOf(property);
|
|
52065
|
+
const previousProperty = objectExpression.properties[propertyIndex - 1] ?? null;
|
|
52066
|
+
const nextProperty = objectExpression.properties[propertyIndex + 1] ?? null;
|
|
52067
|
+
return removeCommaSeparatedNode(sourceCode, fixer, property, previousProperty, nextProperty);
|
|
52068
|
+
}
|
|
52069
|
+
function getOptionsArgumentFix(sourceCode, fixer, callExpression, options) {
|
|
52070
|
+
const argumentIndex = callExpression.arguments.indexOf(options);
|
|
52071
|
+
const previousArgument = callExpression.arguments[argumentIndex - 1] ?? null;
|
|
52072
|
+
const nextArgument = callExpression.arguments[argumentIndex + 1] ?? null;
|
|
52073
|
+
return removeCommaSeparatedNode(sourceCode, fixer, options, previousArgument, nextArgument);
|
|
52074
|
+
}
|
|
52075
|
+
const rule$x = createRule({
|
|
52076
|
+
create(context) {
|
|
52077
|
+
const { sourceCode } = context;
|
|
52078
|
+
function reportRedundantEncodingArgument(callExpression, encodingArgument) {
|
|
52079
|
+
context.report({
|
|
52080
|
+
fix(fixer) {
|
|
52081
|
+
return getOptionsArgumentFix(sourceCode, fixer, callExpression, encodingArgument);
|
|
52082
|
+
},
|
|
52083
|
+
messageId: 'noRedundantFsEncoding',
|
|
52084
|
+
node: encodingArgument,
|
|
52085
|
+
});
|
|
52086
|
+
}
|
|
52087
|
+
function reportRedundantEncodingProperty(callExpression, options, encodingProperty) {
|
|
52088
|
+
context.report({
|
|
52089
|
+
fix(fixer) {
|
|
52090
|
+
const hasOnlyEncodingProperty = options.properties.length === 1;
|
|
52091
|
+
return hasOnlyEncodingProperty
|
|
52092
|
+
? getOptionsArgumentFix(sourceCode, fixer, callExpression, options)
|
|
52093
|
+
: getObjectPropertyFix(sourceCode, fixer, options, encodingProperty);
|
|
52094
|
+
},
|
|
52095
|
+
messageId: 'noRedundantFsEncoding',
|
|
52096
|
+
node: encodingProperty,
|
|
52097
|
+
});
|
|
52098
|
+
}
|
|
52099
|
+
return {
|
|
52100
|
+
CallExpression(node) {
|
|
52101
|
+
if (!isWriteMethod(getWriteMethodName(node.callee))) {
|
|
52102
|
+
return;
|
|
52103
|
+
}
|
|
52104
|
+
const options = node.arguments[2];
|
|
52105
|
+
if (!options || options.type === dist$4.AST_NODE_TYPES.SpreadElement) {
|
|
52106
|
+
return;
|
|
52107
|
+
}
|
|
52108
|
+
if (options.type !== dist$4.AST_NODE_TYPES.ObjectExpression) {
|
|
52109
|
+
if (isRedundantUtf8Encoding(options)) {
|
|
52110
|
+
reportRedundantEncodingArgument(node, options);
|
|
52111
|
+
}
|
|
52112
|
+
return;
|
|
52113
|
+
}
|
|
52114
|
+
const encodingProperty = findRedundantEncodingProperty(options);
|
|
52115
|
+
if (encodingProperty) {
|
|
52116
|
+
reportRedundantEncodingProperty(node, options, encodingProperty);
|
|
52117
|
+
}
|
|
52118
|
+
},
|
|
52119
|
+
};
|
|
52120
|
+
},
|
|
52121
|
+
meta: {
|
|
52122
|
+
docs: {
|
|
52123
|
+
description: 'Disallow redundant default utf8 encoding in Node.js file write calls.',
|
|
52124
|
+
},
|
|
52125
|
+
fixable: 'code',
|
|
52126
|
+
messages: {
|
|
52127
|
+
noRedundantFsEncoding: 'Remove redundant utf8 encoding. Node.js file write methods use utf8 by default for string data.',
|
|
52128
|
+
},
|
|
52129
|
+
schema: [],
|
|
52130
|
+
type: 'suggestion',
|
|
52131
|
+
},
|
|
52132
|
+
name: 'no-redundant-fs-encoding',
|
|
52133
|
+
});
|
|
52134
|
+
|
|
51970
52135
|
function collectArrayExpressions(node) {
|
|
51971
52136
|
const result = [];
|
|
51972
52137
|
if (node.type === dist$4.AST_NODE_TYPES.ArrayExpression) {
|
|
@@ -56441,36 +56606,37 @@ const plugin = {
|
|
|
56441
56606
|
},
|
|
56442
56607
|
rules: {
|
|
56443
56608
|
'array-as-const': rule$5,
|
|
56444
|
-
'at-compat': rule$
|
|
56445
|
-
'attrs-newline': rule$
|
|
56446
|
-
'class-accessibility-spacing': rule$
|
|
56609
|
+
'at-compat': rule$Z,
|
|
56610
|
+
'attrs-newline': rule$Y,
|
|
56611
|
+
'class-accessibility-spacing': rule$X,
|
|
56447
56612
|
'class-property-naming': rule$4,
|
|
56448
|
-
'decorator-key-sort': rule$
|
|
56449
|
-
'element-newline': rule$
|
|
56613
|
+
'decorator-key-sort': rule$W,
|
|
56614
|
+
'element-newline': rule$V,
|
|
56450
56615
|
'flat-exports': rule$3,
|
|
56451
|
-
'host-attributes-sort': rule$
|
|
56452
|
-
'html-logical-properties': rule$
|
|
56453
|
-
'import-integrity': rule$
|
|
56454
|
-
'injection-token-description': rule$
|
|
56455
|
-
'no-commonjs-import-patterns': rule$
|
|
56456
|
-
'no-deep-imports': rule$
|
|
56457
|
-
'no-deep-imports-to-indexed-packages': rule$
|
|
56458
|
-
'no-duplicate-attrs': rule$
|
|
56459
|
-
'no-duplicate-id': rule$
|
|
56460
|
-
'no-duplicate-in-head': rule$
|
|
56461
|
-
'no-empty-style-metadata': rule$
|
|
56462
|
-
'no-fully-untracked-effect': rule$
|
|
56463
|
-
'no-href-with-router-link': rule$
|
|
56464
|
-
'no-implicit-public': rule$
|
|
56465
|
-
'no-import-assertions': rule$
|
|
56466
|
-
'no-infinite-loop': rule$
|
|
56467
|
-
'no-legacy-peer-deps': rule$
|
|
56468
|
-
'no-nested-interactive': rule$
|
|
56469
|
-
'no-nested-ternary-in-template': rule$
|
|
56470
|
-
'no-obsolete-attrs': rule$
|
|
56471
|
-
'no-obsolete-tags': rule$
|
|
56472
|
-
'no-playwright-empty-fill': rule$
|
|
56473
|
-
'no-project-as-in-ng-template': rule$
|
|
56616
|
+
'host-attributes-sort': rule$U,
|
|
56617
|
+
'html-logical-properties': rule$T,
|
|
56618
|
+
'import-integrity': rule$S,
|
|
56619
|
+
'injection-token-description': rule$R,
|
|
56620
|
+
'no-commonjs-import-patterns': rule$Q,
|
|
56621
|
+
'no-deep-imports': rule$P,
|
|
56622
|
+
'no-deep-imports-to-indexed-packages': rule$O,
|
|
56623
|
+
'no-duplicate-attrs': rule$N,
|
|
56624
|
+
'no-duplicate-id': rule$M,
|
|
56625
|
+
'no-duplicate-in-head': rule$L,
|
|
56626
|
+
'no-empty-style-metadata': rule$K,
|
|
56627
|
+
'no-fully-untracked-effect': rule$J,
|
|
56628
|
+
'no-href-with-router-link': rule$I,
|
|
56629
|
+
'no-implicit-public': rule$H,
|
|
56630
|
+
'no-import-assertions': rule$G,
|
|
56631
|
+
'no-infinite-loop': rule$F,
|
|
56632
|
+
'no-legacy-peer-deps': rule$E,
|
|
56633
|
+
'no-nested-interactive': rule$D,
|
|
56634
|
+
'no-nested-ternary-in-template': rule$C,
|
|
56635
|
+
'no-obsolete-attrs': rule$B,
|
|
56636
|
+
'no-obsolete-tags': rule$A,
|
|
56637
|
+
'no-playwright-empty-fill': rule$z,
|
|
56638
|
+
'no-project-as-in-ng-template': rule$y,
|
|
56639
|
+
'no-redundant-fs-encoding': rule$x,
|
|
56474
56640
|
'no-redundant-type-annotation': rule$w,
|
|
56475
56641
|
'no-repeated-signal-in-conditional': rule$v,
|
|
56476
56642
|
'no-restricted-attr-values': rule$2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiga-ui/eslint-plugin-experience-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.540.0",
|
|
4
4
|
"description": "An ESLint plugin to enforce a consistent code styles across taiga-ui projects",
|
|
5
5
|
"homepage": "https://github.com/taiga-family/toolkit#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type TSESLint, type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
export type CommaSeparatedNode = TSESTree.Expression | TSESTree.Property | TSESTree.SpreadElement;
|
|
3
|
+
export declare function removeCommaSeparatedNode(sourceCode: Readonly<TSESLint.SourceCode>, fixer: TSESLint.RuleFixer, node: CommaSeparatedNode, previousNode: CommaSeparatedNode | null, nextNode: CommaSeparatedNode | null): TSESLint.RuleFix | null;
|