@kikiutils/eslint-config 12.0.1 → 12.0.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/base.js +1 -1
- package/dist/base.js.map +1 -1
- package/package.json +1 -1
- package/src/base.ts +10 -1
package/dist/base.js
CHANGED
|
@@ -90,7 +90,7 @@ function createBaseConfigs(environment = "node") {
|
|
|
90
90
|
it: "for",
|
|
91
91
|
test: "for"
|
|
92
92
|
}],
|
|
93
|
-
"test/expect-expect": "error",
|
|
93
|
+
"test/expect-expect": ["error", { assertFunctionNames: ["assert*", "expect*"] }],
|
|
94
94
|
"test/no-commented-out-tests": "error",
|
|
95
95
|
"test/no-conditional-expect": "error",
|
|
96
96
|
"test/no-disabled-tests": "error",
|
package/dist/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":[],"sources":["../src/base.ts"],"sourcesContent":["import type { TypedFlatConfigItem } from '@antfu/eslint-config';\nimport {\n GLOB_JS,\n GLOB_JSX,\n GLOB_TESTS,\n GLOB_TS,\n GLOB_TSX,\n} from '@antfu/eslint-config';\nimport promise from 'eslint-plugin-promise';\n\nimport { createBaseRules } from './_internals/configs/base-rules';\nimport { jsdocSettings } from './_internals/configs/jsdoc';\nimport { createTypeAwareConfig } from './_internals/configs/type-aware';\nimport { typescriptConfig } from './_internals/configs/typescript';\nimport { kikiutilsPlugin } from './_internals/rules';\n\nexport { createBaseRules };\n\nconst vscodeOrderSensitiveArrayProperties = [\n 'args',\n 'autoAttachSmartPattern',\n 'dependsOn',\n 'options',\n 'outFiles',\n 'problemMatcher',\n 'resolveSourceMapLocations',\n 'runtimeArgs',\n 'skipFiles',\n].join('|');\n\nconst testSleepMessage = 'A fixed wait makes tests slow and flaky. Use fake timers for timer-driven code, or wait for the event or condition itself, such as with `vi.waitFor()`. To assert that something has not happened yet, await one event loop turn with `setImmediate` from `node:timers/promises`.';\n\nexport function createBaseConfigs(environment: 'bun' | 'node' = 'node'): TypedFlatConfigItem[] {\n return [\n {\n name: 'kikiutils/base',\n rules: {\n 'e18e/ban-dependencies': [\n 'error',\n { allowed: ['axios'] },\n ],\n 'e18e/prefer-static-regex': 'off',\n 'style/linebreak-style': [\n 'error',\n 'unix',\n ],\n },\n },\n {\n name: 'kikiutils/javascript',\n files: [\n GLOB_JS,\n GLOB_JSX,\n GLOB_TS,\n GLOB_TSX,\n ],\n plugins: {\n kikiutils: kikiutilsPlugin,\n promise,\n },\n rules: {\n ...createBaseRules(environment),\n 'node/prefer-global/process': [\n 'error',\n 'always',\n ],\n },\n settings: jsdocSettings,\n },\n {\n ...typescriptConfig,\n name: 'kikiutils/typescript',\n files: [\n GLOB_TS,\n GLOB_TSX,\n ],\n },\n {\n ...createTypeAwareConfig(),\n name: 'kikiutils/type-aware',\n files: [\n GLOB_TS,\n GLOB_TSX,\n ],\n ignores: ['**/*.config.?([cm])ts'],\n },\n {\n name: 'kikiutils/tests',\n files: GLOB_TESTS,\n rules: {\n 'kikiutils/consistent-parameter-layout': [\n 'error',\n { compactTestCalls: true },\n ],\n 'kikiutils/no-restricted-test-imports': [\n 'error',\n {\n paths: [\n {\n importNames: ['expect'],\n message: 'Use `expect` from the test context.',\n name: 'vitest',\n },\n ...[\n 'node:timers/promises',\n 'timers/promises',\n ].map((name) => ({\n importNames: ['setTimeout'],\n message: testSleepMessage,\n name,\n })),\n ],\n },\n ],\n 'kikiutils/no-restricted-test-syntax': [\n 'error',\n {\n message: testSleepMessage,\n selector: [\n 'NewExpression[callee.name=\"Promise\"] > :function > CallExpression.body[callee.name=\"setTimeout\"]',\n 'NewExpression[callee.name=\"Promise\"] > :function > BlockStatement > ExpressionStatement > CallExpression[callee.name=\"setTimeout\"]',\n 'CallExpression[callee.object.name=\"Bun\"][callee.property.name=/^sleep(Sync)?$/]',\n ].join(', '),\n },\n // An implementation types the mock; only an empty one falls back to `(...args: any[]) => any`.\n {\n message: 'An empty `vi.fn()` is typed `(...args: any[]) => any`; pass a type parameter or an implementation.',\n selector: 'CallExpression[callee.object.name=\"vi\"][callee.property.name=\"fn\"][arguments.length=0]:not([typeArguments])',\n },\n ],\n 'test/consistent-each-for': [\n 'error',\n {\n it: 'for',\n test: 'for',\n },\n ],\n 'test/expect-expect': 'error',\n 'test/no-commented-out-tests': 'error',\n 'test/no-conditional-expect': 'error',\n 'test/no-disabled-tests': 'error',\n 'test/no-standalone-expect': 'error',\n 'test/prefer-each': 'error',\n 'test/prefer-hooks-on-top': 'error',\n 'test/prefer-lowercase-title': [\n 'error',\n {\n ignoreTopLevelDescribe: true,\n lowercaseFirstCharacterOnly: true,\n },\n ],\n 'test/prefer-to-be': 'error',\n 'test/prefer-vi-mocked': 'error',\n 'test/require-to-throw-message': 'error',\n 'test/valid-describe-callback': 'error',\n 'test/valid-expect': 'error',\n 'test/valid-expect-in-promise': 'error',\n 'test/valid-title': 'error',\n // Mocks and partial fixtures often need `any`.\n 'ts/no-explicit-any': 'off',\n },\n },\n {\n name: 'kikiutils/vscode',\n files: ['**/.vscode/*.json'],\n rules: {\n 'jsonc/sort-array-values': [\n 'error',\n {\n order: {\n natural: true,\n type: 'asc',\n },\n // Preserve ordered fields and any argument or option arrays nested inside them.\n pathPattern: String.raw`^(?!.*(?:^|\\.|\\[\")(?:${vscodeOrderSensitiveArrayProperties})(?:$|\\.|\\[|\"\\])).*`,\n },\n ],\n 'jsonc/sort-keys': [\n 'error',\n 'asc',\n {\n caseSensitive: true,\n natural: true,\n },\n ],\n },\n },\n // Ignore all extracted Markdown code blocks, but keep linting Markdown itself.\n {\n name: 'kikiutils/ignores/markdown-code-blocks',\n ignores: ['**/*.md/**'],\n },\n // Serena's project files (`project.yml`, memories) are tool-generated and may be tracked.\n {\n name: 'kikiutils/ignores/serena',\n ignores: ['**/.serena/**'],\n },\n ];\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,sCAAsC;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ,CAAC,CAAC,KAAK,GAAG;AAEV,MAAM,mBAAmB;AAEzB,SAAgB,kBAAkB,cAA8B,QAA+B;CAC3F,OAAO;EACH;GACI,MAAM;GACN,OAAO;IACH,yBAAyB,CACrB,SACA,EAAE,SAAS,CAAC,OAAO,EAAE,CACzB;IACA,4BAA4B;IAC5B,yBAAyB,CACrB,SACA,MACJ;GACJ;EACJ;EACA;GACI,MAAM;GACN,OAAO;IACH;IACA;IACA;IACA;GACJ;GACA,SAAS;IACL,WAAW;IACX;GACJ;GACA,OAAO;IACH,GAAG,gBAAgB,WAAW;IAC9B,8BAA8B,CAC1B,SACA,QACJ;GACJ;GACA,UAAU;EACd;EACA;GACI,GAAG;GACH,MAAM;GACN,OAAO,CACH,SACA,QACJ;EACJ;EACA;GACI,GAAG,sBAAsB;GACzB,MAAM;GACN,OAAO,CACH,SACA,QACJ;GACA,SAAS,CAAC,uBAAuB;EACrC;EACA;GACI,MAAM;GACN,OAAO;GACP,OAAO;IACH,yCAAyC,CACrC,SACA,EAAE,kBAAkB,KAAK,CAC7B;IACA,wCAAwC,CACpC,SACA,EACI,OAAO,CACH;KACI,aAAa,CAAC,QAAQ;KACtB,SAAS;KACT,MAAM;IACV,GACA,GAAG,CACC,wBACA,iBACJ,CAAC,CAAC,KAAK,UAAU;KACb,aAAa,CAAC,YAAY;KAC1B,SAAS;KACT;IACJ,EAAE,CACN,EACJ,CACJ;IACA,uCAAuC;KACnC;KACA;MACI,SAAS;MACT,UAAU;OACN;OACA;OACA;MACJ,CAAC,CAAC,KAAK,IAAI;KACf;KAEA;MACI,SAAS;MACT,UAAU;KACd;IACJ;IACA,4BAA4B,CACxB,SACA;KACI,IAAI;KACJ,MAAM;IACV,CACJ;
|
|
1
|
+
{"version":3,"file":"base.js","names":[],"sources":["../src/base.ts"],"sourcesContent":["import type { TypedFlatConfigItem } from '@antfu/eslint-config';\nimport {\n GLOB_JS,\n GLOB_JSX,\n GLOB_TESTS,\n GLOB_TS,\n GLOB_TSX,\n} from '@antfu/eslint-config';\nimport promise from 'eslint-plugin-promise';\n\nimport { createBaseRules } from './_internals/configs/base-rules';\nimport { jsdocSettings } from './_internals/configs/jsdoc';\nimport { createTypeAwareConfig } from './_internals/configs/type-aware';\nimport { typescriptConfig } from './_internals/configs/typescript';\nimport { kikiutilsPlugin } from './_internals/rules';\n\nexport { createBaseRules };\n\nconst vscodeOrderSensitiveArrayProperties = [\n 'args',\n 'autoAttachSmartPattern',\n 'dependsOn',\n 'options',\n 'outFiles',\n 'problemMatcher',\n 'resolveSourceMapLocations',\n 'runtimeArgs',\n 'skipFiles',\n].join('|');\n\nconst testSleepMessage = 'A fixed wait makes tests slow and flaky. Use fake timers for timer-driven code, or wait for the event or condition itself, such as with `vi.waitFor()`. To assert that something has not happened yet, await one event loop turn with `setImmediate` from `node:timers/promises`.';\n\nexport function createBaseConfigs(environment: 'bun' | 'node' = 'node'): TypedFlatConfigItem[] {\n return [\n {\n name: 'kikiutils/base',\n rules: {\n 'e18e/ban-dependencies': [\n 'error',\n { allowed: ['axios'] },\n ],\n 'e18e/prefer-static-regex': 'off',\n 'style/linebreak-style': [\n 'error',\n 'unix',\n ],\n },\n },\n {\n name: 'kikiutils/javascript',\n files: [\n GLOB_JS,\n GLOB_JSX,\n GLOB_TS,\n GLOB_TSX,\n ],\n plugins: {\n kikiutils: kikiutilsPlugin,\n promise,\n },\n rules: {\n ...createBaseRules(environment),\n 'node/prefer-global/process': [\n 'error',\n 'always',\n ],\n },\n settings: jsdocSettings,\n },\n {\n ...typescriptConfig,\n name: 'kikiutils/typescript',\n files: [\n GLOB_TS,\n GLOB_TSX,\n ],\n },\n {\n ...createTypeAwareConfig(),\n name: 'kikiutils/type-aware',\n files: [\n GLOB_TS,\n GLOB_TSX,\n ],\n ignores: ['**/*.config.?([cm])ts'],\n },\n {\n name: 'kikiutils/tests',\n files: GLOB_TESTS,\n rules: {\n 'kikiutils/consistent-parameter-layout': [\n 'error',\n { compactTestCalls: true },\n ],\n 'kikiutils/no-restricted-test-imports': [\n 'error',\n {\n paths: [\n {\n importNames: ['expect'],\n message: 'Use `expect` from the test context.',\n name: 'vitest',\n },\n ...[\n 'node:timers/promises',\n 'timers/promises',\n ].map((name) => ({\n importNames: ['setTimeout'],\n message: testSleepMessage,\n name,\n })),\n ],\n },\n ],\n 'kikiutils/no-restricted-test-syntax': [\n 'error',\n {\n message: testSleepMessage,\n selector: [\n 'NewExpression[callee.name=\"Promise\"] > :function > CallExpression.body[callee.name=\"setTimeout\"]',\n 'NewExpression[callee.name=\"Promise\"] > :function > BlockStatement > ExpressionStatement > CallExpression[callee.name=\"setTimeout\"]',\n 'CallExpression[callee.object.name=\"Bun\"][callee.property.name=/^sleep(Sync)?$/]',\n ].join(', '),\n },\n // An implementation types the mock; only an empty one falls back to `(...args: any[]) => any`.\n {\n message: 'An empty `vi.fn()` is typed `(...args: any[]) => any`; pass a type parameter or an implementation.',\n selector: 'CallExpression[callee.object.name=\"vi\"][callee.property.name=\"fn\"][arguments.length=0]:not([typeArguments])',\n },\n ],\n 'test/consistent-each-for': [\n 'error',\n {\n it: 'for',\n test: 'for',\n },\n ],\n // Type tests assert with `expectTypeOf()`, and shared checks are `expect*` helpers.\n 'test/expect-expect': [\n 'error',\n {\n assertFunctionNames: [\n 'assert*',\n 'expect*',\n ],\n },\n ],\n 'test/no-commented-out-tests': 'error',\n 'test/no-conditional-expect': 'error',\n 'test/no-disabled-tests': 'error',\n 'test/no-standalone-expect': 'error',\n 'test/prefer-each': 'error',\n 'test/prefer-hooks-on-top': 'error',\n 'test/prefer-lowercase-title': [\n 'error',\n {\n ignoreTopLevelDescribe: true,\n lowercaseFirstCharacterOnly: true,\n },\n ],\n 'test/prefer-to-be': 'error',\n 'test/prefer-vi-mocked': 'error',\n 'test/require-to-throw-message': 'error',\n 'test/valid-describe-callback': 'error',\n 'test/valid-expect': 'error',\n 'test/valid-expect-in-promise': 'error',\n 'test/valid-title': 'error',\n // Mocks and partial fixtures often need `any`.\n 'ts/no-explicit-any': 'off',\n },\n },\n {\n name: 'kikiutils/vscode',\n files: ['**/.vscode/*.json'],\n rules: {\n 'jsonc/sort-array-values': [\n 'error',\n {\n order: {\n natural: true,\n type: 'asc',\n },\n // Preserve ordered fields and any argument or option arrays nested inside them.\n pathPattern: String.raw`^(?!.*(?:^|\\.|\\[\")(?:${vscodeOrderSensitiveArrayProperties})(?:$|\\.|\\[|\"\\])).*`,\n },\n ],\n 'jsonc/sort-keys': [\n 'error',\n 'asc',\n {\n caseSensitive: true,\n natural: true,\n },\n ],\n },\n },\n // Ignore all extracted Markdown code blocks, but keep linting Markdown itself.\n {\n name: 'kikiutils/ignores/markdown-code-blocks',\n ignores: ['**/*.md/**'],\n },\n // Serena's project files (`project.yml`, memories) are tool-generated and may be tracked.\n {\n name: 'kikiutils/ignores/serena',\n ignores: ['**/.serena/**'],\n },\n ];\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,sCAAsC;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ,CAAC,CAAC,KAAK,GAAG;AAEV,MAAM,mBAAmB;AAEzB,SAAgB,kBAAkB,cAA8B,QAA+B;CAC3F,OAAO;EACH;GACI,MAAM;GACN,OAAO;IACH,yBAAyB,CACrB,SACA,EAAE,SAAS,CAAC,OAAO,EAAE,CACzB;IACA,4BAA4B;IAC5B,yBAAyB,CACrB,SACA,MACJ;GACJ;EACJ;EACA;GACI,MAAM;GACN,OAAO;IACH;IACA;IACA;IACA;GACJ;GACA,SAAS;IACL,WAAW;IACX;GACJ;GACA,OAAO;IACH,GAAG,gBAAgB,WAAW;IAC9B,8BAA8B,CAC1B,SACA,QACJ;GACJ;GACA,UAAU;EACd;EACA;GACI,GAAG;GACH,MAAM;GACN,OAAO,CACH,SACA,QACJ;EACJ;EACA;GACI,GAAG,sBAAsB;GACzB,MAAM;GACN,OAAO,CACH,SACA,QACJ;GACA,SAAS,CAAC,uBAAuB;EACrC;EACA;GACI,MAAM;GACN,OAAO;GACP,OAAO;IACH,yC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/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "12.0.
|
|
4
|
+
"version": "12.0.2",
|
|
5
5
|
"description": "Opinionated ESLint flat config presets layered on @antfu/eslint-config, with type-aware TypeScript and Vue checks and custom rules, built for the author's own repositories.",
|
|
6
6
|
"author": "kiki-kanri",
|
|
7
7
|
"license": "MIT",
|
package/src/base.ts
CHANGED
|
@@ -135,7 +135,16 @@ export function createBaseConfigs(environment: 'bun' | 'node' = 'node'): TypedFl
|
|
|
135
135
|
test: 'for',
|
|
136
136
|
},
|
|
137
137
|
],
|
|
138
|
-
|
|
138
|
+
// Type tests assert with `expectTypeOf()`, and shared checks are `expect*` helpers.
|
|
139
|
+
'test/expect-expect': [
|
|
140
|
+
'error',
|
|
141
|
+
{
|
|
142
|
+
assertFunctionNames: [
|
|
143
|
+
'assert*',
|
|
144
|
+
'expect*',
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
],
|
|
139
148
|
'test/no-commented-out-tests': 'error',
|
|
140
149
|
'test/no-conditional-expect': 'error',
|
|
141
150
|
'test/no-disabled-tests': 'error',
|