eslint-plugin-nextfriday 4.3.1 → 4.3.2
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 +6 -0
- package/lib/index.cjs +25 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAwEM,IAAA;EAAA,SAGI,IAAA;EAAA,SAAA,OAAA;AAAA;AAAA,cAEJ,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAwEM,IAAA;EAAA,SAGI,IAAA;EAAA,SAAA,OAAA;AAAA;AAAA,cAEJ,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoOA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqBA,gBAAA;EAAA"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAwEM,IAAA;EAAA,SAGI,IAAA;EAAA,SAAA,OAAA;AAAA;AAAA,cAEJ,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAwEM,IAAA;EAAA,SAGI,IAAA;EAAA,SAAA,OAAA;AAAA;AAAA,cAEJ,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoOA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqBA,gBAAA;EAAA"}
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "path";
|
|
|
4
4
|
import emojiRegex from "emoji-regex";
|
|
5
5
|
//#region package.json
|
|
6
6
|
var name = "eslint-plugin-nextfriday";
|
|
7
|
-
var version = "4.3.
|
|
7
|
+
var version = "4.3.2";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/rules/boolean-naming-prefix.ts
|
|
10
10
|
const createRule$32 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
|
|
@@ -450,6 +450,7 @@ const enforceReadonlyComponentProps = ESLintUtils.RuleCreator((name) => `https:/
|
|
|
450
450
|
},
|
|
451
451
|
defaultOptions: [],
|
|
452
452
|
create(context) {
|
|
453
|
+
if (!isJsxFile(context.filename)) return {};
|
|
453
454
|
function hasJSXInConditional(node) {
|
|
454
455
|
return node.consequent.type === AST_NODE_TYPES.JSXElement || node.consequent.type === AST_NODE_TYPES.JSXFragment || node.alternate.type === AST_NODE_TYPES.JSXElement || node.alternate.type === AST_NODE_TYPES.JSXFragment;
|
|
455
456
|
}
|
|
@@ -869,6 +870,7 @@ const jsxNewlineBetweenElements = ESLintUtils.RuleCreator((name) => `https://git
|
|
|
869
870
|
},
|
|
870
871
|
defaultOptions: [],
|
|
871
872
|
create(context) {
|
|
873
|
+
if (!isJsxFile(context.filename)) return {};
|
|
872
874
|
const { sourceCode } = context;
|
|
873
875
|
function isSignificantJSXChild(node) {
|
|
874
876
|
return node.type === AST_NODE_TYPES.JSXElement || node.type === AST_NODE_TYPES.JSXFragment || node.type === AST_NODE_TYPES.JSXExpressionContainer;
|
|
@@ -1033,6 +1035,7 @@ const jsxNoInlineObjectProp = ESLintUtils.RuleCreator((name) => `https://github.
|
|
|
1033
1035
|
},
|
|
1034
1036
|
defaultOptions: [],
|
|
1035
1037
|
create(context) {
|
|
1038
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1036
1039
|
return { JSXAttribute(node) {
|
|
1037
1040
|
if (node.value?.type === AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === AST_NODE_TYPES.ObjectExpression) context.report({
|
|
1038
1041
|
node: node.value,
|
|
@@ -1061,6 +1064,7 @@ const jsxNoNewlineSingleLineElements = createRule$21({
|
|
|
1061
1064
|
},
|
|
1062
1065
|
defaultOptions: [],
|
|
1063
1066
|
create(context) {
|
|
1067
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1064
1068
|
const { sourceCode } = context;
|
|
1065
1069
|
function checkSiblings(children) {
|
|
1066
1070
|
const nonWhitespace = children.filter((child) => !(child.type === AST_NODE_TYPES.JSXText && child.value.trim() === ""));
|
|
@@ -1264,6 +1268,7 @@ const jsxNoTernaryNull = createRule$19({
|
|
|
1264
1268
|
},
|
|
1265
1269
|
defaultOptions: [],
|
|
1266
1270
|
create(context) {
|
|
1271
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1267
1272
|
return { JSXExpressionContainer(node) {
|
|
1268
1273
|
const { expression } = node;
|
|
1269
1274
|
if (expression.type !== AST_NODE_TYPES.ConditionalExpression) return;
|
|
@@ -1304,6 +1309,7 @@ const jsxNoVariableInCallback = ESLintUtils.RuleCreator((name) => `https://githu
|
|
|
1304
1309
|
},
|
|
1305
1310
|
defaultOptions: [],
|
|
1306
1311
|
create(context) {
|
|
1312
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1307
1313
|
function isInsideJSX(node) {
|
|
1308
1314
|
let current = node.parent;
|
|
1309
1315
|
while (current) {
|
|
@@ -1350,6 +1356,7 @@ const jsxRequireSuspense = ESLintUtils.RuleCreator((name) => `https://github.com
|
|
|
1350
1356
|
},
|
|
1351
1357
|
defaultOptions: [],
|
|
1352
1358
|
create(context) {
|
|
1359
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1353
1360
|
const lazyComponents = /* @__PURE__ */ new Set();
|
|
1354
1361
|
const isInsideSuspense = (node) => {
|
|
1355
1362
|
let current = node.parent;
|
|
@@ -1391,6 +1398,7 @@ const jsxSimpleProps = ESLintUtils.RuleCreator((name) => `https://github.com/nex
|
|
|
1391
1398
|
},
|
|
1392
1399
|
defaultOptions: [],
|
|
1393
1400
|
create(context) {
|
|
1401
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1394
1402
|
const allowedExpressionTypes = new Set([
|
|
1395
1403
|
AST_NODE_TYPES.Identifier,
|
|
1396
1404
|
AST_NODE_TYPES.Literal,
|
|
@@ -1510,6 +1518,7 @@ const jsxSortProps = createRule$18({
|
|
|
1510
1518
|
},
|
|
1511
1519
|
defaultOptions: [],
|
|
1512
1520
|
create(context) {
|
|
1521
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1513
1522
|
const { sourceCode } = context;
|
|
1514
1523
|
return { JSXOpeningElement(node) {
|
|
1515
1524
|
if (!hasUnsortedProps(node.attributes)) return;
|
|
@@ -1535,6 +1544,7 @@ const jsxSpreadPropsLast = ESLintUtils.RuleCreator((name) => `https://github.com
|
|
|
1535
1544
|
},
|
|
1536
1545
|
defaultOptions: [],
|
|
1537
1546
|
create(context) {
|
|
1547
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1538
1548
|
return { JSXOpeningElement(node) {
|
|
1539
1549
|
const { attributes } = node;
|
|
1540
1550
|
let lastNonSpreadIndex = -1;
|
|
@@ -1778,6 +1788,7 @@ const noGhostWrapper = createRule$16({
|
|
|
1778
1788
|
},
|
|
1779
1789
|
defaultOptions: [],
|
|
1780
1790
|
create(context) {
|
|
1791
|
+
if (!isJsxFile(context.filename)) return {};
|
|
1781
1792
|
return { JSXOpeningElement(node) {
|
|
1782
1793
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier) return;
|
|
1783
1794
|
const tagName = node.name.name;
|
|
@@ -1802,6 +1813,8 @@ const noHelperFunctionInHook = ESLintUtils.RuleCreator((name) => `https://github
|
|
|
1802
1813
|
},
|
|
1803
1814
|
defaultOptions: [],
|
|
1804
1815
|
create(context) {
|
|
1816
|
+
const basename = path.basename(context.filename);
|
|
1817
|
+
if (!(basename.endsWith(".hook.ts") || basename.endsWith(".hooks.ts"))) return {};
|
|
1805
1818
|
function isAtProgramLevel(node) {
|
|
1806
1819
|
const { parent } = node;
|
|
1807
1820
|
if (parent === void 0) return false;
|
|
@@ -1843,6 +1856,8 @@ const noHelperFunctionInTest = ESLintUtils.RuleCreator((name) => `https://github
|
|
|
1843
1856
|
},
|
|
1844
1857
|
defaultOptions: [],
|
|
1845
1858
|
create(context) {
|
|
1859
|
+
const basename = path.basename(context.filename);
|
|
1860
|
+
if (!(basename.endsWith(".test.ts") || basename.endsWith(".test.tsx"))) return {};
|
|
1846
1861
|
return {
|
|
1847
1862
|
FunctionDeclaration(node) {
|
|
1848
1863
|
if (node.parent.type === AST_NODE_TYPES.Program) context.report({
|
|
@@ -2385,6 +2400,7 @@ const noRedundantFragment = createRule$10({
|
|
|
2385
2400
|
},
|
|
2386
2401
|
defaultOptions: [],
|
|
2387
2402
|
create(context) {
|
|
2403
|
+
if (!isJsxFile(context.filename)) return {};
|
|
2388
2404
|
return {
|
|
2389
2405
|
JSXFragment(node) {
|
|
2390
2406
|
const count = countMeaningfulChildren(node.children);
|
|
@@ -2989,6 +3005,7 @@ const preferJSXTemplateLiterals = ESLintUtils.RuleCreator((name) => `https://git
|
|
|
2989
3005
|
},
|
|
2990
3006
|
defaultOptions: [],
|
|
2991
3007
|
create(context) {
|
|
3008
|
+
if (!isJsxFile(context.filename)) return {};
|
|
2992
3009
|
function handleTextBeforeExpression(textNode, exprNode) {
|
|
2993
3010
|
const textValue = textNode.value;
|
|
2994
3011
|
const trimmedText = textValue.trim();
|
|
@@ -3100,6 +3117,7 @@ const preferPropsWithChildren = ESLintUtils.RuleCreator((name) => `https://githu
|
|
|
3100
3117
|
},
|
|
3101
3118
|
defaultOptions: [],
|
|
3102
3119
|
create(context) {
|
|
3120
|
+
if (!isJsxFile(context.filename)) return {};
|
|
3103
3121
|
function isReactNodeType(typeNode) {
|
|
3104
3122
|
if (!typeNode) return false;
|
|
3105
3123
|
if (typeNode.type !== AST_NODE_TYPES.TSTypeReference) return false;
|
|
@@ -3148,6 +3166,7 @@ const preferReactImportTypes = ESLintUtils.RuleCreator((name) => `https://github
|
|
|
3148
3166
|
},
|
|
3149
3167
|
defaultOptions: [],
|
|
3150
3168
|
create(context) {
|
|
3169
|
+
if (!isJsxFile(context.filename)) return {};
|
|
3151
3170
|
const reactTypes = new Set([
|
|
3152
3171
|
"ReactNode",
|
|
3153
3172
|
"ReactElement",
|
|
@@ -3260,6 +3279,7 @@ const reactPropsDestructure = ESLintUtils.RuleCreator((name) => `https://github.
|
|
|
3260
3279
|
},
|
|
3261
3280
|
defaultOptions: [],
|
|
3262
3281
|
create(context) {
|
|
3282
|
+
if (!isJsxFile(context.filename)) return {};
|
|
3263
3283
|
function hasJSXInConditional(node) {
|
|
3264
3284
|
return node.consequent.type === AST_NODE_TYPES.JSXElement || node.consequent.type === AST_NODE_TYPES.JSXFragment || node.alternate.type === AST_NODE_TYPES.JSXElement || node.alternate.type === AST_NODE_TYPES.JSXFragment;
|
|
3265
3285
|
}
|
|
@@ -3765,6 +3785,8 @@ const baseRules = {
|
|
|
3765
3785
|
"nextfriday/no-direct-date": "warn",
|
|
3766
3786
|
"nextfriday/no-emoji": "warn",
|
|
3767
3787
|
"nextfriday/no-env-fallback": "warn",
|
|
3788
|
+
"nextfriday/no-helper-function-in-hook": "warn",
|
|
3789
|
+
"nextfriday/no-helper-function-in-test": "warn",
|
|
3768
3790
|
"nextfriday/no-inline-default-export": "warn",
|
|
3769
3791
|
"nextfriday/no-inline-nested-object": "warn",
|
|
3770
3792
|
"nextfriday/no-inline-return-properties": "warn",
|
|
@@ -3809,6 +3831,8 @@ const baseRecommendedRules = {
|
|
|
3809
3831
|
"nextfriday/no-direct-date": "error",
|
|
3810
3832
|
"nextfriday/no-emoji": "error",
|
|
3811
3833
|
"nextfriday/no-env-fallback": "error",
|
|
3834
|
+
"nextfriday/no-helper-function-in-hook": "error",
|
|
3835
|
+
"nextfriday/no-helper-function-in-test": "error",
|
|
3812
3836
|
"nextfriday/no-inline-default-export": "error",
|
|
3813
3837
|
"nextfriday/no-inline-nested-object": "error",
|
|
3814
3838
|
"nextfriday/no-inline-return-properties": "error",
|