eslint-plugin-nextfriday 1.10.0 → 1.10.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 +19 -0
- package/lib/index.cjs +17 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +143 -127
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# eslint-plugin-nextfriday
|
|
2
2
|
|
|
3
|
+
## 1.10.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#51](https://github.com/next-friday/eslint-plugin-nextfriday/pull/51) [`b940720`](https://github.com/next-friday/eslint-plugin-nextfriday/commit/b940720b356ee0bf0da0addac5bd4a35c20b4141) Thanks [@nextfridaydeveloper](https://github.com/nextfridaydeveloper)! - fix(newline-after-multiline-block): exclude import declarations from requiring blank lines between them
|
|
8
|
+
|
|
9
|
+
Multi-line imports followed by other imports no longer require a blank line, avoiding conflicts with `import-x/order` rule. Blank lines are still required when a multi-line import is followed by a non-import statement.
|
|
10
|
+
|
|
11
|
+
## 1.10.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#49](https://github.com/next-friday/eslint-plugin-nextfriday/pull/49) [`baecdc9`](https://github.com/next-friday/eslint-plugin-nextfriday/commit/baecdc9810eda995c0ced73bcf1536027feae2e6) Thanks [@nextfridaydeveloper](https://github.com/nextfridaydeveloper)! - fix(no-inline-nested-object): allow arrays with only primitive values to stay inline
|
|
16
|
+
|
|
17
|
+
Arrays containing only primitives (literals, identifiers, template literals) are now allowed to be inline. Objects still require multiple lines.
|
|
18
|
+
- `options: ["primary", "foreground", "danger"]` is now valid
|
|
19
|
+
- `config: { enabled: true }` still requires multiline
|
|
20
|
+
- `items: [{ a: 1 }, { b: 2 }]` still requires multiline
|
|
21
|
+
|
|
3
22
|
## 1.10.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/lib/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
40
40
|
// package.json
|
|
41
41
|
var package_default = {
|
|
42
42
|
name: "eslint-plugin-nextfriday",
|
|
43
|
-
version: "1.10.
|
|
43
|
+
version: "1.10.2",
|
|
44
44
|
description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
|
|
45
45
|
keywords: [
|
|
46
46
|
"eslint",
|
|
@@ -1049,6 +1049,13 @@ function getInnerExpression(node) {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
return node;
|
|
1051
1051
|
}
|
|
1052
|
+
function arrayContainsOnlyPrimitives(node) {
|
|
1053
|
+
return node.elements.every((el) => {
|
|
1054
|
+
if (el === null) return true;
|
|
1055
|
+
const inner = getInnerExpression(el);
|
|
1056
|
+
return inner.type === import_utils14.AST_NODE_TYPES.Literal || inner.type === import_utils14.AST_NODE_TYPES.Identifier || inner.type === import_utils14.AST_NODE_TYPES.TemplateLiteral || inner.type === import_utils14.AST_NODE_TYPES.UnaryExpression;
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1052
1059
|
var noInlineNestedObject = createRule14({
|
|
1053
1060
|
name: "no-inline-nested-object",
|
|
1054
1061
|
meta: {
|
|
@@ -1081,6 +1088,9 @@ var noInlineNestedObject = createRule14({
|
|
|
1081
1088
|
if (elements.length === 0) {
|
|
1082
1089
|
return;
|
|
1083
1090
|
}
|
|
1091
|
+
if (valueNode.type === import_utils14.AST_NODE_TYPES.ArrayExpression && arrayContainsOnlyPrimitives(valueNode)) {
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1084
1094
|
const isMultiline = valueNode.loc.start.line !== valueNode.loc.end.line;
|
|
1085
1095
|
if (isMultiline) {
|
|
1086
1096
|
return;
|
|
@@ -1366,6 +1376,9 @@ var import_utils20 = require("@typescript-eslint/utils");
|
|
|
1366
1376
|
var createRule18 = import_utils20.ESLintUtils.RuleCreator(
|
|
1367
1377
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1368
1378
|
);
|
|
1379
|
+
function isImportDeclaration(node) {
|
|
1380
|
+
return node.type === import_utils20.AST_NODE_TYPES.ImportDeclaration;
|
|
1381
|
+
}
|
|
1369
1382
|
function checkStatements(statements, context) {
|
|
1370
1383
|
const { sourceCode } = context;
|
|
1371
1384
|
statements.forEach((current, index) => {
|
|
@@ -1380,6 +1393,9 @@ function checkStatements(statements, context) {
|
|
|
1380
1393
|
if (!isMultiline) {
|
|
1381
1394
|
return;
|
|
1382
1395
|
}
|
|
1396
|
+
if (isImportDeclaration(current) && isImportDeclaration(next)) {
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1383
1399
|
const lineGap = next.loc.start.line - current.loc.end.line;
|
|
1384
1400
|
if (lineGap < 2) {
|
|
1385
1401
|
context.report({
|