@kikiutils/eslint-config 9.3.0 → 9.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/dist/{internals → _internals}/plugins.d.ts +0 -2
- package/dist/{internals → _internals}/plugins.d.ts.map +1 -1
- package/dist/{internals → _internals}/plugins.js +1 -2
- package/dist/_internals/plugins.js.map +1 -0
- package/dist/_internals/rules/compact-iteration-layout.d.ts +3 -0
- package/dist/_internals/rules/compact-iteration-layout.d.ts.map +1 -0
- package/dist/{internals → _internals}/rules/compact-iteration-layout.js +1 -2
- package/dist/_internals/rules/compact-iteration-layout.js.map +1 -0
- package/dist/_internals/rules/consistent-condition-layout.d.ts +3 -0
- package/dist/_internals/rules/consistent-condition-layout.d.ts.map +1 -0
- package/dist/{internals → _internals}/rules/consistent-condition-layout.js +1 -2
- package/dist/_internals/rules/consistent-condition-layout.js.map +1 -0
- package/dist/_internals/rules/consistent-parameter-layout.d.ts +3 -0
- package/dist/_internals/rules/consistent-parameter-layout.d.ts.map +1 -0
- package/dist/{internals → _internals}/rules/consistent-parameter-layout.js +1 -2
- package/dist/_internals/rules/consistent-parameter-layout.js.map +1 -0
- package/dist/_internals/rules/statement-padding.d.ts +3 -0
- package/dist/_internals/rules/statement-padding.d.ts.map +1 -0
- package/dist/{internals → _internals}/rules/statement-padding.js +1 -2
- package/dist/_internals/rules/statement-padding.js.map +1 -0
- package/dist/{internals → _internals}/utils.d.ts +0 -2
- package/dist/_internals/utils.d.ts.map +1 -0
- package/dist/{internals → _internals}/utils.js +1 -2
- package/dist/_internals/utils.js.map +1 -0
- package/dist/base.d.ts +0 -2
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +3 -3
- package/dist/base.js.map +1 -1
- package/dist/style.d.ts +0 -2
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +1 -2
- package/dist/vue.d.ts +0 -2
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +2 -3
- package/dist/vue.js.map +1 -1
- package/package.json +25 -49
- package/src/base.ts +2 -1
- package/src/vue.ts +1 -1
- package/dist/internals/plugins.js.map +0 -1
- package/dist/internals/rules/compact-iteration-layout.d.ts +0 -5
- package/dist/internals/rules/compact-iteration-layout.d.ts.map +0 -1
- package/dist/internals/rules/compact-iteration-layout.js.map +0 -1
- package/dist/internals/rules/consistent-condition-layout.d.ts +0 -5
- package/dist/internals/rules/consistent-condition-layout.d.ts.map +0 -1
- package/dist/internals/rules/consistent-condition-layout.js.map +0 -1
- package/dist/internals/rules/consistent-parameter-layout.d.ts +0 -5
- package/dist/internals/rules/consistent-parameter-layout.d.ts.map +0 -1
- package/dist/internals/rules/consistent-parameter-layout.js.map +0 -1
- package/dist/internals/rules/statement-padding.d.ts +0 -5
- package/dist/internals/rules/statement-padding.d.ts.map +0 -1
- package/dist/internals/rules/statement-padding.js.map +0 -1
- package/dist/internals/utils.d.ts.map +0 -1
- package/dist/internals/utils.js.map +0 -1
- /package/src/{internals → _internals}/plugins.ts +0 -0
- /package/src/{internals → _internals}/rules/compact-iteration-layout.ts +0 -0
- /package/src/{internals → _internals}/rules/consistent-condition-layout.ts +0 -0
- /package/src/{internals → _internals}/rules/consistent-parameter-layout.ts +0 -0
- /package/src/{internals → _internals}/rules/statement-padding.ts +0 -0
- /package/src/{internals → _internals}/utils.ts +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internals/plugins.d.ts
|
|
2
1
|
export declare const customPlugins: {
|
|
3
2
|
rules: {
|
|
4
3
|
'compact-iteration-layout': import("eslint").Rule.RuleModule;
|
|
@@ -7,5 +6,4 @@ export declare const customPlugins: {
|
|
|
7
6
|
'statement-padding': import("eslint").Rule.RuleModule;
|
|
8
7
|
};
|
|
9
8
|
};
|
|
10
|
-
//#endregion
|
|
11
9
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/_internals/plugins.ts"],"mappings":"A,qBAKa"}
|
|
@@ -2,14 +2,13 @@ import { compactIterationLayout } from "./rules/compact-iteration-layout.js";
|
|
|
2
2
|
import { consistentConditionLayout } from "./rules/consistent-condition-layout.js";
|
|
3
3
|
import { consistentParameterLayout } from "./rules/consistent-parameter-layout.js";
|
|
4
4
|
import { statementPadding } from "./rules/statement-padding.js";
|
|
5
|
-
|
|
5
|
+
// src/_internals/plugins.ts
|
|
6
6
|
const customPlugins = { rules: {
|
|
7
7
|
"compact-iteration-layout": compactIterationLayout,
|
|
8
8
|
"consistent-condition-layout": consistentConditionLayout,
|
|
9
9
|
"consistent-parameter-layout": consistentParameterLayout,
|
|
10
10
|
"statement-padding": statementPadding
|
|
11
11
|
} };
|
|
12
|
-
//#endregion
|
|
13
12
|
export { customPlugins };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","names":[],"sources":["../../src/_internals/plugins.ts"],"sourcesContent":["import { compactIterationLayout } from './rules/compact-iteration-layout';\nimport { consistentConditionLayout } from './rules/consistent-condition-layout';\nimport { consistentParameterLayout } from './rules/consistent-parameter-layout';\nimport { statementPadding } from './rules/statement-padding';\n\nexport const customPlugins = {\n rules: {\n 'compact-iteration-layout': compactIterationLayout,\n 'consistent-condition-layout': consistentConditionLayout,\n 'consistent-parameter-layout': consistentParameterLayout,\n 'statement-padding': statementPadding,\n },\n};\n"],"mappings":";;;;;AAKA,MAAa,gBAAgB,EACzB,OAAO;CACH,4BAA4B;CAC5B,+BAA+B;CAC/B,+BAA+B;CAC/B,qBAAqB;AACzB,EACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact-iteration-layout.d.ts","names":[],"sources":["../../../src/_internals/rules/compact-iteration-layout.ts"],"mappings":";qBAIa,wBAAwB,KAAK"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/_internals/rules/compact-iteration-layout.ts
|
|
2
2
|
const compactIterationLayout = {
|
|
3
3
|
create(context) {
|
|
4
4
|
const { sourceCode } = context;
|
|
@@ -29,7 +29,6 @@ const compactIterationLayout = {
|
|
|
29
29
|
type: "layout"
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
//#endregion
|
|
33
32
|
export { compactIterationLayout };
|
|
34
33
|
|
|
35
34
|
//# sourceMappingURL=compact-iteration-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact-iteration-layout.js","names":[],"sources":["../../../src/_internals/rules/compact-iteration-layout.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\ntype IterationNode = Extract<Rule.Node, { type: 'ForInStatement' | 'ForOfStatement' }>;\n\nexport const compactIterationLayout: Rule.RuleModule = {\n create(context) {\n const { sourceCode } = context;\n\n function checkParentheses(node: IterationNode): void {\n const openingParen = sourceCode.getFirstToken(node, (token) => token.value === '(')!;\n const closingParen = sourceCode.getTokenBefore(node.body)!;\n const next = sourceCode.getTokenAfter(openingParen)!;\n const previous = sourceCode.getTokenBefore(closingParen)!;\n const ranges: Array<[number, number]> = [];\n\n if (\n openingParen.loc.end.line !== next.loc.start.line\n && !sourceCode.commentsExistBetween(openingParen, next)\n ) {\n ranges.push([\n openingParen.range[1],\n next.range[0],\n ]);\n }\n\n if (\n previous.loc.end.line !== closingParen.loc.start.line\n && !sourceCode.commentsExistBetween(previous, closingParen)\n ) {\n ranges.push([\n previous.range[1],\n closingParen.range[0],\n ]);\n }\n\n if (ranges.length) {\n context.report({\n fix: (fixer) => ranges.map((range) => fixer.replaceTextRange(range, '')),\n messageId: 'compact',\n node,\n });\n }\n }\n\n return {\n ForInStatement: checkParentheses,\n ForOfStatement: checkParentheses,\n };\n },\n meta: {\n docs: { description: 'Keep for-in and for-of parentheses beside their header contents.' },\n fixable: 'whitespace',\n messages: { compact: 'Keep iteration parentheses on the same lines as their adjacent header contents.' },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";AAIA,MAAa,yBAA0C;CACnD,OAAO,SAAS;EACZ,MAAM,EAAE,eAAe;EAEvB,SAAS,iBAAiB,MAA2B;GACjD,MAAM,eAAe,WAAW,cAAc,OAAO,UAAU,MAAM,UAAU,GAAG;GAClF,MAAM,eAAe,WAAW,eAAe,KAAK,IAAI;GACxD,MAAM,OAAO,WAAW,cAAc,YAAY;GAClD,MAAM,WAAW,WAAW,eAAe,YAAY;GACvD,MAAM,SAAkC,CAAC;GAEzC,IACI,aAAa,IAAI,IAAI,SAAS,KAAK,IAAI,MAAM,QAC1C,CAAC,WAAW,qBAAqB,cAAc,IAAI,GAEtD,OAAO,KAAK,CACR,aAAa,MAAM,IACnB,KAAK,MAAM,EACf,CAAC;GAGL,IACI,SAAS,IAAI,IAAI,SAAS,aAAa,IAAI,MAAM,QAC9C,CAAC,WAAW,qBAAqB,UAAU,YAAY,GAE1D,OAAO,KAAK,CACR,SAAS,MAAM,IACf,aAAa,MAAM,EACvB,CAAC;GAGL,IAAI,OAAO,QACP,QAAQ,OAAO;IACX,MAAM,UAAU,OAAO,KAAK,UAAU,MAAM,iBAAiB,OAAO,EAAE,CAAC;IACvE,WAAW;IACX;GACJ,CAAC;EAET;EAEA,OAAO;GACH,gBAAgB;GAChB,gBAAgB;EACpB;CACJ;CACA,MAAM;EACF,MAAM,EAAE,aAAa,mEAAmE;EACxF,SAAS;EACT,UAAU,EAAE,SAAS,kFAAkF;EACvG,QAAQ,CAAC;EACT,MAAM;CACV;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consistent-condition-layout.d.ts","names":[],"sources":["../../../src/_internals/rules/consistent-condition-layout.ts"],"mappings":";qBAUa,2BAA2B,KAAK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineScriptAndTemplateVisitors } from "../utils.js";
|
|
2
|
-
|
|
2
|
+
// src/_internals/rules/consistent-condition-layout.ts
|
|
3
3
|
const consistentConditionLayout = {
|
|
4
4
|
create(context) {
|
|
5
5
|
function createVisitor(tokenStore) {
|
|
@@ -80,7 +80,6 @@ const consistentConditionLayout = {
|
|
|
80
80
|
type: "layout"
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
//#endregion
|
|
84
83
|
export { consistentConditionLayout };
|
|
85
84
|
|
|
86
85
|
//# sourceMappingURL=consistent-condition-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consistent-condition-layout.js","names":[],"sources":["../../../src/_internals/rules/consistent-condition-layout.ts"],"sourcesContent":["import type {\n AST,\n Rule,\n} from 'eslint';\n\nimport type { TokenStore } from '../utils';\nimport { defineScriptAndTemplateVisitors } from '../utils';\n\ntype LogicalNode = Extract<Rule.Node, { type: 'LogicalExpression' }>;\n\nexport const consistentConditionLayout: Rule.RuleModule = {\n create(context) {\n function createVisitor(tokenStore: TokenStore): Rule.RuleListener {\n const checkedOpeningOffsets = new Set<number>();\n\n function collectOperators(node: LogicalNode['left'], operators: AST.Token[]): void {\n if (node.type !== 'LogicalExpression' || (node.operator !== '&&' && node.operator !== '||')) return;\n const operator = tokenStore.getTokensBetween(node.left, node.right)\n .find((token) => token.type === 'Punctuator' && token.value === node.operator)!;\n\n function collectChild(child: LogicalNode['left']): void {\n const before = tokenStore.getTokenBefore(child);\n const after = tokenStore.getTokenAfter(child);\n if (\n before?.value === '('\n && after?.value === ')'\n && before.range[0] >= node.range![0]\n && after.range[1] <= node.range![1]\n ) return;\n\n collectOperators(child, operators);\n }\n\n collectChild(node.left);\n operators.push(operator);\n collectChild(node.right);\n }\n\n function checkParentheses(node: LogicalNode['left']): void {\n let openingParen = tokenStore.getTokenBefore(node);\n let closingParen = tokenStore.getTokenAfter(node);\n let operators: AST.Token[] | undefined;\n const newlineOffsets: number[] = [];\n while (openingParen?.value === '(' && closingParen?.value === ')') {\n if (\n !checkedOpeningOffsets.has(openingParen.range[0])\n && openingParen.loc.start.line !== closingParen.loc.end.line\n ) {\n checkedOpeningOffsets.add(openingParen.range[0]);\n if (!operators) {\n operators = [];\n collectOperators(node, operators);\n }\n\n const next = tokenStore.getTokenAfter(openingParen)!;\n if (openingParen.loc.end.line === next.loc.start.line) {\n newlineOffsets.push(openingParen.range[1]);\n }\n\n for (const operator of operators) {\n if (tokenStore.getTokenBefore(operator)!.loc.end.line === operator.loc.start.line) {\n newlineOffsets.push(operator.range[0]);\n }\n }\n\n if (tokenStore.getTokenBefore(closingParen)!.loc.end.line === closingParen.loc.start.line) {\n newlineOffsets.push(closingParen.range[0]);\n }\n }\n\n openingParen = tokenStore.getTokenBefore(openingParen);\n closingParen = tokenStore.getTokenAfter(closingParen);\n // An outer pair contains one grouped item, not the inner logical chain.\n operators = [];\n }\n\n if (newlineOffsets.length) {\n context.report({\n fix: (fixer) => newlineOffsets.map((offset) => fixer.insertTextBeforeRange(\n [\n offset,\n offset,\n ],\n '\\n',\n )),\n messageId: 'newline',\n node,\n });\n }\n }\n\n return {\n BinaryExpression: (node) => {\n if (\n [\n '!=',\n '!==',\n '<',\n '<=',\n '==',\n '===',\n '>',\n '>=',\n 'in',\n 'instanceof',\n ].includes(node.operator)\n ) checkParentheses(node);\n },\n DoWhileStatement: (node) => checkParentheses(node.test),\n IfStatement: (node) => checkParentheses(node.test),\n LogicalExpression: (node) => {\n if (node.operator === '&&' || node.operator === '||') checkParentheses(node);\n },\n UnaryExpression: (node) => {\n if (node.operator === '!') checkParentheses(node);\n },\n WhileStatement: (node) => checkParentheses(node.test),\n };\n }\n\n return defineScriptAndTemplateVisitors(context.sourceCode, createVisitor);\n },\n meta: {\n docs: { description: 'Expand multiline parenthesized conditions one logical item per line.' },\n fixable: 'whitespace',\n messages: { newline: 'Put each logical item and both parentheses on separate lines in a multiline condition.' },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";;AAUA,MAAa,4BAA6C;CACtD,OAAO,SAAS;EACZ,SAAS,cAAc,YAA2C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IAAI,MAAM,MACzE,eAAe,KAAK,SAAS,MAAM,EAAE;MAI7C,IAAI,WAAW,eAAe,YAAY,CAAC,CAAE,IAAI,IAAI,SAAS,aAAa,IAAI,MAAM,MACjF,eAAe,KAAK,aAAa,MAAM,EAAE;KAEjD;KAEA,eAAe,WAAW,eAAe,YAAY;KACrD,eAAe,WAAW,cAAc,YAAY;KAEpD,YAAY,CAAC;IACjB;IAEA,IAAI,eAAe,QACf,QAAQ,OAAO;KACX,MAAM,UAAU,eAAe,KAAK,WAAW,MAAM,sBACjD,CACI,QACA,MACJ,GACA,IACJ,CAAC;KACD,WAAW;KACX;IACJ,CAAC;GAET;GAEA,OAAO;IACH,mBAAmB,SAAS;KACxB,IACI;MACI;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACJ,CAAC,CAAC,SAAS,KAAK,QAAQ,GAC1B,iBAAiB,IAAI;IAC3B;IACA,mBAAmB,SAAS,iBAAiB,KAAK,IAAI;IACtD,cAAc,SAAS,iBAAiB,KAAK,IAAI;IACjD,oBAAoB,SAAS;KACzB,IAAI,KAAK,aAAa,QAAQ,KAAK,aAAa,MAAM,iBAAiB,IAAI;IAC/E;IACA,kBAAkB,SAAS;KACvB,IAAI,KAAK,aAAa,KAAK,iBAAiB,IAAI;IACpD;IACA,iBAAiB,SAAS,iBAAiB,KAAK,IAAI;GACxD;EACJ;EAEA,OAAO,gCAAgC,QAAQ,YAAY,aAAa;CAC5E;CACA,MAAM;EACF,MAAM,EAAE,aAAa,uEAAuE;EAC5F,SAAS;EACT,UAAU,EAAE,SAAS,yFAAyF;EAC9G,QAAQ,CAAC;EACT,MAAM;CACV;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consistent-parameter-layout.d.ts","names":[],"sources":["../../../src/_internals/rules/consistent-parameter-layout.ts"],"mappings":";qBAaa,2BAA2B,KAAK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineScriptAndTemplateVisitors } from "../utils.js";
|
|
2
|
-
|
|
2
|
+
// src/_internals/rules/consistent-parameter-layout.ts
|
|
3
3
|
const consistentParameterLayout = {
|
|
4
4
|
create(context) {
|
|
5
5
|
const isTestFile = /\.test\.[jt]sx?$/.test(context.filename);
|
|
@@ -85,7 +85,6 @@ const consistentParameterLayout = {
|
|
|
85
85
|
type: "layout"
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
//#endregion
|
|
89
88
|
export { consistentParameterLayout };
|
|
90
89
|
|
|
91
90
|
//# sourceMappingURL=consistent-parameter-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consistent-parameter-layout.js","names":[],"sources":["../../../src/_internals/rules/consistent-parameter-layout.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\nimport type { TokenStore } from '../utils';\nimport { defineScriptAndTemplateVisitors } from '../utils';\n\ntype CallNode = Extract<Rule.Node, { type: 'CallExpression' | 'NewExpression' }> & { typeArguments?: Rule.Node };\ntype FunctionNode = Extract<\n Rule.Node,\n { type: 'ArrowFunctionExpression' | 'FunctionDeclaration' | 'FunctionExpression' }\n>;\n\ntype ListItem = CallNode['arguments'][number] | FunctionNode['params'][number];\n\nexport const consistentParameterLayout: Rule.RuleModule = {\n create(context) {\n const isTestFile = /\\.test\\.[jt]sx?$/.test(context.filename);\n\n function checkParameterLayout(\n node: Rule.Node,\n items: readonly ListItem[],\n tokenStore: TokenStore,\n isTemplate: boolean,\n ): void {\n const first = items[0];\n if (!first) return;\n const isSingleParameter = items.length === 1;\n\n // JSX argument layout belongs to the JSX formatting rules.\n const firstType: string = first.type;\n if (isSingleParameter && (firstType === 'JSXElement' || firstType === 'JSXFragment')) return;\n let openingParen;\n if (node.type === 'CallExpression' || node.type === 'NewExpression') {\n const call = node as CallNode;\n openingParen = tokenStore.getTokenAfter(\n call.typeArguments ?? call.callee,\n (token) => token.type === 'Punctuator' && token.value === '(',\n );\n } else {\n openingParen = tokenStore.getTokenBefore(first);\n }\n\n if (!openingParen || openingParen.value !== '(') return;\n // An unparenthesized arrow must not borrow its parent's delimiters.\n if (openingParen.range[0] < node.range![0]) return;\n const closingParen = node.type === 'CallExpression' || node.type === 'NewExpression'\n ? tokenStore.getLastToken(node)\n : tokenStore.getTokenAfter(items.at(-1)!, (token) => token.value === ')');\n\n const next = tokenStore.getTokenAfter(openingParen)!;\n\n if (isSingleParameter) {\n if (!closingParen || closingParen.value !== ')') return;\n let previous = tokenStore.getTokenBefore(closingParen)!;\n if (previous.value === ',') previous = tokenStore.getTokenBefore(previous)!;\n if (\n tokenStore.commentsExistBetween(openingParen, next)\n || tokenStore.commentsExistBetween(previous, closingParen)\n ) return;\n\n const hasOpeningNewline = openingParen.loc.end.line !== next.loc.start.line;\n const hasClosingNewline = tokenStore.getTokenBefore(closingParen)!.loc.end.line\n !== closingParen.loc.start.line;\n\n if (hasOpeningNewline === hasClosingNewline) return;\n\n context.report({\n fix: (fixer) => hasOpeningNewline\n ? fixer.insertTextBefore(closingParen, '\\n')\n : fixer.insertTextAfter(openingParen, '\\n'),\n messageId: 'singleBoundary',\n node,\n });\n\n return;\n }\n\n if (!closingParen || openingParen.loc.start.line === closingParen.loc.end.line) return;\n\n if (isTemplate) {\n // Script list formatters do not traverse Vue template expressions.\n const newlineOffsets: number[] = [];\n if (openingParen.loc.end.line === next.loc.start.line) newlineOffsets.push(openingParen.range[1]);\n for (let index = 1; index < items.length; index++) {\n const item = items[index]!;\n const comma = tokenStore.getTokensBetween(items[index - 1]!, item)\n .find((token) => token.value === ',');\n\n if (comma && comma.loc.end.line === tokenStore.getTokenAfter(comma)!.loc.start.line) {\n newlineOffsets.push(comma.range[1]);\n }\n }\n\n if (\n closingParen.value === ')'\n && tokenStore.getTokenBefore(closingParen)!.loc.end.line === closingParen.loc.start.line\n ) newlineOffsets.push(closingParen.range[0]);\n\n if (newlineOffsets.length) {\n context.report({\n fix: (fixer) => newlineOffsets.map((offset) => fixer.insertTextAfterRange(\n [\n offset,\n offset,\n ],\n '\\n',\n )),\n messageId: 'newline',\n node: first,\n });\n }\n\n return;\n }\n\n if (openingParen.loc.end.line !== next.loc.start.line) return;\n\n context.report({\n fix: (fixer) => fixer.insertTextAfter(openingParen, '\\n'),\n messageId: 'newline',\n node: first,\n });\n }\n\n function createVisitor(tokenStore: TokenStore, isTemplate: boolean): Rule.RuleListener {\n return {\n ArrowFunctionExpression: (node) => checkParameterLayout(node, node.params, tokenStore, isTemplate),\n CallExpression: (node) => {\n const { callee } = node;\n if (isTestFile) {\n const target = callee.type === 'MemberExpression'\n && !callee.computed\n && callee.property.type === 'Identifier'\n && callee.property.name === 'concurrent'\n ? callee.object\n : callee;\n\n if (\n target.type === 'Identifier'\n && (target.name === 'describe' || target.name === 'it')\n ) return;\n }\n\n checkParameterLayout(node, node.arguments, tokenStore, isTemplate);\n },\n FunctionDeclaration: (node) => checkParameterLayout(node, node.params, tokenStore, isTemplate),\n FunctionExpression: (node) => checkParameterLayout(node, node.params, tokenStore, isTemplate),\n NewExpression: (node) => checkParameterLayout(node, node.arguments, tokenStore, isTemplate),\n };\n }\n\n return defineScriptAndTemplateVisitors(context.sourceCode, createVisitor);\n },\n meta: {\n docs: { description: 'Preserve consistent single-parameter boundaries and expand multiline parameter lists.' },\n fixable: 'whitespace',\n messages: {\n newline: 'Start a multiline parameter list on a new line.',\n singleBoundary: 'Use matching newline boundaries around a single parameter.',\n },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";;AAaA,MAAa,4BAA6C;CACtD,OAAO,SAAS;EACZ,MAAM,aAAa,mBAAmB,KAAK,QAAQ,QAAQ;EAE3D,SAAS,qBACL,MACA,OACA,YACA,YACI;GACJ,MAAM,QAAQ,MAAM;GACpB,IAAI,CAAC,OAAO;GACZ,MAAM,oBAAoB,MAAM,WAAW;GAG3C,MAAM,YAAoB,MAAM;GAChC,IAAI,sBAAsB,cAAc,gBAAgB,cAAc,gBAAgB;GACtF,IAAI;GACJ,IAAI,KAAK,SAAS,oBAAoB,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AAK,QAAQ,YAAY,UAAU;IAC5F,gBAAgB,SAAS,qBAAqB,MAAM,KAAK,WAAW,YAAY,UAAU;GAC9F;EACJ;EAEA,OAAO,gCAAgC,QAAQ,YAAY,aAAa;CAC5E;CACA,MAAM;EACF,MAAM,EAAE,aAAa,wFAAwF;EAC7G,SAAS;EACT,UAAU;GACN,SAAS;GACT,gBAAgB;EACpB;EACA,QAAQ,CAAC;EACT,MAAM;CACV;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement-padding.d.ts","names":[],"sources":["../../../src/_internals/rules/statement-padding.ts"],"mappings":";qBAIa,kBAAkB,KAAK"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/_internals/rules/statement-padding.ts
|
|
2
2
|
const statementPadding = {
|
|
3
3
|
create(context) {
|
|
4
4
|
const { sourceCode } = context;
|
|
@@ -54,7 +54,6 @@ const statementPadding = {
|
|
|
54
54
|
type: "layout"
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
//#endregion
|
|
58
57
|
export { statementPadding };
|
|
59
58
|
|
|
60
59
|
//# sourceMappingURL=statement-padding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement-padding.js","names":[],"sources":["../../../src/_internals/rules/statement-padding.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\ntype StatementNode = Extract<Rule.Node, { type: 'Program' }>['body'][number];\n\nexport const statementPadding: Rule.RuleModule = {\n create(context) {\n const { sourceCode } = context;\n\n function checkStatements(statements: readonly StatementNode[]): void {\n for (let index = 1; index < statements.length; index++) {\n const previous = statements[index - 1]!;\n const next = statements[index]!;\n const lastToken = sourceCode.getLastToken(previous)!;\n const firstToken = sourceCode.getFirstToken(next)!;\n const closingLine = sourceCode.lines[lastToken.loc.end.line - 1]!;\n const openingLine = sourceCode.lines[firstToken.loc.start.line - 1]!;\n const hasDifferentIndent = /^\\s*/.exec(closingLine)![0] !== /^\\s*/.exec(openingLine)![0];\n const hasStandaloneClosing = /^[)\\]}]+;?$/.test(closingLine.slice(0, lastToken.loc.end.column).trim());\n const blockNode = previous.type === 'ExportDefaultDeclaration'\n || previous.type === 'ExportNamedDeclaration'\n ? previous.declaration\n : previous;\n\n const hasBlockClosing = lastToken.value === '}' && blockNode && [\n 'BlockStatement',\n 'ClassDeclaration',\n 'ForInStatement',\n 'ForOfStatement',\n 'ForStatement',\n 'FunctionDeclaration',\n 'IfStatement',\n 'LabeledStatement',\n 'SwitchStatement',\n 'TryStatement',\n 'WhileStatement',\n 'WithStatement',\n ].includes(blockNode.type);\n\n if (!hasDifferentIndent && !hasStandaloneClosing && !hasBlockClosing) continue;\n const comments = sourceCode.getCommentsBefore(next);\n if (\n sourceCode\n .lines\n .slice(lastToken.loc.end.line, firstToken.loc.start.line - 1)\n .some((line, index) => !line.trim() && !comments.some((comment) =>\n comment.loc!.start.line <= lastToken.loc.end.line + index + 1\n && comment.loc!.end.line >= lastToken.loc.end.line + index + 1))\n ) continue;\n\n // Keep leading comments attached to the next statement and trailing comments in place.\n const boundary = comments\n .find((comment) => comment.loc!.start.line > lastToken.loc.end.line) ?? firstToken;\n\n const offset = boundary.loc!.start.line > lastToken.loc.end.line\n ? boundary.range![0] - boundary.loc!.start.column\n : boundary.range![0];\n\n context.report({\n fix: (fixer) => fixer.insertTextBeforeRange(\n [\n offset,\n offset,\n ],\n boundary.loc!.start.line === lastToken.loc.end.line ? '\\n\\n' : '\\n',\n ),\n messageId: 'blankLine',\n node: next,\n });\n }\n }\n\n return {\n BlockStatement: (node) => checkStatements(node.body),\n Program: (node) => checkStatements(node.body),\n StaticBlock: (node) => checkStatements(node.body),\n SwitchCase: (node) => checkStatements(node.consequent),\n };\n },\n meta: {\n docs: { description: 'Separate statements after closing lines, blocks, or indentation changes.' },\n fixable: 'whitespace',\n messages: { blankLine: 'Add a blank line between these complete statements.' },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";AAIA,MAAa,m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IAAI,IAAI,IAAI,KAAK;IAE5E,MAAM,SAAS,SAAS,IAAK,MAAM,OAAO,UAAU,IAAI,IAAI,OACtD,SAAS,MAAO,KAAK,SAAS,IAAK,MAAM,SACzC,SAAS,MAAO;IAEtB,QAAQ,OAAO;KACX,MAAM,UAAU,MAAM,sBAClB,CACI,QACA,MACJ,GACA,SAAS,IAAK,MAAM,SAAS,UAAU,IAAI,IAAI,OAAO,SAAS,IACnE;KACA,WAAW;KACX,MAAM;IACV,CAAC;GACL;EACJ;EAEA,OAAO;GACH,iBAAiB,SAAS,gBAAgB,KAAK,IAAI;GACnD,UAAU,SAAS,gBAAgB,KAAK,IAAI;GAC5C,cAAc,SAAS,gBAAgB,KAAK,IAAI;GAChD,aAAa,SAAS,gBAAgB,KAAK,UAAU;EACzD;CACJ;CACA,MAAM;EACF,MAAM,EAAE,aAAa,2EAA2E;EAChG,SAAS;EACT,UAAU,EAAE,WAAW,sDAAsD;EAC7E,QAAQ,CAAC;EACT,MAAM;CACV;AACJ"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Rule, SourceCode } from "eslint";
|
|
2
|
-
//#region src/internals/utils.d.ts
|
|
3
2
|
export type TokenStore = Pick<SourceCode, 'commentsExistBetween' | 'getLastToken' | 'getTokenAfter' | 'getTokenBefore' | 'getTokensBetween'>;
|
|
4
3
|
export declare function defineScriptAndTemplateVisitors(sourceCode: SourceCode, createVisitor: (tokenStore: TokenStore, isTemplate: boolean) => Rule.RuleListener): Rule.RuleListener;
|
|
5
|
-
//#endregion
|
|
6
4
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/_internals/utils.ts"],"mappings":";YAKY,aAAa,KACrB;wBAaY,gCACZ,YAAY,YACZ,gBAAgB,YAAY,YAAY,wBAAwB,KAAK,eACtE,KAAK"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// src/_internals/utils.ts
|
|
2
2
|
function defineScriptAndTemplateVisitors(sourceCode, createVisitor) {
|
|
3
3
|
const scriptVisitor = createVisitor(sourceCode, false);
|
|
4
4
|
const parserServices = sourceCode.parserServices;
|
|
5
5
|
if (!parserServices.defineTemplateBodyVisitor || !parserServices.getTemplateBodyTokenStore) return scriptVisitor;
|
|
6
6
|
return parserServices.defineTemplateBodyVisitor(createVisitor(parserServices.getTemplateBodyTokenStore(), true), scriptVisitor);
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { defineScriptAndTemplateVisitors };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/_internals/utils.ts"],"sourcesContent":["import type {\n Rule,\n SourceCode,\n} from 'eslint';\n\nexport type TokenStore = Pick<\n SourceCode,\n 'commentsExistBetween' | 'getLastToken' | 'getTokenAfter' | 'getTokenBefore' | 'getTokensBetween'\n>;\n\ninterface TemplateParserServices {\n defineTemplateBodyVisitor?: (\n templateVisitor: Rule.RuleListener,\n scriptVisitor: Rule.RuleListener,\n ) => Rule.RuleListener;\n\n getTemplateBodyTokenStore?: () => TokenStore;\n}\n\nexport function defineScriptAndTemplateVisitors(\n sourceCode: SourceCode,\n createVisitor: (tokenStore: TokenStore, isTemplate: boolean) => Rule.RuleListener,\n): Rule.RuleListener {\n const scriptVisitor = createVisitor(sourceCode, false);\n const parserServices = sourceCode.parserServices as TemplateParserServices;\n if (!parserServices.defineTemplateBodyVisitor || !parserServices.getTemplateBodyTokenStore) return scriptVisitor;\n\n return parserServices.defineTemplateBodyVisitor(\n createVisitor(parserServices.getTemplateBodyTokenStore(), true),\n scriptVisitor,\n );\n}\n"],"mappings":";AAmBA,SAAgB,gCACZ,YACA,eACiB;CACjB,MAAM,gBAAgB,cAAc,YAAY,KAAK;CACrD,MAAM,iBAAiB,WAAW;CAClC,IAAI,CAAC,eAAe,6BAA6B,CAAC,eAAe,2BAA2B,OAAO;CAEnG,OAAO,eAAe,0BAClB,cAAc,eAAe,0BAA0B,GAAG,IAAI,GAC9D,aACJ;AACJ"}
|
package/dist/base.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Rules, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
2
|
-
//#region src/base.d.ts
|
|
3
2
|
export declare function createBaseConfigs(environment?: 'bun' | 'node'): TypedFlatConfigItem[];
|
|
4
3
|
export declare function createBaseRules(environment?: 'bun' | 'node'): Rules;
|
|
5
|
-
//#endregion
|
|
6
4
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","names":[],"sources":["../src/base.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":[],"sources":["../src/base.ts"],"mappings":";wBAgBgB,kBAAkB,+BAAuC;wBA+EzD,gBAAgB,+BAAuC"}
|
package/dist/base.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { customPlugins } from "./
|
|
1
|
+
import { customPlugins } from "./_internals/plugins.js";
|
|
2
2
|
import promise from "eslint-plugin-promise";
|
|
3
|
-
|
|
3
|
+
// src/base.ts
|
|
4
4
|
const basePerfectionistSortOptions = {
|
|
5
5
|
ignoreCase: false,
|
|
6
6
|
type: "natural"
|
|
@@ -66,6 +66,7 @@ function createBaseRules(environment = "node") {
|
|
|
66
66
|
"antfu/curly": "off",
|
|
67
67
|
"antfu/if-newline": "off",
|
|
68
68
|
"antfu/no-top-level-await": "off",
|
|
69
|
+
"antfu/reasonable-newline": "off",
|
|
69
70
|
"arrow-body-style": ["error", "as-needed"],
|
|
70
71
|
"curly": ["error", "multi-line"],
|
|
71
72
|
"kikiutils/compact-iteration-layout": "error",
|
|
@@ -209,7 +210,6 @@ function createBaseRules(environment = "node") {
|
|
|
209
210
|
"style/semi": ["error", "always"]
|
|
210
211
|
};
|
|
211
212
|
}
|
|
212
|
-
//#endregion
|
|
213
213
|
export { createBaseConfigs, createBaseRules };
|
|
214
214
|
|
|
215
215
|
//# sourceMappingURL=base.js.map
|
package/dist/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":[],"sources":["../src/base.ts"],"sourcesContent":["import type {\n Rules,\n TypedFlatConfigItem,\n} from '@antfu/eslint-config';\n// @ts-expect-error No declare file.\nimport promise from 'eslint-plugin-promise';\n\nimport { customPlugins } from './internals/plugins';\n\n// Constants/Variables\nconst basePerfectionistSortOptions = {\n ignoreCase: false,\n type: 'natural',\n} as const;\n\n// Functions\nexport function createBaseConfigs(environment: 'bun' | 'node' = 'node'): TypedFlatConfigItem[] {\n return [\n // All files\n {\n rules: {\n 'e18e/ban-dependencies': [\n 'error',\n {\n allowed: [\n 'axios',\n 'rimraf',\n ],\n },\n ],\n 'e18e/prefer-static-regex': ['off'],\n },\n },\n // JavaScript\n {\n files: ['**/*.{cjs,js,mjs}'],\n plugins: {\n kikiutils: customPlugins,\n promise,\n },\n rules: {\n ...createBaseRules(environment),\n 'node/prefer-global/process': [\n 'error',\n 'always',\n ],\n },\n },\n // TypeScript\n {\n files: ['**/*.{ts,tsx}'],\n plugins: {\n kikiutils: customPlugins,\n promise,\n },\n rules: {\n ...createBaseRules(environment),\n 'node/prefer-global/process': [\n 'error',\n 'always',\n ],\n 'ts/consistent-generic-constructors': [\n 'error',\n 'constructor',\n ],\n 'ts/no-redeclare': 'off',\n },\n },\n // VsCode jsonc\n {\n files: ['**/.vscode/*.json'],\n rules: {\n 'jsonc/sort-array-values': [\n 'error',\n {\n order: {\n natural: true,\n type: 'asc',\n },\n pathPattern: '^.*$',\n },\n ],\n 'jsonc/sort-keys': [\n 'error',\n 'asc',\n {\n caseSensitive: true,\n natural: true,\n },\n ],\n },\n },\n ];\n}\n\nexport function createBaseRules(environment: 'bun' | 'node' = 'node'): Rules {\n return {\n 'antfu/consistent-list-newline': [\n 'error',\n {\n ArrayExpression: false,\n ArrayPattern: false,\n },\n ],\n 'antfu/curly': 'off',\n 'antfu/if-newline': 'off',\n 'antfu/no-top-level-await': 'off',\n 'arrow-body-style': [\n 'error',\n 'as-needed',\n ],\n 'curly': [\n 'error',\n 'multi-line',\n ],\n 'kikiutils/compact-iteration-layout': 'error',\n 'kikiutils/consistent-condition-layout': 'error',\n 'kikiutils/consistent-parameter-layout': 'error',\n 'kikiutils/statement-padding': 'error',\n 'max-classes-per-file': [\n 'error',\n 1,\n ],\n 'no-promise-executor-return': [\n 'error',\n { allowVoid: true },\n ],\n 'perfectionist/sort-array-includes': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-enums': [\n 'error',\n {\n ...basePerfectionistSortOptions,\n sortByValue: 'never',\n },\n ],\n 'perfectionist/sort-heritage-clauses': [\n 'error',\n {\n ignoreCase: false,\n type: 'natural',\n },\n ],\n 'perfectionist/sort-imports': [\n 'error',\n {\n environment,\n groups: [\n 'side-effect',\n 'side-effect-style',\n 'style',\n [\n 'value-builtin',\n 'type-builtin',\n ],\n [\n 'value-external',\n 'type-external',\n ],\n [\n 'value-internal',\n 'type-internal',\n ],\n [\n 'value-parent',\n 'type-parent',\n ],\n [\n 'value-sibling',\n 'type-sibling',\n ],\n [\n 'value-index',\n 'type-index',\n ],\n 'unknown',\n ],\n ignoreCase: false,\n internalPattern: [\n '^#.*',\n '^@/.*',\n '^~/.*',\n ],\n type: 'natural',\n },\n ],\n 'perfectionist/sort-interfaces': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-intersection-types': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-maps': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-modules': [\n 'error',\n {\n ...basePerfectionistSortOptions,\n groups: [\n 'declare-type',\n [\n 'export-type',\n 'type',\n ],\n 'declare-interface',\n [\n 'export-interface',\n 'interface',\n ],\n 'declare-enum',\n [\n 'enum',\n 'export-enum',\n ],\n 'declare-class',\n [\n 'class',\n 'export-class',\n ],\n 'declare-function',\n [\n 'export-function',\n 'function',\n ],\n ],\n },\n ],\n 'perfectionist/sort-object-types': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-objects': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-sets': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-switch-case': [\n 'error',\n {\n ignoreCase: false,\n type: 'natural',\n },\n ],\n 'perfectionist/sort-union-types': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-variable-declarations': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'promise/no-multiple-resolved': 'error',\n 'promise/no-return-in-finally': 'error',\n 'promise/no-return-wrap': 'error',\n 'require-await': 'error',\n 'style/array-bracket-newline': [\n 'error',\n { multiline: true },\n ],\n 'style/array-element-newline': [\n 'error',\n {\n ArrayExpression: {\n consistent: true,\n minItems: 2,\n },\n ArrayPattern: { minItems: 3 },\n },\n ],\n 'style/arrow-parens': [\n 'error',\n 'always',\n ],\n 'style/brace-style': [\n 'error',\n '1tbs',\n { allowSingleLine: false },\n ],\n 'style/function-call-spacing': [\n 'error',\n 'never',\n ],\n 'style/indent': [\n 'error',\n 4,\n ],\n 'style/max-len': [\n 'warn',\n {\n code: 120,\n comments: 120,\n },\n ],\n 'style/member-delimiter-style': [\n 'error',\n {\n multiline: {\n delimiter: 'semi',\n requireLast: true,\n },\n },\n ],\n 'style/no-extra-parens': [\n 'error',\n 'all',\n { nestedBinaryExpressions: false },\n ],\n 'style/no-extra-semi': 'error',\n 'style/object-curly-newline': [\n 'error',\n {\n ExportDeclaration: {\n minProperties: 2,\n multiline: true,\n },\n ImportDeclaration: {\n minProperties: 2,\n multiline: true,\n },\n ObjectExpression: {\n minProperties: 2,\n multiline: true,\n },\n ObjectPattern: {\n minProperties: 3,\n multiline: true,\n },\n },\n ],\n 'style/operator-linebreak': [\n 'error',\n 'before',\n { overrides: { '=': 'after' } },\n ],\n 'style/padding-line-between-statements': [\n 'error',\n {\n blankLine: 'always',\n next: [\n 'class',\n 'enum',\n 'function',\n ],\n prev: '*',\n },\n {\n blankLine: 'always',\n next: '*',\n prev: [\n 'class',\n 'function',\n ],\n },\n ],\n 'style/semi': [\n 'error',\n 'always',\n ],\n };\n}\n"],"mappings":";;;AAUA,MAAM,+BAA+B;CACjC,YAAY;CACZ,MAAM;AACV;AAGA,SAAgB,kBAAkB,cAA8B,QAA+B;CAC3F,OAAO;EAEH,EACI,OAAO;GACH,yBAAyB,CACrB,SACA,EACI,SAAS,CACL,SACA,QACJ,EACJ,CACJ;GACA,4BAA4B,CAAC,KAAK;EACtC,EACJ;EAEA;GACI,OAAO,CAAC,mBAAmB;GAC3B,SAAS;IACL,WAAW;IACX;GACJ;GACA,OAAO;IACH,GAAG,gBAAgB,WAAW;IAC9B,8BAA8B,CAC1B,SACA,QACJ;GACJ;EACJ;EAEA;GACI,OAAO,CAAC,eAAe;GACvB,SAAS;IACL,WAAW;IACX;GACJ;GACA,OAAO;IACH,GAAG,gBAAgB,WAAW;IAC9B,8BAA8B,CAC1B,SACA,QACJ;IACA,sCAAsC,CAClC,SACA,aACJ;IACA,mBAAmB;GACvB;EACJ;EAEA;GACI,OAAO,CAAC,mBAAmB;GAC3B,OAAO;IACH,2BAA2B,CACvB,SACA;KACI,OAAO;MACH,SAAS;MACT,MAAM;KACV;KACA,aAAa;IACjB,CACJ;IACA,mBAAmB;KACf;KACA;KACA;MACI,eAAe;MACf,SAAS;KACb;IACJ;GACJ;EACJ;CACJ;AACJ;AAEA,SAAgB,gBAAgB,cAA8B,QAAe;CACzE,OAAO;EACH,iCAAiC,CAC7B,SACA;GACI,iBAAiB;GACjB,cAAc;EAClB,CACJ;EACA,eAAe;EACf,oBAAoB;EACpB,4BAA4B;EAC5B,oBAAoB,CAChB,SACA,WACJ;EACA,SAAS,CACL,SACA,YACJ;EACA,sCAAsC;EACtC,yCAAyC;EACzC,yCAAyC;EACzC,+BAA+B;EAC/B,wBAAwB,CACpB,SACA,CACJ;EACA,8BAA8B,CAC1B,SACA,EAAE,WAAW,KAAK,CACtB;EACA,qCAAqC,CACjC,SACA,4BACJ;EACA,4BAA4B,CACxB,SACA;GACI,GAAG;GACH,aAAa;EACjB,CACJ;EACA,uCAAuC,CACnC,SACA;GACI,YAAY;GACZ,MAAM;EACV,CACJ;EACA,8BAA8B,CAC1B,SACA;GACI;GACA,QAAQ;IACJ;IACA;IACA;IACA,CACI,iBACA,cACJ;IACA,CACI,kBACA,eACJ;IACA,CACI,kBACA,eACJ;IACA,CACI,gBACA,aACJ;IACA,CACI,iBACA,cACJ;IACA,CACI,eACA,YACJ;IACA;GACJ;GACA,YAAY;GACZ,iBAAiB;IACb;IACA;IACA;GACJ;GACA,MAAM;EACV,CACJ;EACA,iCAAiC,CAC7B,SACA,4BACJ;EACA,yCAAyC,CACrC,SACA,4BACJ;EACA,2BAA2B,CACvB,SACA,4BACJ;EACA,8BAA8B,CAC1B,SACA;GACI,GAAG;GACH,QAAQ;IACJ;IACA,CACI,eACA,MACJ;IACA;IACA,CACI,oBACA,WACJ;IACA;IACA,CACI,QACA,aACJ;IACA;IACA,CACI,SACA,cACJ;IACA;IACA,CACI,mBACA,UACJ;GACJ;EACJ,CACJ;EACA,mCAAmC,CAC/B,SACA,4BACJ;EACA,8BAA8B,CAC1B,SACA,4BACJ;EACA,2BAA2B,CACvB,SACA,4BACJ;EACA,kCAAkC,CAC9B,SACA;GACI,YAAY;GACZ,MAAM;EACV,CACJ;EACA,kCAAkC,CAC9B,SACA,4BACJ;EACA,4CAA4C,CACxC,SACA,4BACJ;EACA,gCAAgC;EAChC,gCAAgC;EAChC,0BAA0B;EAC1B,iBAAiB;EACjB,+BAA+B,CAC3B,SACA,EAAE,WAAW,KAAK,CACtB;EACA,+BAA+B,CAC3B,SACA;GACI,iBAAiB;IACb,YAAY;IACZ,UAAU;GACd;GACA,cAAc,EAAE,UAAU,EAAE;EAChC,CACJ;EACA,sBAAsB,CAClB,SACA,QACJ;EACA,qBAAqB;GACjB;GACA;GACA,EAAE,iBAAiB,MAAM;EAC7B;EACA,+BAA+B,CAC3B,SACA,OACJ;EACA,gBAAgB,CACZ,SACA,CACJ;EACA,iBAAiB,CACb,QACA;GACI,MAAM;GACN,UAAU;EACd,CACJ;EACA,gCAAgC,CAC5B,SACA,EACI,WAAW;GACP,WAAW;GACX,aAAa;EACjB,EACJ,CACJ;EACA,yBAAyB;GACrB;GACA;GACA,EAAE,yBAAyB,MAAM;EACrC;EACA,uBAAuB;EACvB,8BAA8B,CAC1B,SACA;GACI,mBAAmB;IACf,eAAe;IACf,WAAW;GACf;GACA,mBAAmB;IACf,eAAe;IACf,WAAW;GACf;GACA,kBAAkB;IACd,eAAe;IACf,WAAW;GACf;GACA,eAAe;IACX,eAAe;IACf,WAAW;GACf;EACJ,CACJ;EACA,4BAA4B;GACxB;GACA;GACA,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE;EAClC;EACA,yCAAyC;GACrC;GACA;IACI,WAAW;IACX,MAAM;KACF;KACA;KACA;IACJ;IACA,MAAM;GACV;GACA;IACI,WAAW;IACX,MAAM;IACN,MAAM,CACF,SACA,UACJ;GACJ;EACJ;EACA,cAAc,CACV,SACA,QACJ;CACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"base.js","names":[],"sources":["../src/base.ts"],"sourcesContent":["import type {\n Rules,\n TypedFlatConfigItem,\n} from '@antfu/eslint-config';\n// @ts-expect-error No declare file.\nimport promise from 'eslint-plugin-promise';\n\nimport { customPlugins } from './_internals/plugins';\n\n// Constants/Variables\nconst basePerfectionistSortOptions = {\n ignoreCase: false,\n type: 'natural',\n} as const;\n\n// Functions\nexport function createBaseConfigs(environment: 'bun' | 'node' = 'node'): TypedFlatConfigItem[] {\n return [\n // All files\n {\n rules: {\n 'e18e/ban-dependencies': [\n 'error',\n {\n allowed: [\n 'axios',\n 'rimraf',\n ],\n },\n ],\n 'e18e/prefer-static-regex': ['off'],\n },\n },\n // JavaScript\n {\n files: ['**/*.{cjs,js,mjs}'],\n plugins: {\n kikiutils: customPlugins,\n promise,\n },\n rules: {\n ...createBaseRules(environment),\n 'node/prefer-global/process': [\n 'error',\n 'always',\n ],\n },\n },\n // TypeScript\n {\n files: ['**/*.{ts,tsx}'],\n plugins: {\n kikiutils: customPlugins,\n promise,\n },\n rules: {\n ...createBaseRules(environment),\n 'node/prefer-global/process': [\n 'error',\n 'always',\n ],\n 'ts/consistent-generic-constructors': [\n 'error',\n 'constructor',\n ],\n 'ts/no-redeclare': 'off',\n },\n },\n // VsCode jsonc\n {\n files: ['**/.vscode/*.json'],\n rules: {\n 'jsonc/sort-array-values': [\n 'error',\n {\n order: {\n natural: true,\n type: 'asc',\n },\n pathPattern: '^.*$',\n },\n ],\n 'jsonc/sort-keys': [\n 'error',\n 'asc',\n {\n caseSensitive: true,\n natural: true,\n },\n ],\n },\n },\n ];\n}\n\nexport function createBaseRules(environment: 'bun' | 'node' = 'node'): Rules {\n return {\n 'antfu/consistent-list-newline': [\n 'error',\n {\n ArrayExpression: false,\n ArrayPattern: false,\n },\n ],\n 'antfu/curly': 'off',\n 'antfu/if-newline': 'off',\n 'antfu/no-top-level-await': 'off',\n 'antfu/reasonable-newline': 'off',\n 'arrow-body-style': [\n 'error',\n 'as-needed',\n ],\n 'curly': [\n 'error',\n 'multi-line',\n ],\n 'kikiutils/compact-iteration-layout': 'error',\n 'kikiutils/consistent-condition-layout': 'error',\n 'kikiutils/consistent-parameter-layout': 'error',\n 'kikiutils/statement-padding': 'error',\n 'max-classes-per-file': [\n 'error',\n 1,\n ],\n 'no-promise-executor-return': [\n 'error',\n { allowVoid: true },\n ],\n 'perfectionist/sort-array-includes': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-enums': [\n 'error',\n {\n ...basePerfectionistSortOptions,\n sortByValue: 'never',\n },\n ],\n 'perfectionist/sort-heritage-clauses': [\n 'error',\n {\n ignoreCase: false,\n type: 'natural',\n },\n ],\n 'perfectionist/sort-imports': [\n 'error',\n {\n environment,\n groups: [\n 'side-effect',\n 'side-effect-style',\n 'style',\n [\n 'value-builtin',\n 'type-builtin',\n ],\n [\n 'value-external',\n 'type-external',\n ],\n [\n 'value-internal',\n 'type-internal',\n ],\n [\n 'value-parent',\n 'type-parent',\n ],\n [\n 'value-sibling',\n 'type-sibling',\n ],\n [\n 'value-index',\n 'type-index',\n ],\n 'unknown',\n ],\n ignoreCase: false,\n internalPattern: [\n '^#.*',\n '^@/.*',\n '^~/.*',\n ],\n type: 'natural',\n },\n ],\n 'perfectionist/sort-interfaces': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-intersection-types': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-maps': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-modules': [\n 'error',\n {\n ...basePerfectionistSortOptions,\n groups: [\n 'declare-type',\n [\n 'export-type',\n 'type',\n ],\n 'declare-interface',\n [\n 'export-interface',\n 'interface',\n ],\n 'declare-enum',\n [\n 'enum',\n 'export-enum',\n ],\n 'declare-class',\n [\n 'class',\n 'export-class',\n ],\n 'declare-function',\n [\n 'export-function',\n 'function',\n ],\n ],\n },\n ],\n 'perfectionist/sort-object-types': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-objects': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-sets': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-switch-case': [\n 'error',\n {\n ignoreCase: false,\n type: 'natural',\n },\n ],\n 'perfectionist/sort-union-types': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'perfectionist/sort-variable-declarations': [\n 'error',\n basePerfectionistSortOptions,\n ],\n 'promise/no-multiple-resolved': 'error',\n 'promise/no-return-in-finally': 'error',\n 'promise/no-return-wrap': 'error',\n 'require-await': 'error',\n 'style/array-bracket-newline': [\n 'error',\n { multiline: true },\n ],\n 'style/array-element-newline': [\n 'error',\n {\n ArrayExpression: {\n consistent: true,\n minItems: 2,\n },\n ArrayPattern: { minItems: 3 },\n },\n ],\n 'style/arrow-parens': [\n 'error',\n 'always',\n ],\n 'style/brace-style': [\n 'error',\n '1tbs',\n { allowSingleLine: false },\n ],\n 'style/function-call-spacing': [\n 'error',\n 'never',\n ],\n 'style/indent': [\n 'error',\n 4,\n ],\n 'style/max-len': [\n 'warn',\n {\n code: 120,\n comments: 120,\n },\n ],\n 'style/member-delimiter-style': [\n 'error',\n {\n multiline: {\n delimiter: 'semi',\n requireLast: true,\n },\n },\n ],\n 'style/no-extra-parens': [\n 'error',\n 'all',\n { nestedBinaryExpressions: false },\n ],\n 'style/no-extra-semi': 'error',\n 'style/object-curly-newline': [\n 'error',\n {\n ExportDeclaration: {\n minProperties: 2,\n multiline: true,\n },\n ImportDeclaration: {\n minProperties: 2,\n multiline: true,\n },\n ObjectExpression: {\n minProperties: 2,\n multiline: true,\n },\n ObjectPattern: {\n minProperties: 3,\n multiline: true,\n },\n },\n ],\n 'style/operator-linebreak': [\n 'error',\n 'before',\n { overrides: { '=': 'after' } },\n ],\n 'style/padding-line-between-statements': [\n 'error',\n {\n blankLine: 'always',\n next: [\n 'class',\n 'enum',\n 'function',\n ],\n prev: '*',\n },\n {\n blankLine: 'always',\n next: '*',\n prev: [\n 'class',\n 'function',\n ],\n },\n ],\n 'style/semi': [\n 'error',\n 'always',\n ],\n };\n}\n"],"mappings":";;;AAUA,MAAM,+BAA+B;CACjC,YAAY;CACZ,MAAM;AACV;AAGA,SAAgB,kBAAkB,cAA8B,QAA+B;CAC3F,OAAO;EAEH,EACI,OAAO;GACH,yBAAyB,CACrB,SACA,EACI,SAAS,CACL,SACA,QACJ,EACJ,CACJ;GACA,4BAA4B,CAAC,KAAK;EACtC,EACJ;EAEA;GACI,OAAO,CAAC,mBAAmB;GAC3B,SAAS;IACL,WAAW;IACX;GAC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ACJ;GACA,MAAM;EACV,CACJ;EACA,iCAAiC,CAC7B,SACA,4BACJ;EACA,yCAAyC,CACrC,SACA,4BACJ;EACA,2BAA2B,CACvB,SACA,4BACJ;EACA,8BAA8B,CAC1B,SACA;GACI,GAAG;GACH,QAAQ;IACJ;IACA,CACI,eACA,MACJ;IACA;IACA,CACI,oBACA,WACJ;IACA;IACA,CACI,QACA,aACJ;IACA;IACA,CACI,SACA,cACJ;IACA;IACA,CACI,mBACA,UACJ;GACJ;EACJ,CACJ;EACA,mCAAmC,CAC/B,SACA,4BACJ;EACA,8BAA8B,CAC1B,SACA,4BACJ;EACA,2BAA2B,CACvB,SACA,4BACJ;EACA,kCAAkC,CAC9B,SACA;GACI,YAAY;GACZ,MAAM;EACV,CACJ;EACA,kCAAkC,CAC9B,SACA,4BACJ;EACA,4CAA4C,CACxC,SACA,4BACJ;EACA,gCAAgC;EAChC,gCAAgC;EAChC,0BAA0B;EAC1B,iBAAiB;EACjB,+BAA+B,CAC3B,SACA,EAAE,WAAW,KAAK,CACtB;EACA,+BAA+B,CAC3B,SACA;GACI,iBAAiB;IACb,YAAY;IACZ,UAAU;GACd;GACA,cAAc,EAAE,UAAU,EAAE;EAChC,CACJ;EACA,sBAAsB,CAClB,SACA,QACJ;EACA,qBAAqB;GACjB;GACA;GACA,EAAE,iBAAiB,MAAM;EAC7B;EACA,+BAA+B,CAC3B,SACA,OACJ;EACA,gBAAgB,CACZ,SACA,CACJ;EACA,iBAAiB,CACb,QACA;GACI,MAAM;GACN,UAAU;EACd,CACJ;EACA,gCAAgC,CAC5B,SACA,EACI,WAAW;GACP,WAAW;GACX,aAAa;EACjB,EACJ,CACJ;EACA,yBAAyB;GACrB;GACA;GACA,EAAE,yBAAyB,MAAM;EACrC;EACA,uBAAuB;EACvB,8BAA8B,CAC1B,SACA;GACI,mBAAmB;IACf,eAAe;IACf,WAAW;GACf;GACA,mBAAmB;IACf,eAAe;IACf,WAAW;GACf;GACA,kBAAkB;IACd,eAAe;IACf,WAAW;GACf;GACA,eAAe;IACX,eAAe;IACf,WAAW;GACf;EACJ,CACJ;EACA,4BAA4B;GACxB;GACA;GACA,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE;EAClC;EACA,yCAAyC;GACrC;GACA;IACI,WAAW;IACX,MAAM;KACF;KACA;KACA;IACJ;IACA,MAAM;GACV;GACA;IACI,WAAW;IACX,MAAM;IACN,MAAM,CACF,SACA,UACJ;GACJ;EACJ;EACA,cAAc,CACV,SACA,QACJ;CACJ;AACJ"}
|
package/dist/style.d.ts
CHANGED
package/dist/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","names":[],"sources":["../src/style.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.d.ts","names":[],"sources":["../src/style.ts"],"mappings":";wBAsBgB,2BAA2B"}
|
package/dist/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import format from "eslint-plugin-format";
|
|
2
|
-
|
|
2
|
+
// src/style.ts
|
|
3
3
|
function createPrettierCssConfig(parser) {
|
|
4
4
|
return {
|
|
5
5
|
files: [`**/*.${parser}`],
|
|
@@ -20,7 +20,6 @@ function createStyleFilesConfigs() {
|
|
|
20
20
|
createPrettierCssConfig("scss")
|
|
21
21
|
];
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { createStyleFilesConfigs };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=style.js.map
|
package/dist/vue.d.ts
CHANGED
package/dist/vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"mappings":";wBASgB,gBAAgB,+BAAuC"}
|
package/dist/vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { customPlugins } from "./
|
|
1
|
+
import { customPlugins } from "./_internals/plugins.js";
|
|
2
2
|
import { createBaseRules } from "./base.js";
|
|
3
3
|
import promise from "eslint-plugin-promise";
|
|
4
4
|
import kikiutilsEslintPluginVue from "@kikiutils/eslint-plugin-vue";
|
|
5
5
|
import betteTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
6
|
-
|
|
6
|
+
// src/vue.ts
|
|
7
7
|
function createVueConfig(environment = "node") {
|
|
8
8
|
return {
|
|
9
9
|
files: ["**/*.vue"],
|
|
@@ -66,7 +66,6 @@ function createVueConfig(environment = "node") {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
//#endregion
|
|
70
69
|
export { createVueConfig };
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=vue.js.map
|
package/dist/vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.js","names":[],"sources":["../src/vue.ts"],"sourcesContent":["import type { TypedFlatConfigItem } from '@antfu/eslint-config';\nimport kikiutilsEslintPluginVue from '@kikiutils/eslint-plugin-vue';\nimport betteTailwindcss from 'eslint-plugin-better-tailwindcss';\n// @ts-expect-error No declare file.\nimport promise from 'eslint-plugin-promise';\n\nimport {
|
|
1
|
+
{"version":3,"file":"vue.js","names":[],"sources":["../src/vue.ts"],"sourcesContent":["import type { TypedFlatConfigItem } from '@antfu/eslint-config';\nimport kikiutilsEslintPluginVue from '@kikiutils/eslint-plugin-vue';\nimport betteTailwindcss from 'eslint-plugin-better-tailwindcss';\n// @ts-expect-error No declare file.\nimport promise from 'eslint-plugin-promise';\n\nimport { customPlugins } from './_internals/plugins';\nimport { createBaseRules } from './base';\n\nexport function createVueConfig(environment: 'bun' | 'node' = 'node'): TypedFlatConfigItem {\n return {\n files: ['**/*.vue'],\n plugins: {\n '@kikiutils/vue': kikiutilsEslintPluginVue,\n 'better-tailwindcss': betteTailwindcss,\n 'kikiutils': customPlugins,\n promise,\n },\n rules: {\n ...createBaseRules(environment),\n '@kikiutils/vue/attributes-order': [\n 'error',\n {\n alphabetical: true,\n alphabeticalEnhanced: true,\n },\n ],\n '@kikiutils/vue/class-hex-color-case': 'error',\n 'better-tailwindcss/enforce-consistent-class-order': 'error',\n 'better-tailwindcss/enforce-consistent-important-position': 'error',\n 'better-tailwindcss/enforce-consistent-variable-syntax': 'error',\n 'better-tailwindcss/enforce-consistent-variant-order': 'error',\n 'better-tailwindcss/enforce-shorthand-classes': 'error',\n 'better-tailwindcss/no-deprecated-classes': 'warn',\n 'better-tailwindcss/no-duplicate-classes': 'error',\n 'better-tailwindcss/no-unnecessary-whitespace': 'error',\n 'style/max-len': 'off',\n 'vue/attribute-hyphenation': 'error',\n 'vue/attributes-order': 'off',\n 'vue/block-order': [\n 'error',\n {\n order: [\n 'template',\n 'script',\n 'style',\n ],\n },\n ],\n 'vue/component-api-style': 'error',\n 'vue/define-emits-declaration': 'error',\n 'vue/define-props-declaration': 'error',\n 'vue/enforce-style-attribute': 'error',\n 'vue/html-closing-bracket-newline': 'error',\n 'vue/html-closing-bracket-spacing': 'error',\n 'vue/html-indent': [\n 'error',\n 4,\n ],\n 'vue/max-attributes-per-line': [\n 'error',\n {\n multiline: 1,\n singleline: 1,\n },\n ],\n 'vue/max-len': [\n 'warn',\n {\n code: 120,\n comments: 120,\n template: 120,\n },\n ],\n 'vue/no-dupe-keys': 'error',\n 'vue/no-lone-template': 'error',\n 'vue/no-multi-spaces': 'error',\n 'vue/no-multiple-objects-in-class': 'error',\n 'vue/no-root-v-if': 'error',\n 'vue/no-template-target-blank': 'error',\n 'vue/no-v-html': 'error',\n 'vue/prefer-define-options': 'error',\n 'vue/prefer-separate-static-class': 'error',\n 'vue/require-explicit-emits': 'error',\n 'vue/require-typed-ref': 'error',\n },\n };\n}\n"],"mappings":";;;;;;AASA,SAAgB,gBAAgB,cAA8B,QAA6B;CACvF,OAAO;EACH,OAAO,CAAC,UAAU;EAClB,SAAS;GACL,kBAAkB;GAClB,sBAAsB;GACtB,aAAa;GACb;EACJ;EACA,OAAO;GACH,GAAG,gBAAgB,WAAW;GAC9B,mCAAmC,CAC/B,SACA;IACI,cAAc;IACd,sBAAsB;GAC1B,CACJ;GACA,uCAAuC;GACvC,qDAAqD;GACrD,4DAA4D;GAC5D,yDAAyD;GACzD,uDAAuD;GACvD,gDAAgD;GAChD,4CAA4C;GAC5C,2CAA2C;GAC3C,gDAAgD;GAChD,iBAAiB;GACjB,6BAA6B;GAC7B,wBAAwB;GACxB,mBAAmB,CACf,SACA,EACI,OAAO;IACH;IACA;IACA;GACJ,EACJ,CACJ;GACA,2BAA2B;GAC3B,gCAAgC;GAChC,gCAAgC;GAChC,+BAA+B;GAC/B,oCAAoC;GACpC,oCAAoC;GACpC,mBAAmB,CACf,SACA,CACJ;GACA,+BAA+B,CAC3B,SACA;IACI,WAAW;IACX,YAAY;GAChB,CACJ;GACA,eAAe,CACX,QACA;IACI,MAAM;IACN,UAAU;IACV,UAAU;GACd,CACJ;GACA,oBAAoB;GACpB,wBAAwB;GACxB,uBAAuB;GACvB,oCAAoC;GACpC,oBAAoB;GACpB,gCAAgC;GAChC,iBAAiB;GACjB,6BAA6B;GAC7B,oCAAoC;GACpC,8BAA8B;GAC9B,yBAAyB;EAC7B;CACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kikiutils/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.3.
|
|
4
|
+
"version": "9.3.2",
|
|
5
5
|
"description": "Using antfu/eslint-config as a base for eslint-config, slightly modified the settings and added additional plugins, mainly for my own use.",
|
|
6
6
|
"author": "kiki-kanri",
|
|
7
7
|
"license": "MIT",
|
|
@@ -12,32 +12,32 @@
|
|
|
12
12
|
"keywords": [],
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"exports": {
|
|
15
|
-
"./
|
|
15
|
+
"./_internals/plugins": {
|
|
16
16
|
"types": null,
|
|
17
17
|
"import": null,
|
|
18
18
|
"require": null
|
|
19
19
|
},
|
|
20
|
-
"./
|
|
20
|
+
"./_internals/rules/compact-iteration-layout": {
|
|
21
21
|
"types": null,
|
|
22
22
|
"import": null,
|
|
23
23
|
"require": null
|
|
24
24
|
},
|
|
25
|
-
"./
|
|
25
|
+
"./_internals/rules/consistent-condition-layout": {
|
|
26
26
|
"types": null,
|
|
27
27
|
"import": null,
|
|
28
28
|
"require": null
|
|
29
29
|
},
|
|
30
|
-
"./
|
|
30
|
+
"./_internals/rules/consistent-parameter-layout": {
|
|
31
31
|
"types": null,
|
|
32
32
|
"import": null,
|
|
33
33
|
"require": null
|
|
34
34
|
},
|
|
35
|
-
"./
|
|
35
|
+
"./_internals/rules/statement-padding": {
|
|
36
36
|
"types": null,
|
|
37
37
|
"import": null,
|
|
38
38
|
"require": null
|
|
39
39
|
},
|
|
40
|
-
"./
|
|
40
|
+
"./_internals/utils": {
|
|
41
41
|
"types": null,
|
|
42
42
|
"import": null,
|
|
43
43
|
"require": null
|
|
@@ -66,64 +66,40 @@
|
|
|
66
66
|
"typecheck": "tsc -b --noEmit"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@antfu/eslint-config": "^
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"@kikiutils/eslint-plugin-vue": "^10.10.0",
|
|
73
|
-
"eslint": ">=9.0.0",
|
|
74
|
-
"eslint-plugin-better-tailwindcss": "^4.7.0",
|
|
75
|
-
"eslint-plugin-format": ">=2.0.1",
|
|
76
|
-
"tailwind-csstree": "^0.4.0",
|
|
77
|
-
"tailwindcss": ">=4.3.3",
|
|
78
|
-
"vue-eslint-parser": "^10.4.1"
|
|
69
|
+
"@antfu/eslint-config": "^10.0.0",
|
|
70
|
+
"eslint": "^10.13.0",
|
|
71
|
+
"tailwindcss": "^4.3.3"
|
|
79
72
|
},
|
|
80
73
|
"peerDependenciesMeta": {
|
|
81
|
-
"@eslint/css": {
|
|
82
|
-
"optional": true
|
|
83
|
-
},
|
|
84
|
-
"@html-eslint/parser": {
|
|
85
|
-
"optional": true
|
|
86
|
-
},
|
|
87
|
-
"@kikiutils/eslint-plugin-vue": {
|
|
88
|
-
"optional": true
|
|
89
|
-
},
|
|
90
74
|
"eslint": {
|
|
91
75
|
"optional": true
|
|
92
76
|
},
|
|
93
|
-
"eslint-plugin-better-tailwindcss": {
|
|
94
|
-
"optional": true
|
|
95
|
-
},
|
|
96
|
-
"eslint-plugin-format": {
|
|
97
|
-
"optional": true
|
|
98
|
-
},
|
|
99
|
-
"tailwind-csstree": {
|
|
100
|
-
"optional": true
|
|
101
|
-
},
|
|
102
77
|
"tailwindcss": {
|
|
103
78
|
"optional": true
|
|
104
|
-
},
|
|
105
|
-
"vue-eslint-parser": {
|
|
106
|
-
"optional": true
|
|
107
79
|
}
|
|
108
80
|
},
|
|
109
81
|
"dependencies": {
|
|
110
|
-
"eslint
|
|
82
|
+
"@eslint/css": "^2.0.1",
|
|
83
|
+
"@html-eslint/parser": "^0.67.0",
|
|
84
|
+
"@kikiutils/eslint-plugin-vue": "^10.10.0",
|
|
85
|
+
"eslint-plugin-better-tailwindcss": "^4.10.0",
|
|
86
|
+
"eslint-plugin-format": "^2.0.1",
|
|
87
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
88
|
+
"tailwind-csstree": "^0.4.1",
|
|
89
|
+
"vue-eslint-parser": "^10.4.1"
|
|
111
90
|
},
|
|
112
91
|
"devDependencies": {
|
|
113
|
-
"@antfu/eslint-config": "^
|
|
114
|
-
"@kikiutils/eslint-config": "^9.2.1",
|
|
92
|
+
"@antfu/eslint-config": "^10.0.0",
|
|
115
93
|
"@kikiutils/tsconfigs": "^7.0.0",
|
|
116
|
-
"@types/node": "^26.6.
|
|
117
|
-
"@vitest/coverage-v8": "^5.0.
|
|
94
|
+
"@types/node": "^26.6.5",
|
|
95
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
118
96
|
"changelogen": "^0.6.2",
|
|
119
|
-
"eslint": "^10.
|
|
120
|
-
"
|
|
121
|
-
"eslint-plugin-format": "^2.0.1",
|
|
122
|
-
"knip": "^6.39.0",
|
|
97
|
+
"eslint": "^10.13.0",
|
|
98
|
+
"knip": "^6.43.0",
|
|
123
99
|
"publint": "^0.3.25",
|
|
124
|
-
"tsdown": "^0.23.
|
|
100
|
+
"tsdown": "^0.23.2",
|
|
125
101
|
"typescript": "^6.0.3",
|
|
126
102
|
"unplugin-unused": "^0.6.0",
|
|
127
|
-
"vitest": "^5.0.
|
|
103
|
+
"vitest": "^5.0.5"
|
|
128
104
|
}
|
|
129
105
|
}
|
package/src/base.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
// @ts-expect-error No declare file.
|
|
6
6
|
import promise from 'eslint-plugin-promise';
|
|
7
7
|
|
|
8
|
-
import { customPlugins } from './
|
|
8
|
+
import { customPlugins } from './_internals/plugins';
|
|
9
9
|
|
|
10
10
|
// Constants/Variables
|
|
11
11
|
const basePerfectionistSortOptions = {
|
|
@@ -105,6 +105,7 @@ export function createBaseRules(environment: 'bun' | 'node' = 'node'): Rules {
|
|
|
105
105
|
'antfu/curly': 'off',
|
|
106
106
|
'antfu/if-newline': 'off',
|
|
107
107
|
'antfu/no-top-level-await': 'off',
|
|
108
|
+
'antfu/reasonable-newline': 'off',
|
|
108
109
|
'arrow-body-style': [
|
|
109
110
|
'error',
|
|
110
111
|
'as-needed',
|
package/src/vue.ts
CHANGED
|
@@ -4,8 +4,8 @@ import betteTailwindcss from 'eslint-plugin-better-tailwindcss';
|
|
|
4
4
|
// @ts-expect-error No declare file.
|
|
5
5
|
import promise from 'eslint-plugin-promise';
|
|
6
6
|
|
|
7
|
+
import { customPlugins } from './_internals/plugins';
|
|
7
8
|
import { createBaseRules } from './base';
|
|
8
|
-
import { customPlugins } from './internals/plugins';
|
|
9
9
|
|
|
10
10
|
export function createVueConfig(environment: 'bun' | 'node' = 'node'): TypedFlatConfigItem {
|
|
11
11
|
return {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","names":[],"sources":["../../src/internals/plugins.ts"],"sourcesContent":["import { compactIterationLayout } from './rules/compact-iteration-layout';\nimport { consistentConditionLayout } from './rules/consistent-condition-layout';\nimport { consistentParameterLayout } from './rules/consistent-parameter-layout';\nimport { statementPadding } from './rules/statement-padding';\n\nexport const customPlugins = {\n rules: {\n 'compact-iteration-layout': compactIterationLayout,\n 'consistent-condition-layout': consistentConditionLayout,\n 'consistent-parameter-layout': consistentParameterLayout,\n 'statement-padding': statementPadding,\n },\n};\n"],"mappings":";;;;;AAKA,MAAa,gBAAgB,EACzB,OAAO;CACH,4BAA4B;CAC5B,+BAA+B;CAC/B,+BAA+B;CAC/B,qBAAqB;AACzB,EACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compact-iteration-layout.d.ts","names":[],"sources":["../../../src/internals/rules/compact-iteration-layout.ts"],"mappings":";;qBAIa,wBAAwB,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compact-iteration-layout.js","names":[],"sources":["../../../src/internals/rules/compact-iteration-layout.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\ntype IterationNode = Extract<Rule.Node, { type: 'ForInStatement' | 'ForOfStatement' }>;\n\nexport const compactIterationLayout: Rule.RuleModule = {\n create(context) {\n const { sourceCode } = context;\n\n function checkParentheses(node: IterationNode): void {\n const openingParen = sourceCode.getFirstToken(node, (token) => token.value === '(')!;\n const closingParen = sourceCode.getTokenBefore(node.body)!;\n const next = sourceCode.getTokenAfter(openingParen)!;\n const previous = sourceCode.getTokenBefore(closingParen)!;\n const ranges: Array<[number, number]> = [];\n\n if (\n openingParen.loc.end.line !== next.loc.start.line\n && !sourceCode.commentsExistBetween(openingParen, next)\n ) {\n ranges.push([\n openingParen.range[1],\n next.range[0],\n ]);\n }\n\n if (\n previous.loc.end.line !== closingParen.loc.start.line\n && !sourceCode.commentsExistBetween(previous, closingParen)\n ) {\n ranges.push([\n previous.range[1],\n closingParen.range[0],\n ]);\n }\n\n if (ranges.length) {\n context.report({\n fix: (fixer) => ranges.map((range) => fixer.replaceTextRange(range, '')),\n messageId: 'compact',\n node,\n });\n }\n }\n\n return {\n ForInStatement: checkParentheses,\n ForOfStatement: checkParentheses,\n };\n },\n meta: {\n docs: { description: 'Keep for-in and for-of parentheses beside their header contents.' },\n fixable: 'whitespace',\n messages: { compact: 'Keep iteration parentheses on the same lines as their adjacent header contents.' },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";AAIA,MAAa,yBAA0C;CACnD,OAAO,SAAS;EACZ,MAAM,EAAE,eAAe;EAEvB,SAAS,iBAAiB,MAA2B;GACjD,MAAM,eAAe,WAAW,cAAc,OAAO,UAAU,MAAM,UAAU,GAAG;GAClF,MAAM,eAAe,WAAW,eAAe,KAAK,IAAI;GACxD,MAAM,OAAO,WAAW,cAAc,YAAY;GAClD,MAAM,WAAW,WAAW,eAAe,YAAY;GACvD,MAAM,SAAkC,CAAC;GAEzC,IACI,aAAa,IAAI,IAAI,SAAS,KAAK,IAAI,MAAM,QAC1C,CAAC,WAAW,qBAAqB,cAAc,IAAI,GAEtD,OAAO,KAAK,CACR,aAAa,MAAM,IACnB,KAAK,MAAM,EACf,CAAC;GAGL,IACI,SAAS,IAAI,IAAI,SAAS,aAAa,IAAI,MAAM,QAC9C,CAAC,WAAW,qBAAqB,UAAU,YAAY,GAE1D,OAAO,KAAK,CACR,SAAS,MAAM,IACf,aAAa,MAAM,EACvB,CAAC;GAGL,IAAI,OAAO,QACP,QAAQ,OAAO;IACX,MAAM,UAAU,OAAO,KAAK,UAAU,MAAM,iBAAiB,OAAO,EAAE,CAAC;IACvE,WAAW;IACX;GACJ,CAAC;EAET;EAEA,OAAO;GACH,gBAAgB;GAChB,gBAAgB;EACpB;CACJ;CACA,MAAM;EACF,MAAM,EAAE,aAAa,mEAAmE;EACxF,SAAS;EACT,UAAU,EAAE,SAAS,kFAAkF;EACvG,QAAQ,CAAC;EACT,MAAM;CACV;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consistent-condition-layout.d.ts","names":[],"sources":["../../../src/internals/rules/consistent-condition-layout.ts"],"mappings":";;qBAUa,2BAA2B,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consistent-condition-layout.js","names":[],"sources":["../../../src/internals/rules/consistent-condition-layout.ts"],"sourcesContent":["import type {\n AST,\n Rule,\n} from 'eslint';\n\nimport type { TokenStore } from '../utils';\nimport { defineScriptAndTemplateVisitors } from '../utils';\n\ntype LogicalNode = Extract<Rule.Node, { type: 'LogicalExpression' }>;\n\nexport const consistentConditionLayout: Rule.RuleModule = {\n create(context) {\n function createVisitor(tokenStore: TokenStore): Rule.RuleListener {\n const checkedOpeningOffsets = new Set<number>();\n\n function collectOperators(node: LogicalNode['left'], operators: AST.Token[]): void {\n if (node.type !== 'LogicalExpression' || (node.operator !== '&&' && node.operator !== '||')) return;\n const operator = tokenStore.getTokensBetween(node.left, node.right)\n .find((token) => token.type === 'Punctuator' && token.value === node.operator)!;\n\n function collectChild(child: LogicalNode['left']): void {\n const before = tokenStore.getTokenBefore(child);\n const after = tokenStore.getTokenAfter(child);\n if (\n before?.value === '('\n && after?.value === ')'\n && before.range[0] >= node.range![0]\n && after.range[1] <= node.range![1]\n ) return;\n\n collectOperators(child, operators);\n }\n\n collectChild(node.left);\n operators.push(operator);\n collectChild(node.right);\n }\n\n function checkParentheses(node: LogicalNode['left']): void {\n let openingParen = tokenStore.getTokenBefore(node);\n let closingParen = tokenStore.getTokenAfter(node);\n let operators: AST.Token[] | undefined;\n const newlineOffsets: number[] = [];\n while (openingParen?.value === '(' && closingParen?.value === ')') {\n if (\n !checkedOpeningOffsets.has(openingParen.range[0])\n && openingParen.loc.start.line !== closingParen.loc.end.line\n ) {\n checkedOpeningOffsets.add(openingParen.range[0]);\n if (!operators) {\n operators = [];\n collectOperators(node, operators);\n }\n\n const next = tokenStore.getTokenAfter(openingParen)!;\n if (openingParen.loc.end.line === next.loc.start.line) {\n newlineOffsets.push(openingParen.range[1]);\n }\n\n for (const operator of operators) {\n if (tokenStore.getTokenBefore(operator)!.loc.end.line === operator.loc.start.line) {\n newlineOffsets.push(operator.range[0]);\n }\n }\n\n if (tokenStore.getTokenBefore(closingParen)!.loc.end.line === closingParen.loc.start.line) {\n newlineOffsets.push(closingParen.range[0]);\n }\n }\n\n openingParen = tokenStore.getTokenBefore(openingParen);\n closingParen = tokenStore.getTokenAfter(closingParen);\n // An outer pair contains one grouped item, not the inner logical chain.\n operators = [];\n }\n\n if (newlineOffsets.length) {\n context.report({\n fix: (fixer) => newlineOffsets.map((offset) => fixer.insertTextBeforeRange(\n [\n offset,\n offset,\n ],\n '\\n',\n )),\n messageId: 'newline',\n node,\n });\n }\n }\n\n return {\n BinaryExpression: (node) => {\n if (\n [\n '!=',\n '!==',\n '<',\n '<=',\n '==',\n '===',\n '>',\n '>=',\n 'in',\n 'instanceof',\n ].includes(node.operator)\n ) checkParentheses(node);\n },\n DoWhileStatement: (node) => checkParentheses(node.test),\n IfStatement: (node) => checkParentheses(node.test),\n LogicalExpression: (node) => {\n if (node.operator === '&&' || node.operator === '||') checkParentheses(node);\n },\n UnaryExpression: (node) => {\n if (node.operator === '!') checkParentheses(node);\n },\n WhileStatement: (node) => checkParentheses(node.test),\n };\n }\n\n return defineScriptAndTemplateVisitors(context.sourceCode, createVisitor);\n },\n meta: {\n docs: { description: 'Expand multiline parenthesized conditions one logical item per line.' },\n fixable: 'whitespace',\n messages: { newline: 'Put each logical item and both parentheses on separate lines in a multiline condition.' },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";;AAUA,MAAa,4BAA6C;CACtD,OAAO,SAAS;EACZ,SAAS,cAAc,YAA2C;GAC9D,MAAM,wCAAwB,IAAI,IAAY;GAE9C,SAAS,iBAAiB,MAA2B,WAA8B;IAC/E,IAAI,KAAK,SAAS,uBAAwB,KAA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,aAAa,IAAI,MAAM,MACjF,eAAe,KAAK,aAAa,MAAM,EAAE;KAEjD;KAEA,eAAe,WAAW,eAAe,YAAY;KACrD,eAAe,WAAW,cAAc,YAAY;KAEpD,YAAY,CAAC;IACjB;IAEA,IAAI,eAAe,QACf,QAAQ,OAAO;KACX,MAAM,UAAU,eAAe,KAAK,WAAW,MAAM,sBACjD,CACI,QACA,MACJ,GACA,IACJ,CAAC;KACD,WAAW;KACX;IACJ,CAAC;GAET;GAEA,OAAO;IACH,mBAAmB,SAAS;KACxB,IACI;MACI;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACJ,CAAC,CAAC,SAAS,KAAK,QAAQ,GAC1B,iBAAiB,IAAI;IAC3B;IACA,mBAAmB,SAAS,iBAAiB,KAAK,IAAI;IACtD,cAAc,SAAS,iBAAiB,KAAK,IAAI;IACjD,oBAAoB,SAAS;KACzB,IAAI,KAAK,aAAa,QAAQ,KAAK,aAAa,MAAM,iBAAiB,IAAI;IAC/E;IACA,kBAAkB,SAAS;KACvB,IAAI,KAAK,aAAa,KAAK,iBAAiB,IAAI;IACpD;IACA,iBAAiB,SAAS,iBAAiB,KAAK,IAAI;GACxD;EACJ;EAEA,OAAO,gCAAgC,QAAQ,YAAY,aAAa;CAC5E;CACA,MAAM;EACF,MAAM,EAAE,aAAa,uEAAuE;EAC5F,SAAS;EACT,UAAU,EAAE,SAAS,yFAAyF;EAC9G,QAAQ,CAAC;EACT,MAAM;CACV;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consistent-parameter-layout.d.ts","names":[],"sources":["../../../src/internals/rules/consistent-parameter-layout.ts"],"mappings":";;qBAaa,2BAA2B,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consistent-parameter-layout.js","names":[],"sources":["../../../src/internals/rules/consistent-parameter-layout.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\nimport type { TokenStore } from '../utils';\nimport { defineScriptAndTemplateVisitors } from '../utils';\n\ntype CallNode = Extract<Rule.Node, { type: 'CallExpression' | 'NewExpression' }> & { typeArguments?: Rule.Node };\ntype FunctionNode = Extract<\n Rule.Node,\n { type: 'ArrowFunctionExpression' | 'FunctionDeclaration' | 'FunctionExpression' }\n>;\n\ntype ListItem = CallNode['arguments'][number] | FunctionNode['params'][number];\n\nexport const consistentParameterLayout: Rule.RuleModule = {\n create(context) {\n const isTestFile = /\\.test\\.[jt]sx?$/.test(context.filename);\n\n function checkParameterLayout(\n node: Rule.Node,\n items: readonly ListItem[],\n tokenStore: TokenStore,\n isTemplate: boolean,\n ): void {\n const first = items[0];\n if (!first) return;\n const isSingleParameter = items.length === 1;\n\n // JSX argument layout belongs to the JSX formatting rules.\n const firstType: string = first.type;\n if (isSingleParameter && (firstType === 'JSXElement' || firstType === 'JSXFragment')) return;\n let openingParen;\n if (node.type === 'CallExpression' || node.type === 'NewExpression') {\n const call = node as CallNode;\n openingParen = tokenStore.getTokenAfter(\n call.typeArguments ?? call.callee,\n (token) => token.type === 'Punctuator' && token.value === '(',\n );\n } else {\n openingParen = tokenStore.getTokenBefore(first);\n }\n\n if (!openingParen || openingParen.value !== '(') return;\n // An unparenthesized arrow must not borrow its parent's delimiters.\n if (openingParen.range[0] < node.range![0]) return;\n const closingParen = node.type === 'CallExpression' || node.type === 'NewExpression'\n ? tokenStore.getLastToken(node)\n : tokenStore.getTokenAfter(items.at(-1)!, (token) => token.value === ')');\n\n const next = tokenStore.getTokenAfter(openingParen)!;\n\n if (isSingleParameter) {\n if (!closingParen || closingParen.value !== ')') return;\n let previous = tokenStore.getTokenBefore(closingParen)!;\n if (previous.value === ',') previous = tokenStore.getTokenBefore(previous)!;\n if (\n tokenStore.commentsExistBetween(openingParen, next)\n || tokenStore.commentsExistBetween(previous, closingParen)\n ) return;\n\n const hasOpeningNewline = openingParen.loc.end.line !== next.loc.start.line;\n const hasClosingNewline = tokenStore.getTokenBefore(closingParen)!.loc.end.line\n !== closingParen.loc.start.line;\n\n if (hasOpeningNewline === hasClosingNewline) return;\n\n context.report({\n fix: (fixer) => hasOpeningNewline\n ? fixer.insertTextBefore(closingParen, '\\n')\n : fixer.insertTextAfter(openingParen, '\\n'),\n messageId: 'singleBoundary',\n node,\n });\n\n return;\n }\n\n if (!closingParen || openingParen.loc.start.line === closingParen.loc.end.line) return;\n\n if (isTemplate) {\n // Script list formatters do not traverse Vue template expressions.\n const newlineOffsets: number[] = [];\n if (openingParen.loc.end.line === next.loc.start.line) newlineOffsets.push(openingParen.range[1]);\n for (let index = 1; index < items.length; index++) {\n const item = items[index]!;\n const comma = tokenStore.getTokensBetween(items[index - 1]!, item)\n .find((token) => token.value === ',');\n\n if (comma && comma.loc.end.line === tokenStore.getTokenAfter(comma)!.loc.start.line) {\n newlineOffsets.push(comma.range[1]);\n }\n }\n\n if (\n closingParen.value === ')'\n && tokenStore.getTokenBefore(closingParen)!.loc.end.line === closingParen.loc.start.line\n ) newlineOffsets.push(closingParen.range[0]);\n\n if (newlineOffsets.length) {\n context.report({\n fix: (fixer) => newlineOffsets.map((offset) => fixer.insertTextAfterRange(\n [\n offset,\n offset,\n ],\n '\\n',\n )),\n messageId: 'newline',\n node: first,\n });\n }\n\n return;\n }\n\n if (openingParen.loc.end.line !== next.loc.start.line) return;\n\n context.report({\n fix: (fixer) => fixer.insertTextAfter(openingParen, '\\n'),\n messageId: 'newline',\n node: first,\n });\n }\n\n function createVisitor(tokenStore: TokenStore, isTemplate: boolean): Rule.RuleListener {\n return {\n ArrowFunctionExpression: (node) => checkParameterLayout(node, node.params, tokenStore, isTemplate),\n CallExpression: (node) => {\n const { callee } = node;\n if (isTestFile) {\n const target = callee.type === 'MemberExpression'\n && !callee.computed\n && callee.property.type === 'Identifier'\n && callee.property.name === 'concurrent'\n ? callee.object\n : callee;\n\n if (\n target.type === 'Identifier'\n && (target.name === 'describe' || target.name === 'it')\n ) return;\n }\n\n checkParameterLayout(node, node.arguments, tokenStore, isTemplate);\n },\n FunctionDeclaration: (node) => checkParameterLayout(node, node.params, tokenStore, isTemplate),\n FunctionExpression: (node) => checkParameterLayout(node, node.params, tokenStore, isTemplate),\n NewExpression: (node) => checkParameterLayout(node, node.arguments, tokenStore, isTemplate),\n };\n }\n\n return defineScriptAndTemplateVisitors(context.sourceCode, createVisitor);\n },\n meta: {\n docs: { description: 'Preserve consistent single-parameter boundaries and expand multiline parameter lists.' },\n fixable: 'whitespace',\n messages: {\n newline: 'Start a multiline parameter list on a new line.',\n singleBoundary: 'Use matching newline boundaries around a single parameter.',\n },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";;AAaA,MAAa,4BAA6C;CACtD,OAAO,SAAS;EACZ,MAAM,aAAa,mBAAmB,KAAK,QAAQ,QAAQ;EAE3D,SAAS,qBACL,MACA,OACA,YACA,YACI;GACJ,MAAM,QAAQ,MAAM;GACpB,IAAI,CAAC,OAAO;GACZ,MAAM,oBAAoB,MAAM,WAAW;GAG3C,MAAM,YAAoB,MAAM;GAChC,IAAI,sBAAsB,cAAc,gBAAgB,cAAc,gBAAgB;GACtF,IAAI;GACJ,IAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,iBAAiB;IACjE,MAAM,OAAO;IACb,eAAe,WAAW,cACtB,KAAK,iBAAiB,KAAK,SAC1B,UAAU,MAAM,SAAS,gBAAgB,MAAM,UAAU,GAC9D;GACJ,OACI,eAAe,WAAW,eAAe,KAAK;GAGlD,IAAI,CAAC,gBAAgB,aAAa,UAAU,KAAK;GAEjD,IAAI,aAAa,MAAM,KAAK,KAAK,MAAO,IAAI;GAC5C,MAAM,eAAe,KAAK,SAAS,oBAAoB,KAAK,SAAS,kBAC/D,WAAW,aAAa,IAAI,IAC5B,WAAW,cAAc,MAAM,GAAG,EAAE,IAAK,UAAU,MAAM,UAAU,GAAG;GAE5E,MAAM,OAAO,WAAW,cAAc,YAAY;GAElD,IAAI,mBAAmB;IACnB,IAAI,CAAC,gBAAgB,aAAa,UAAU,KAAK;IACjD,IAAI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C;KACD,WAAW;KACX,MAAM;IACV,CAAC;IAGL;GACJ;GAEA,IAAI,aAAa,IAAI,IAAI,SAAS,KAAK,IAAI,MAAM,MAAM;GAEvD,QAAQ,OAAO;IACX,MAAM,UAAU,MAAM,gBAAgB,cAAc,IAAI;IACxD,WAAW;IACX,MAAM;GACV,CAAC;EACL;EAEA,SAAS,cAAc,YAAwB,YAAwC;GACnF,OAAO;IACH,0BAA0B,SAAS,qBAAqB,MAAM,KAAK,QAAQ,YAAY,UAAU;IACjG,iBAAiB,SAAS;KACtB,MAAM,EAAE,WAAW;KACnB,IAAI,YAAY;MACZ,MAAM,SAAS,OAAO,SAAS,sBAC1B,CAAC,OAAO,YACR,OAAO,SAAS,SAAS,gBACzB,OAAO,SAAS,SAAS,eACxB,OAAO,SACP;MAEN,IACI,OAAO,SAAS,iBACZ,OAAO,SAAS,cAAc,OAAO,SAAS,OACpD;KACN;KAEA,qBAAqB,MAAM,KAAK,WAAW,YAAY,UAAU;IACrE;IACA,sBAAsB,SAAS,qBAAqB,MAAM,KAAK,QAAQ,YAAY,UAAU;IAC7F,qBAAqB,SAAS,qBAAqB,MAAM,KAAK,QAAQ,YAAY,UAAU;IAC5F,gBAAgB,SAAS,qBAAqB,MAAM,KAAK,WAAW,YAAY,UAAU;GAC9F;EACJ;EAEA,OAAO,gCAAgC,QAAQ,YAAY,aAAa;CAC5E;CACA,MAAM;EACF,MAAM,EAAE,aAAa,wFAAwF;EAC7G,SAAS;EACT,UAAU;GACN,SAAS;GACT,gBAAgB;EACpB;EACA,QAAQ,CAAC;EACT,MAAM;CACV;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"statement-padding.d.ts","names":[],"sources":["../../../src/internals/rules/statement-padding.ts"],"mappings":";;qBAIa,kBAAkB,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"statement-padding.js","names":[],"sources":["../../../src/internals/rules/statement-padding.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\ntype StatementNode = Extract<Rule.Node, { type: 'Program' }>['body'][number];\n\nexport const statementPadding: Rule.RuleModule = {\n create(context) {\n const { sourceCode } = context;\n\n function checkStatements(statements: readonly StatementNode[]): void {\n for (let index = 1; index < statements.length; index++) {\n const previous = statements[index - 1]!;\n const next = statements[index]!;\n const lastToken = sourceCode.getLastToken(previous)!;\n const firstToken = sourceCode.getFirstToken(next)!;\n const closingLine = sourceCode.lines[lastToken.loc.end.line - 1]!;\n const openingLine = sourceCode.lines[firstToken.loc.start.line - 1]!;\n const hasDifferentIndent = /^\\s*/.exec(closingLine)![0] !== /^\\s*/.exec(openingLine)![0];\n const hasStandaloneClosing = /^[)\\]}]+;?$/.test(closingLine.slice(0, lastToken.loc.end.column).trim());\n const blockNode = previous.type === 'ExportDefaultDeclaration'\n || previous.type === 'ExportNamedDeclaration'\n ? previous.declaration\n : previous;\n\n const hasBlockClosing = lastToken.value === '}' && blockNode && [\n 'BlockStatement',\n 'ClassDeclaration',\n 'ForInStatement',\n 'ForOfStatement',\n 'ForStatement',\n 'FunctionDeclaration',\n 'IfStatement',\n 'LabeledStatement',\n 'SwitchStatement',\n 'TryStatement',\n 'WhileStatement',\n 'WithStatement',\n ].includes(blockNode.type);\n\n if (!hasDifferentIndent && !hasStandaloneClosing && !hasBlockClosing) continue;\n const comments = sourceCode.getCommentsBefore(next);\n if (\n sourceCode\n .lines\n .slice(lastToken.loc.end.line, firstToken.loc.start.line - 1)\n .some((line, index) => !line.trim() && !comments.some((comment) =>\n comment.loc!.start.line <= lastToken.loc.end.line + index + 1\n && comment.loc!.end.line >= lastToken.loc.end.line + index + 1))\n ) continue;\n\n // Keep leading comments attached to the next statement and trailing comments in place.\n const boundary = comments\n .find((comment) => comment.loc!.start.line > lastToken.loc.end.line) ?? firstToken;\n\n const offset = boundary.loc!.start.line > lastToken.loc.end.line\n ? boundary.range![0] - boundary.loc!.start.column\n : boundary.range![0];\n\n context.report({\n fix: (fixer) => fixer.insertTextBeforeRange(\n [\n offset,\n offset,\n ],\n boundary.loc!.start.line === lastToken.loc.end.line ? '\\n\\n' : '\\n',\n ),\n messageId: 'blankLine',\n node: next,\n });\n }\n }\n\n return {\n BlockStatement: (node) => checkStatements(node.body),\n Program: (node) => checkStatements(node.body),\n StaticBlock: (node) => checkStatements(node.body),\n SwitchCase: (node) => checkStatements(node.consequent),\n };\n },\n meta: {\n docs: { description: 'Separate statements after closing lines, blocks, or indentation changes.' },\n fixable: 'whitespace',\n messages: { blankLine: 'Add a blank line between these complete statements.' },\n schema: [],\n type: 'layout',\n },\n};\n"],"mappings":";AAIA,MAAa,mBAAoC;CAC7C,OAAO,SAAS;EACZ,MAAM,EAAE,eAAe;EAEvB,SAAS,gBAAgB,YAA4C;GACjE,KAAK,IAAI,QAAQ,GAAG,QAAQ,WAAW,QAAQ,SAAS;IACpD,MAAM,WAAW,WAAW,QAAQ;IACpC,MAAM,OAAO,WAAW;IACxB,MAAM,YAAY,WAAW,aAAa,QAAQ;IAClD,MAAM,aAAa,WAAW,cAAc,IAAI;IAChD,MAAM,cAAc,WAAW,MAAM,UAAU,IAAI,IAAI,OAAO;IAC9D,MAAM,cAAc,WAAW,MAAM,WAAW,IAAI,MAAM,OAAO;IACjE,MAAM,qBAAqB,OAAO,KAAK,WAAW,CAAC,CAAE,OAAO,OAAO,KAAK,WAAW,CAAC,CAAE;IACtF,MAAM,uBAAuB,cAAc,KAAK,YAAY,MAAM,GAAG,UAAU,IAAI,IAAI,MAAM,CAAC,CAAC,KAAK,CAAC;IACrG,MAAM,YAAY,SAAS,SAAS,8BAC/B,SAAS,SAAS,2BACjB,SAAS,cACT;IAEN,MAAM,kBAAkB,UAAU,UAAU,OAAO,aAAa;KAC5D;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACJ,CAAC,CAAC,SAAS,UAAU,IAAI;IAEzB,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,iBAAiB;IACtE,MAAM,WAAW,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|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/internals/utils.ts"],"sourcesContent":["import type {\n Rule,\n SourceCode,\n} from 'eslint';\n\nexport type TokenStore = Pick<\n SourceCode,\n 'commentsExistBetween' | 'getLastToken' | 'getTokenAfter' | 'getTokenBefore' | 'getTokensBetween'\n>;\n\ninterface TemplateParserServices {\n defineTemplateBodyVisitor?: (\n templateVisitor: Rule.RuleListener,\n scriptVisitor: Rule.RuleListener,\n ) => Rule.RuleListener;\n\n getTemplateBodyTokenStore?: () => TokenStore;\n}\n\nexport function defineScriptAndTemplateVisitors(\n sourceCode: SourceCode,\n createVisitor: (tokenStore: TokenStore, isTemplate: boolean) => Rule.RuleListener,\n): Rule.RuleListener {\n const scriptVisitor = createVisitor(sourceCode, false);\n const parserServices = sourceCode.parserServices as TemplateParserServices;\n if (!parserServices.defineTemplateBodyVisitor || !parserServices.getTemplateBodyTokenStore) return scriptVisitor;\n\n return parserServices.defineTemplateBodyVisitor(\n createVisitor(parserServices.getTemplateBodyTokenStore(), true),\n scriptVisitor,\n );\n}\n"],"mappings":";AAmBA,SAAgB,gCACZ,YACA,eACiB;CACjB,MAAM,gBAAgB,cAAc,YAAY,KAAK;CACrD,MAAM,iBAAiB,WAAW;CAClC,IAAI,CAAC,eAAe,6BAA6B,CAAC,eAAe,2BAA2B,OAAO;CAEnG,OAAO,eAAe,0BAClB,cAAc,eAAe,0BAA0B,GAAG,IAAI,GAC9D,aACJ;AACJ"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|