@bigbinary/eslint-plugin-neeto 1.5.8 → 1.6.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/dist/index.js +173 -49
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -615,13 +615,14 @@
|
|
|
615
615
|
});
|
|
616
616
|
|
|
617
617
|
const removeComments = json => json.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m);
|
|
618
|
-
const addNullSafeImport = (context, fixer) => {
|
|
618
|
+
const addNullSafeImport = (context, fixer, node) => {
|
|
619
619
|
const importPattern = ramda.assocPath(["source", "value"], "neetocist", IMPORT_DECLARATION);
|
|
620
620
|
return addFunctionImport({
|
|
621
621
|
context,
|
|
622
622
|
fixer,
|
|
623
623
|
functions: ["nullSafe"],
|
|
624
|
-
importPattern
|
|
624
|
+
importPattern,
|
|
625
|
+
node
|
|
625
626
|
});
|
|
626
627
|
};
|
|
627
628
|
|
|
@@ -688,9 +689,10 @@
|
|
|
688
689
|
context,
|
|
689
690
|
fixer,
|
|
690
691
|
functions,
|
|
691
|
-
importPattern
|
|
692
|
+
importPattern,
|
|
693
|
+
node
|
|
692
694
|
}) => {
|
|
693
|
-
const root = context.getAncestors()[0];
|
|
695
|
+
const root = context.sourceCode.getAncestors(node)[0];
|
|
694
696
|
const packageImport = root.body.find(neetoCist.matches(importPattern));
|
|
695
697
|
if (packageImport) {
|
|
696
698
|
const extraImports = functions.filter(func => !packageImport.specifiers.some(ramda.pathEq(func, ["imported", "name"])));
|
|
@@ -712,11 +714,12 @@
|
|
|
712
714
|
context,
|
|
713
715
|
fixer,
|
|
714
716
|
functions: Array.isArray(functions) ? functions : [functions],
|
|
715
|
-
importPattern
|
|
717
|
+
importPattern,
|
|
718
|
+
node
|
|
716
719
|
});
|
|
717
720
|
if (imports) yield imports;
|
|
718
721
|
if (importNullSafe) {
|
|
719
|
-
const nullSafeImport = addNullSafeImport(context, fixer);
|
|
722
|
+
const nullSafeImport = addNullSafeImport(context, fixer, node);
|
|
720
723
|
if (nullSafeImport) yield nullSafeImport;
|
|
721
724
|
}
|
|
722
725
|
yield fixer.replaceText(node, fix);
|
|
@@ -1058,7 +1061,7 @@
|
|
|
1058
1061
|
}) => value.cooked.includes("?"))
|
|
1059
1062
|
};
|
|
1060
1063
|
|
|
1061
|
-
const isRoutesImportPresent = context => context.getAncestors()[0].body.some(neetoCist.matches(ROUTES_IMPORT_PATTERN));
|
|
1064
|
+
const isRoutesImportPresent = (context, node) => context.sourceCode.getAncestors(node)[0].body.some(neetoCist.matches(ROUTES_IMPORT_PATTERN));
|
|
1062
1065
|
var noRoutesDestructureAndReassignment = {
|
|
1063
1066
|
meta: {
|
|
1064
1067
|
type: "problem",
|
|
@@ -1069,17 +1072,17 @@
|
|
|
1069
1072
|
},
|
|
1070
1073
|
create: context => ({
|
|
1071
1074
|
VariableDeclaration(node) {
|
|
1072
|
-
if (neetoCist.matches(DECALARATION_PATTERN$1, node) && isRoutesImportPresent(context)) {
|
|
1075
|
+
if (neetoCist.matches(DECALARATION_PATTERN$1, node) && isRoutesImportPresent(context, node)) {
|
|
1073
1076
|
context.report(node, ROUTES_HAS_ALREADY_BEEN_DECLARED);
|
|
1074
1077
|
}
|
|
1075
1078
|
},
|
|
1076
1079
|
VariableDeclarator(node) {
|
|
1077
|
-
if (neetoCist.matches(ASSIGNMENT_PATTERN, node) && isRoutesImportPresent(context)) {
|
|
1080
|
+
if (neetoCist.matches(ASSIGNMENT_PATTERN, node) && isRoutesImportPresent(context, node)) {
|
|
1078
1081
|
context.report(node, NO_ROUTES_ASSIGNMENT);
|
|
1079
1082
|
}
|
|
1080
1083
|
},
|
|
1081
1084
|
AssignmentExpression(node) {
|
|
1082
|
-
if (neetoCist.matches(REASSIGNMENT_PATTERN, node) && isRoutesImportPresent(context)) {
|
|
1085
|
+
if (neetoCist.matches(REASSIGNMENT_PATTERN, node) && isRoutesImportPresent(context, node)) {
|
|
1083
1086
|
context.report(node, NO_ROUTES_REASSIGNMENT);
|
|
1084
1087
|
}
|
|
1085
1088
|
}
|
|
@@ -4689,14 +4692,12 @@
|
|
|
4689
4692
|
const findMatchedConfig = (context, configs) => {
|
|
4690
4693
|
const fullFilePath = context.getFilename();
|
|
4691
4694
|
const basePath = context.options[0].basePath;
|
|
4692
|
-
|
|
4695
|
+
return configs.find(config => {
|
|
4693
4696
|
const isIncluded = asArray(config.includes).some(pathPattern => minimatch$1(fullFilePath, basePath + pathPattern));
|
|
4694
4697
|
if (config.includes && !isIncluded) return false;
|
|
4695
4698
|
const isExcluded = asArray(config.excludes).some(pathPattern => minimatch$1(fullFilePath, basePath + pathPattern));
|
|
4696
|
-
|
|
4697
|
-
return true;
|
|
4699
|
+
return !(config.excludes && isExcluded);
|
|
4698
4700
|
});
|
|
4699
|
-
return matchedConfig;
|
|
4700
4701
|
};
|
|
4701
4702
|
const checkFilenameCase = (context, node, filenameCase) => {
|
|
4702
4703
|
const [filename] = getFilenameAndExtension(context);
|
|
@@ -4817,6 +4818,51 @@
|
|
|
4817
4818
|
docs: {
|
|
4818
4819
|
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/file-name-and-export-name-standards.md",
|
|
4819
4820
|
description: "Allows you to enforce a consistent naming pattern for the filenames and exports."
|
|
4821
|
+
},
|
|
4822
|
+
schema: {
|
|
4823
|
+
type: "array",
|
|
4824
|
+
items: [{
|
|
4825
|
+
type: "object",
|
|
4826
|
+
properties: {
|
|
4827
|
+
basePath: {
|
|
4828
|
+
type: "string"
|
|
4829
|
+
},
|
|
4830
|
+
default: {
|
|
4831
|
+
type: "object",
|
|
4832
|
+
properties: {
|
|
4833
|
+
filenameCase: {
|
|
4834
|
+
type: "string"
|
|
4835
|
+
},
|
|
4836
|
+
exportnameCase: {
|
|
4837
|
+
type: "string"
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
},
|
|
4841
|
+
configs: {
|
|
4842
|
+
type: "array",
|
|
4843
|
+
items: [{
|
|
4844
|
+
filenameCase: {
|
|
4845
|
+
type: "string"
|
|
4846
|
+
},
|
|
4847
|
+
exportnameCase: {
|
|
4848
|
+
type: "string"
|
|
4849
|
+
},
|
|
4850
|
+
includes: {
|
|
4851
|
+
type: ["string", "array"],
|
|
4852
|
+
items: [{
|
|
4853
|
+
type: "string"
|
|
4854
|
+
}]
|
|
4855
|
+
},
|
|
4856
|
+
excludes: {
|
|
4857
|
+
type: ["string", "array"],
|
|
4858
|
+
items: [{
|
|
4859
|
+
type: "string"
|
|
4860
|
+
}]
|
|
4861
|
+
}
|
|
4862
|
+
}]
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4865
|
+
}]
|
|
4820
4866
|
}
|
|
4821
4867
|
},
|
|
4822
4868
|
create: context => ({
|
|
@@ -5243,7 +5289,7 @@
|
|
|
5243
5289
|
}
|
|
5244
5290
|
const isJSXTextType = node.type === TYPES.JSX_TEXT;
|
|
5245
5291
|
if (isJSXTextType) return true;
|
|
5246
|
-
const ancestors = context.getAncestors(node);
|
|
5292
|
+
const ancestors = context.sourceCode.getAncestors(node);
|
|
5247
5293
|
const isMatchesNaturalLangRegex = NATURAL_LANGUAGE_REGEX.test(nodeValue);
|
|
5248
5294
|
for (let i = ancestors.length - 1; i > 0; i--) {
|
|
5249
5295
|
const parent = ancestors[i];
|
|
@@ -5446,6 +5492,29 @@
|
|
|
5446
5492
|
docs: {
|
|
5447
5493
|
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/no-missing-localization.md",
|
|
5448
5494
|
description: "Detects localization keys that do not have an associated value in the translations."
|
|
5495
|
+
},
|
|
5496
|
+
schema: {
|
|
5497
|
+
type: "array",
|
|
5498
|
+
items: [{
|
|
5499
|
+
type: "object",
|
|
5500
|
+
properties: {
|
|
5501
|
+
translationsDir: {
|
|
5502
|
+
type: "string"
|
|
5503
|
+
},
|
|
5504
|
+
languages: {
|
|
5505
|
+
type: "array",
|
|
5506
|
+
items: [{
|
|
5507
|
+
type: "string"
|
|
5508
|
+
}]
|
|
5509
|
+
},
|
|
5510
|
+
nanosTranslationDir: {
|
|
5511
|
+
type: "array",
|
|
5512
|
+
items: [{
|
|
5513
|
+
type: "string"
|
|
5514
|
+
}]
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
}]
|
|
5449
5518
|
}
|
|
5450
5519
|
},
|
|
5451
5520
|
create: context => {
|
|
@@ -6538,7 +6607,8 @@
|
|
|
6538
6607
|
const reportSuggestion$1 = ({
|
|
6539
6608
|
context,
|
|
6540
6609
|
historyMethodCall,
|
|
6541
|
-
computeFix
|
|
6610
|
+
computeFix,
|
|
6611
|
+
node
|
|
6542
6612
|
}) => context.report({
|
|
6543
6613
|
node: historyMethodCall,
|
|
6544
6614
|
message: CAN_BE_REPLACED_WITH_HANDLE_META_CLICK,
|
|
@@ -6554,7 +6624,8 @@
|
|
|
6554
6624
|
context,
|
|
6555
6625
|
fixer,
|
|
6556
6626
|
functions: ["handleMetaClick"],
|
|
6557
|
-
importPattern: REACT_UTILS_IMPORT_PATTERN$2
|
|
6627
|
+
importPattern: REACT_UTILS_IMPORT_PATTERN$2,
|
|
6628
|
+
node
|
|
6558
6629
|
});
|
|
6559
6630
|
if (importStatement) fixerArray.push(importStatement);
|
|
6560
6631
|
return fixerArray;
|
|
@@ -6586,6 +6657,7 @@
|
|
|
6586
6657
|
reportSuggestion$1({
|
|
6587
6658
|
context,
|
|
6588
6659
|
historyMethodCall,
|
|
6660
|
+
node,
|
|
6589
6661
|
computeFix: ({
|
|
6590
6662
|
fixerArray,
|
|
6591
6663
|
fixer
|
|
@@ -6857,6 +6929,17 @@
|
|
|
6857
6929
|
docs: {
|
|
6858
6930
|
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/no-axios-import-outside-apis.md",
|
|
6859
6931
|
description: `Axios should only be imported and used inside scripts within the "apis" directory`
|
|
6932
|
+
},
|
|
6933
|
+
schema: {
|
|
6934
|
+
type: "array",
|
|
6935
|
+
items: [{
|
|
6936
|
+
type: "object",
|
|
6937
|
+
patternProperties: {
|
|
6938
|
+
".*": {
|
|
6939
|
+
type: "string"
|
|
6940
|
+
}
|
|
6941
|
+
}
|
|
6942
|
+
}]
|
|
6860
6943
|
}
|
|
6861
6944
|
},
|
|
6862
6945
|
create: context => ({
|
|
@@ -7107,7 +7190,8 @@
|
|
|
7107
7190
|
context,
|
|
7108
7191
|
fixer,
|
|
7109
7192
|
functions: ["withT"],
|
|
7110
|
-
importPattern: NEETO_COMMONS_REACT_UTILS_IMPORT_PATTERN
|
|
7193
|
+
importPattern: NEETO_COMMONS_REACT_UTILS_IMPORT_PATTERN,
|
|
7194
|
+
node
|
|
7111
7195
|
});
|
|
7112
7196
|
importWithT && fixers.push(importWithT);
|
|
7113
7197
|
return fixers;
|
|
@@ -7174,6 +7258,17 @@
|
|
|
7174
7258
|
docs: {
|
|
7175
7259
|
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/no-large-functions-inside-jsx.md",
|
|
7176
7260
|
description: "Disallows the use of functions with large bodies, that exceed maxAllowedNoOfLines, directly inside JSX elements." + "The default value for maxAllowedNoOfLines is 4."
|
|
7261
|
+
},
|
|
7262
|
+
schema: {
|
|
7263
|
+
type: "array",
|
|
7264
|
+
items: [{
|
|
7265
|
+
type: "object",
|
|
7266
|
+
properties: {
|
|
7267
|
+
maxAllowedNoOfLines: {
|
|
7268
|
+
type: "number"
|
|
7269
|
+
}
|
|
7270
|
+
}
|
|
7271
|
+
}]
|
|
7177
7272
|
}
|
|
7178
7273
|
},
|
|
7179
7274
|
create: context => ({
|
|
@@ -7294,6 +7389,17 @@
|
|
|
7294
7389
|
docs: {
|
|
7295
7390
|
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/no-multiple-components-in-a-file.md",
|
|
7296
7391
|
description: "Do not have multiple component definitions that exceed maxAllowedNoOfLines in a single file." + "The default value for maxAllowedNoOfLines is 20."
|
|
7392
|
+
},
|
|
7393
|
+
schema: {
|
|
7394
|
+
type: "array",
|
|
7395
|
+
items: [{
|
|
7396
|
+
type: "object",
|
|
7397
|
+
properties: {
|
|
7398
|
+
maxAllowedNoOfLines: {
|
|
7399
|
+
type: "number"
|
|
7400
|
+
}
|
|
7401
|
+
}
|
|
7402
|
+
}]
|
|
7297
7403
|
}
|
|
7298
7404
|
},
|
|
7299
7405
|
create: context => ({
|
|
@@ -7775,14 +7881,14 @@
|
|
|
7775
7881
|
const codeInsideBody = getCode$1(context, arrowFunctionExpression.body);
|
|
7776
7882
|
const codeWithUseTranslation = insertTextAfterPosition(0, codeInsideBody, "const { t } = useTranslation();\n");
|
|
7777
7883
|
const updatedProps = getPropsCode(context, arrowFunctionExpression, props);
|
|
7778
|
-
|
|
7779
|
-
return replacedCodeWithUseTranslation;
|
|
7884
|
+
return `(${updatedProps}${ramda.isEmpty(restParams) ? "" : `${neetoCist.isNotEmpty(updatedProps) ? ", " : "{}, "}${restParams.map(param => getCode$1(context, param)).join(", ")}`}) => ${codeWithUseTranslation}`;
|
|
7780
7885
|
};
|
|
7781
|
-
const createUseTranslationImport = (context, fixer) => addFunctionImport({
|
|
7886
|
+
const createUseTranslationImport = (context, fixer, node) => addFunctionImport({
|
|
7782
7887
|
context,
|
|
7783
7888
|
fixer,
|
|
7784
7889
|
functions: ["useTranslation"],
|
|
7785
|
-
importPattern: REACT_I18_IMPORT_PATTERN
|
|
7890
|
+
importPattern: REACT_I18_IMPORT_PATTERN,
|
|
7891
|
+
node
|
|
7786
7892
|
});
|
|
7787
7893
|
const insertTextAfterPosition = (position, inputString, textToInsert) => {
|
|
7788
7894
|
const firstCharacter = inputString.charAt(position);
|
|
@@ -7806,7 +7912,7 @@
|
|
|
7806
7912
|
} else {
|
|
7807
7913
|
fixers.push(fixer.replaceText(node.declarations[0].init, replacedCodeWithUseTranslation));
|
|
7808
7914
|
}
|
|
7809
|
-
const importUseTranslation = createUseTranslationImport(context, fixer);
|
|
7915
|
+
const importUseTranslation = createUseTranslationImport(context, fixer, node);
|
|
7810
7916
|
importUseTranslation && fixers.push(importUseTranslation);
|
|
7811
7917
|
return fixers;
|
|
7812
7918
|
}
|
|
@@ -7895,17 +8001,16 @@
|
|
|
7895
8001
|
type: "problem",
|
|
7896
8002
|
docs: {
|
|
7897
8003
|
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/prefix-neeto-ui-import-alias.md",
|
|
7898
|
-
description: PREFIX_NEETO_UI_IMPORT_ALIAS_MESSAGE
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
}
|
|
8004
|
+
description: PREFIX_NEETO_UI_IMPORT_ALIAS_MESSAGE
|
|
8005
|
+
},
|
|
8006
|
+
schema: [{
|
|
8007
|
+
type: "object",
|
|
8008
|
+
patternProperties: {
|
|
8009
|
+
".*": {
|
|
8010
|
+
type: "string"
|
|
7906
8011
|
}
|
|
7907
8012
|
}
|
|
7908
|
-
}
|
|
8013
|
+
}]
|
|
7909
8014
|
},
|
|
7910
8015
|
create: context => ({
|
|
7911
8016
|
ImportSpecifier(node) {
|
|
@@ -8303,8 +8408,8 @@
|
|
|
8303
8408
|
fix: fixer => {
|
|
8304
8409
|
let fixToRemoveComma = null;
|
|
8305
8410
|
let fixToRemoveErrorNode = fixer.remove(property);
|
|
8306
|
-
const tokenBefore = context.getTokenBefore(property);
|
|
8307
|
-
const tokenAfter = context.getTokenAfter(property);
|
|
8411
|
+
const tokenBefore = context.sourceCode.getTokenBefore(property);
|
|
8412
|
+
const tokenAfter = context.sourceCode.getTokenAfter(property);
|
|
8308
8413
|
if (tokenAfter.value === ",") {
|
|
8309
8414
|
fixToRemoveComma = fixer.remove(tokenAfter);
|
|
8310
8415
|
} else if (tokenBefore.value === ",") {
|
|
@@ -9489,7 +9594,7 @@
|
|
|
9489
9594
|
const fixerArray = [fixer.replaceText(expressionNode, fixString)];
|
|
9490
9595
|
const importExists = neetoCist.existsBy(CLASSNAMES_IMPORT_PATTERN, getAllImports(node));
|
|
9491
9596
|
if (!importExists) {
|
|
9492
|
-
const addImport = fixer.insertTextBefore(context.getAncestors()[0], 'import classnames from "classnames";\n');
|
|
9597
|
+
const addImport = fixer.insertTextBefore(context.sourceCode.getAncestors(node)[0], 'import classnames from "classnames";\n');
|
|
9493
9598
|
fixerArray.push(addImport);
|
|
9494
9599
|
}
|
|
9495
9600
|
return fixerArray;
|
|
@@ -9740,7 +9845,8 @@
|
|
|
9740
9845
|
context,
|
|
9741
9846
|
fixer,
|
|
9742
9847
|
functions: ["createSubscription"],
|
|
9743
|
-
importPattern: NEETO_COMMONS_UTILS_IMPORT_PATTERN
|
|
9848
|
+
importPattern: NEETO_COMMONS_UTILS_IMPORT_PATTERN,
|
|
9849
|
+
node
|
|
9744
9850
|
});
|
|
9745
9851
|
if (addedImport) fixerArray.push(addedImport);
|
|
9746
9852
|
return fixerArray;
|
|
@@ -10247,7 +10353,8 @@
|
|
|
10247
10353
|
context,
|
|
10248
10354
|
fixer,
|
|
10249
10355
|
functions: ["showThumbsUpToastr"],
|
|
10250
|
-
importPattern: NEETO_COMMONS_UTILS_IMPORT_PATTERN
|
|
10356
|
+
importPattern: NEETO_COMMONS_UTILS_IMPORT_PATTERN,
|
|
10357
|
+
node
|
|
10251
10358
|
});
|
|
10252
10359
|
if (addImport) fixerArr.push(addImport);
|
|
10253
10360
|
return fixerArr;
|
|
@@ -10487,14 +10594,15 @@
|
|
|
10487
10594
|
context,
|
|
10488
10595
|
fixer,
|
|
10489
10596
|
functions: ["useMutationWithInvalidation"],
|
|
10490
|
-
importPattern: REACT_UTILS_IMPORT_PATTERN$1
|
|
10597
|
+
importPattern: REACT_UTILS_IMPORT_PATTERN$1,
|
|
10598
|
+
node
|
|
10491
10599
|
});
|
|
10492
10600
|
fixerArray.push(addImport);
|
|
10493
10601
|
}
|
|
10494
10602
|
return fixerArray;
|
|
10495
10603
|
};
|
|
10496
10604
|
const getRemoveCommaFix = (context, fixer, onSuccess) => {
|
|
10497
|
-
const tokenAfter = context.getTokenAfter(onSuccess);
|
|
10605
|
+
const tokenAfter = context.sourceCode.getTokenAfter(onSuccess);
|
|
10498
10606
|
return tokenAfter.value === "," ? fixer.remove(tokenAfter) : null;
|
|
10499
10607
|
};
|
|
10500
10608
|
const getVariables = (context, params) => {
|
|
@@ -10692,7 +10800,8 @@
|
|
|
10692
10800
|
context,
|
|
10693
10801
|
fixer,
|
|
10694
10802
|
functions: ["useQueryClient"],
|
|
10695
|
-
importPattern: REACT_QUERY_IMPORT_PATTERN
|
|
10803
|
+
importPattern: REACT_QUERY_IMPORT_PATTERN,
|
|
10804
|
+
node
|
|
10696
10805
|
});
|
|
10697
10806
|
return [initializeQueryClient, addImport];
|
|
10698
10807
|
}
|
|
@@ -10712,14 +10821,14 @@
|
|
|
10712
10821
|
description: "Shows import paths that can be simplified using aliases configured by webpack.",
|
|
10713
10822
|
schema: {
|
|
10714
10823
|
type: "object",
|
|
10715
|
-
description: "An object mapping aliases to paths.",
|
|
10716
10824
|
patternProperties: {
|
|
10717
|
-
"
|
|
10825
|
+
".*": {
|
|
10718
10826
|
type: "string"
|
|
10719
10827
|
}
|
|
10720
10828
|
}
|
|
10721
10829
|
}
|
|
10722
|
-
}
|
|
10830
|
+
},
|
|
10831
|
+
schema: false
|
|
10723
10832
|
},
|
|
10724
10833
|
create: context => ({
|
|
10725
10834
|
ImportDeclaration(node) {
|
|
@@ -10752,6 +10861,21 @@
|
|
|
10752
10861
|
docs: {
|
|
10753
10862
|
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/webpack-aliases-and-jsconfig-paths-should-be-in-sync.md",
|
|
10754
10863
|
description: "Ensures that webpack alias and jsconfig are in sync"
|
|
10864
|
+
},
|
|
10865
|
+
schema: {
|
|
10866
|
+
type: "array",
|
|
10867
|
+
items: [{
|
|
10868
|
+
type: "object",
|
|
10869
|
+
properties: {
|
|
10870
|
+
jsconfigFilePath: {
|
|
10871
|
+
type: "string"
|
|
10872
|
+
},
|
|
10873
|
+
aliasFilePath: {
|
|
10874
|
+
type: "string"
|
|
10875
|
+
}
|
|
10876
|
+
},
|
|
10877
|
+
additionalProperties: false
|
|
10878
|
+
}]
|
|
10755
10879
|
}
|
|
10756
10880
|
},
|
|
10757
10881
|
create: context => {
|
|
@@ -11101,10 +11225,9 @@
|
|
|
11101
11225
|
})
|
|
11102
11226
|
};
|
|
11103
11227
|
|
|
11104
|
-
const isImportedFromReact = context => {
|
|
11105
|
-
const root = context.getAncestors()[0];
|
|
11106
|
-
|
|
11107
|
-
return isImportExist;
|
|
11228
|
+
const isImportedFromReact = (context, node) => {
|
|
11229
|
+
const root = context.sourceCode.getAncestors(node)[0];
|
|
11230
|
+
return root.body.some(neetoCist.matches(CREATE_CONTEXT_IMPORT_PATTERN));
|
|
11108
11231
|
};
|
|
11109
11232
|
var useZustandForGlobalStateManagement = {
|
|
11110
11233
|
meta: {
|
|
@@ -11116,7 +11239,7 @@
|
|
|
11116
11239
|
},
|
|
11117
11240
|
create: context => ({
|
|
11118
11241
|
CallExpression(node) {
|
|
11119
|
-
if (neetoCist.matches(REACT_CREATE_CONTEXT_PATTERN, node) || neetoCist.matches(CREATE_CONTEXT_PATTERN, node) && isImportedFromReact(context)) {
|
|
11242
|
+
if (neetoCist.matches(REACT_CREATE_CONTEXT_PATTERN, node) || neetoCist.matches(CREATE_CONTEXT_PATTERN, node) && isImportedFromReact(context, node)) {
|
|
11120
11243
|
context.report({
|
|
11121
11244
|
node,
|
|
11122
11245
|
message: USE_ZUSTAND_FOR_GLOBAL_STATE_MANAGEMENT
|
|
@@ -11227,7 +11350,8 @@
|
|
|
11227
11350
|
context,
|
|
11228
11351
|
fixer,
|
|
11229
11352
|
functions: ["withImmutableActions"],
|
|
11230
|
-
importPattern: REACT_UTILS_IMPORT_PATTERN
|
|
11353
|
+
importPattern: REACT_UTILS_IMPORT_PATTERN,
|
|
11354
|
+
node
|
|
11231
11355
|
});
|
|
11232
11356
|
if (addImportFixer) fixerArray.push(addImportFixer);
|
|
11233
11357
|
return fixerArray;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/eslint-plugin-neeto",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@bigbinary/babel-preset-neeto": "^1.0.3",
|
|
39
39
|
"@bigbinary/eslint-plugin-neeto": "1.5.5",
|
|
40
40
|
"@bigbinary/neeto-cist": "^1.0.3",
|
|
41
|
-
"@bigbinary/neeto-commons-frontend": "4.
|
|
41
|
+
"@bigbinary/neeto-commons-frontend": "^4.14.0",
|
|
42
42
|
"@rollup/plugin-alias": "^3.1.9",
|
|
43
43
|
"@rollup/plugin-babel": "^6.0.4",
|
|
44
44
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -57,20 +57,20 @@
|
|
|
57
57
|
"babel-preset-typescript": "^7.0.0-alpha.19",
|
|
58
58
|
"cheerio": "^1.0.0-rc.12",
|
|
59
59
|
"command-line-args": "^5.2.1",
|
|
60
|
-
"eslint": "
|
|
61
|
-
"eslint-config-prettier": "
|
|
62
|
-
"eslint-plugin-cypress": "
|
|
63
|
-
"eslint-plugin-import": "2.
|
|
64
|
-
"eslint-plugin-jam3": "0.2.3",
|
|
65
|
-
"eslint-plugin-json": "
|
|
66
|
-
"eslint-plugin-prettier": "
|
|
67
|
-
"eslint-plugin-promise": "
|
|
68
|
-
"eslint-plugin-react": "7.
|
|
69
|
-
"eslint-plugin-react-hooks": "
|
|
70
|
-
"eslint-plugin-security": "^
|
|
71
|
-
"eslint-plugin-sonarjs": "^0.
|
|
72
|
-
"eslint-plugin-unused-imports": "
|
|
73
|
-
"
|
|
60
|
+
"eslint": "^9.25.1",
|
|
61
|
+
"eslint-config-prettier": "^10.1.2",
|
|
62
|
+
"eslint-plugin-cypress": "^4.3.0",
|
|
63
|
+
"eslint-plugin-import": "^2.31.0",
|
|
64
|
+
"eslint-plugin-jam3": "^0.2.3",
|
|
65
|
+
"eslint-plugin-json": "^4.0.1",
|
|
66
|
+
"eslint-plugin-prettier": "^5.2.6",
|
|
67
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
68
|
+
"eslint-plugin-react": "^7.37.5",
|
|
69
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
70
|
+
"eslint-plugin-security": "^3.0.1",
|
|
71
|
+
"eslint-plugin-sonarjs": "^3.0.2",
|
|
72
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
73
|
+
"globals": "^16.0.0",
|
|
74
74
|
"husky": "7.0.4",
|
|
75
75
|
"i18next": "21.7.0",
|
|
76
76
|
"jest": "27.5.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@bigbinary/neeto-cist": "^1.0.3",
|
|
91
91
|
"@bigbinary/neeto-commons-frontend": "4.12.3",
|
|
92
|
-
"eslint": "
|
|
92
|
+
"eslint": "^9.25.1",
|
|
93
93
|
"i18next": "21.7.0",
|
|
94
94
|
"ramda": "0.29.0"
|
|
95
95
|
}
|