eslint-config-axkit 1.6.0 → 1.6.1
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/README.md +6 -2
- package/dist/base-config.d.ts +2 -1
- package/dist/base-config.d.ts.map +1 -0
- package/dist/base-config.js +82 -74
- package/dist/base-config.js.map +1 -0
- package/dist/{vitest-config.d.ts → create-vitest-config.d.ts} +1 -0
- package/dist/create-vitest-config.d.ts.map +1 -0
- package/dist/{vitest-config.js → create-vitest-config.js} +1 -0
- package/dist/create-vitest-config.js.map +1 -0
- package/dist/import-optional.d.ts +1 -0
- package/dist/import-optional.d.ts.map +1 -0
- package/dist/import-optional.js +1 -0
- package/dist/import-optional.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -0
- package/dist/node-test-config.d.ts +1 -0
- package/dist/node-test-config.d.ts.map +1 -0
- package/dist/node-test-config.js +1 -0
- package/dist/node-test-config.js.map +1 -0
- package/package.json +30 -31
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ export default axkit();
|
|
|
60
60
|
|
|
61
61
|
For the current rule set and presets, see the source code in `src/`.
|
|
62
62
|
|
|
63
|
+
By default, axkit ignores files under `.agents/` and `.claude/`.
|
|
64
|
+
|
|
63
65
|
## Extending the Config
|
|
64
66
|
|
|
65
67
|
Add additional rules or override existing ones by spreading additional config objects:
|
|
@@ -88,13 +90,15 @@ export default [
|
|
|
88
90
|
| `gitignorePath` | `string` | Path to `.gitignore` file. Patterns will be added to ESLint's ignore list. |
|
|
89
91
|
| `vitest` | `boolean` | Enable Vitest ESLint rules for test files. Requires `@vitest/eslint-plugin` to be installed. |
|
|
90
92
|
| `fastify` | `boolean` | Relax rules that conflict with idiomatic Fastify patterns. Configures `unicorn/prevent-abbreviations` with an allowList for common terms (`app`, `db`, `req`, etc.) and disables `@typescript-eslint/require-await` and `@typescript-eslint/strict-void-return`. |
|
|
91
|
-
| `nextjs` | `boolean` | Enable Next.js rules (`eslint-config-next` core-web-vitals + typescript). Requires `eslint-config-next` to be installed.
|
|
93
|
+
| `nextjs` | `boolean` | Enable Next.js rules (`eslint-config-next` core-web-vitals + typescript) and React Fast Refresh (`only-export-components`) for `.tsx`/`.jsx` files. Requires `eslint-config-next` and `eslint-plugin-react-refresh` to be installed. |
|
|
92
94
|
| `storybook` | `boolean` | Enable Storybook rules (`eslint-plugin-storybook` flat/recommended). Requires `eslint-plugin-storybook` to be installed. |
|
|
93
95
|
| `tailwindcss` | `string` | Path to the Tailwind CSS entry point (e.g. `"src/app/globals.css"`). Enables `eslint-plugin-better-tailwindcss` recommended rules enforcing stylistic and correctness rules. Requires `eslint-plugin-better-tailwindcss` to be installed. |
|
|
94
96
|
|
|
97
|
+
Axkit includes a built-in narrow allowlist entry for `scripts/export-release-version-plugin.mjs`, which is used by repositories managed with `verify-repository`.
|
|
98
|
+
|
|
95
99
|
## Requirements
|
|
96
100
|
|
|
97
|
-
- Node.js >= 22.
|
|
101
|
+
- Node.js >= 22.19.0
|
|
98
102
|
- ESLint >= 10
|
|
99
103
|
|
|
100
104
|
## License
|
package/dist/base-config.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-config.d.ts","sourceRoot":"","sources":["../src/base-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMrC,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,CAsGhD"}
|
package/dist/base-config.js
CHANGED
|
@@ -1,76 +1,84 @@
|
|
|
1
1
|
import globals from "globals";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const DEFAULT_PROJECT_SERVICE_ALLOW_DEFAULT_PROJECT = [
|
|
3
|
+
"scripts/export-release-version-plugin.mjs",
|
|
4
|
+
];
|
|
5
|
+
export function createBaseConfig() {
|
|
6
|
+
return {
|
|
7
|
+
name: "axkit/base",
|
|
8
|
+
files: ["**/*.{js,mjs,cjs,ts,tsx,mts,cts}"],
|
|
9
|
+
languageOptions: {
|
|
10
|
+
globals: globals.node,
|
|
11
|
+
parserOptions: {
|
|
12
|
+
projectService: {
|
|
13
|
+
allowDefaultProject: DEFAULT_PROJECT_SERVICE_ALLOW_DEFAULT_PROJECT,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
9
16
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
17
|
+
rules: {
|
|
18
|
+
// Security rules
|
|
19
|
+
"no-eval": "error",
|
|
20
|
+
"no-new-func": "error",
|
|
21
|
+
"no-script-url": "error",
|
|
22
|
+
// Correctness rules
|
|
23
|
+
"no-return-assign": ["error", "always"],
|
|
24
|
+
radix: ["error", "as-needed"],
|
|
25
|
+
"guard-for-in": "error",
|
|
26
|
+
"prefer-object-has-own": "error",
|
|
27
|
+
// Clarity rules
|
|
28
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
29
|
+
"require-unicode-regexp": "error",
|
|
30
|
+
"no-extend-native": "error",
|
|
31
|
+
"no-new-wrappers": "error",
|
|
32
|
+
"no-implicit-coercion": ["error", { allow: ["!!"] }],
|
|
33
|
+
// Allow numbers in template literals (safe and common)
|
|
34
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
35
|
+
"error",
|
|
36
|
+
{ allowNumber: true },
|
|
37
|
+
],
|
|
38
|
+
// Disallow value-returning functions where void-returning expected
|
|
39
|
+
"@typescript-eslint/strict-void-return": "error",
|
|
40
|
+
// Disallow unused private class members (extends ESLint rule for TS private keyword)
|
|
41
|
+
"@typescript-eslint/no-unused-private-class-members": "error",
|
|
42
|
+
// ===== ESLint Core Bug Prevention =====
|
|
43
|
+
// Catch missing returns in array methods (.map, .filter, etc.)
|
|
44
|
+
"array-callback-return": ["error", { allowImplicit: false }],
|
|
45
|
+
// Constructors shouldn't return values
|
|
46
|
+
"no-constructor-return": "error",
|
|
47
|
+
// Returns in Promise executors are meaningless
|
|
48
|
+
"no-promise-executor-return": "error",
|
|
49
|
+
// Comparing variable to itself is always a bug
|
|
50
|
+
"no-self-compare": "error",
|
|
51
|
+
// Catch template literal syntax in regular strings
|
|
52
|
+
"no-template-curly-in-string": "error",
|
|
53
|
+
// Loops that only run once are bugs
|
|
54
|
+
"no-unreachable-loop": "error",
|
|
55
|
+
// Infinite loop detection (loop condition never changes)
|
|
56
|
+
"no-unmodified-loop-condition": "error",
|
|
57
|
+
// Dead code - assignments never read
|
|
58
|
+
"no-useless-assignment": "error",
|
|
59
|
+
// Race condition detection in async code
|
|
60
|
+
"require-atomic-updates": "error",
|
|
61
|
+
// Require === and !== (allow == null for null/undefined check)
|
|
62
|
+
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
63
|
+
// Comma operator is confusing
|
|
64
|
+
"no-sequences": "error",
|
|
65
|
+
// ===== TypeScript-ESLint Enhancements =====
|
|
66
|
+
// Ensure switch statements handle all enum/union cases
|
|
67
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
68
|
+
// Use ?. instead of && chains (safer and cleaner)
|
|
69
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
70
|
+
// Require compare function for sort() to prevent string sorting bugs
|
|
71
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
72
|
+
// Prevent confusing ! placement next to == or !=
|
|
73
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
74
|
+
// Enforce import type for type-only imports
|
|
75
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
76
|
+
"error",
|
|
77
|
+
{ prefer: "type-imports" },
|
|
78
|
+
],
|
|
79
|
+
// Enforce export type for type-only exports
|
|
80
|
+
"@typescript-eslint/consistent-type-exports": "error",
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=base-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-config.js","sourceRoot":"","sources":["../src/base-config.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,MAAM,6CAA6C,GAAG;IACpD,2CAA2C;CAC5C,CAAC;AAEF,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,CAAC,kCAAkC,CAAC;QAC3C,eAAe,EAAE;YACf,OAAO,EAAE,OAAO,CAAC,IAAI;YACrB,aAAa,EAAE;gBACb,cAAc,EAAE;oBACd,mBAAmB,EAAE,6CAA6C;iBACnE;aACF;SACF;QACD,KAAK,EAAE;YACL,iBAAiB;YACjB,SAAS,EAAE,O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AAE,OAAO;YAEvB,6CAA6C;YAE7C,uDAAuD;YACvD,gDAAgD,EAAE,OAAO;YAEzD,kDAAkD;YAClD,0CAA0C,EAAE,OAAO;YAEnD,qEAAqE;YACrE,+CAA+C,EAAE,OAAO;YAExD,iDAAiD;YACjD,oDAAoD,EAAE,OAAO;YAE7D,4CAA4C;YAC5C,4CAA4C,EAAE;gBAC5C,OAAO;gBACP,EAAE,MAAM,EAAE,cAAc,EAAE;aAC3B;YAED,4CAA4C;YAC5C,4CAA4C,EAAE,OAAO;SACtD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-vitest-config.d.ts","sourceRoot":"","sources":["../src/create-vitest-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE;QAAE,WAAW,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC,WAAW,CAAA;SAAE,CAAA;KAAE,CAAC;IACxD,YAAY,EAAE;QAAE,GAAG,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAA;KAAE,CAAC;CAC7D,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,CAuFtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-vitest-config.js","sourceRoot":"","sources":["../src/create-vitest-config.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,kBAAkB,CAAC,MAAoB;IACrD,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE;YACL,8CAA8C;YAC9C,wCAAwC;SACzC;QACD,OAAO,EAAE,EAAE,MAAM,EAAE;QACnB,KAAK,EAAE;YACL,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;YAEnC,wDAAwD;YACxD,o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AAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUnE"}
|
package/dist/import-optional.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-optional.js","sourceRoot":"","sources":["../src/import-optional.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,eAAe,GAAG,aAAa,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE3D,KAAK,UAAU,aAAa,CAAC,YAAoB;IAC/C,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,kCAAC,aAAa,CAAC,YAAY,CAAC,CAAC,IAAI,EAAC,CAG/D,CAAC;IACF,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,IAAI,YAAoB,CAAC;IACzB,IAAI,CAAC;QACH,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,yBAAyB,IAAI,4DAA4D,IAAI,EAAE,CAChG,CAAC;IACJ,CAAC;IACD,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export type Options = {
|
|
|
6
6
|
*/
|
|
7
7
|
gitignorePath?: string;
|
|
8
8
|
/**
|
|
9
|
-
* Enable Next.js rules (eslint-config-next core-web-vitals + typescript)
|
|
10
|
-
*
|
|
11
|
-
* Requires `eslint-config-next` to be installed.
|
|
9
|
+
* Enable Next.js rules (eslint-config-next core-web-vitals + typescript)
|
|
10
|
+
* and React Fast Refresh (`only-export-components`) for `.tsx`/`.jsx` files.
|
|
11
|
+
* Requires `eslint-config-next` and `eslint-plugin-react-refresh` to be installed.
|
|
12
12
|
*/
|
|
13
13
|
nextjs?: boolean;
|
|
14
14
|
/**
|
|
@@ -49,7 +49,9 @@ export type Options = {
|
|
|
49
49
|
* Optional:
|
|
50
50
|
* - Vitest plugin for test files via `vitest: true`
|
|
51
51
|
* - Next.js rules (core-web-vitals + typescript) via `nextjs: true`
|
|
52
|
+
* - React Fast Refresh rule (included with `nextjs: true`)
|
|
52
53
|
* - Storybook rules (flat/recommended) via `storybook: true`
|
|
53
54
|
* - Tailwind CSS rules (better-tailwindcss/recommended) via `tailwindcss: "path/to/entry.css"`
|
|
54
55
|
*/
|
|
55
56
|
export declare function axkit(options?: Options): Promise<Linter.Config[]>;
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAM7C,MAAM,MAAM,OAAO,GAAG;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,KAAK,CAAC,OAAO,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAiK3E"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import { includeIgnoreFile } from "@eslint/compat";
|
|
|
4
4
|
import eslintConfigPrettier from "eslint-config-prettier/flat";
|
|
5
5
|
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
6
6
|
import { importOptional } from "./import-optional.js";
|
|
7
|
-
import {
|
|
7
|
+
import { createBaseConfig } from "./base-config.js";
|
|
8
8
|
import { nodeTestConfig } from "./node-test-config.js";
|
|
9
|
-
import { createVitestConfig } from "./vitest-config.js";
|
|
9
|
+
import { createVitestConfig } from "./create-vitest-config.js";
|
|
10
10
|
/**
|
|
11
11
|
* Creates a complete ESLint flat config for TypeScript projects.
|
|
12
12
|
*
|
|
@@ -20,6 +20,7 @@ import { createVitestConfig } from "./vitest-config.js";
|
|
|
20
20
|
* Optional:
|
|
21
21
|
* - Vitest plugin for test files via `vitest: true`
|
|
22
22
|
* - Next.js rules (core-web-vitals + typescript) via `nextjs: true`
|
|
23
|
+
* - React Fast Refresh rule (included with `nextjs: true`)
|
|
23
24
|
* - Storybook rules (flat/recommended) via `storybook: true`
|
|
24
25
|
* - Tailwind CSS rules (better-tailwindcss/recommended) via `tailwindcss: "path/to/entry.css"`
|
|
25
26
|
*/
|
|
@@ -37,14 +38,25 @@ export async function axkit(options = {}) {
|
|
|
37
38
|
}
|
|
38
39
|
// ── Next.js (before base so axkit's strict rules override) ─────────
|
|
39
40
|
if (nextjs) {
|
|
40
|
-
const [nextVitals, nextTs] = await Promise.all([
|
|
41
|
+
const [nextVitals, nextTs, reactRefreshPlugin] = await Promise.all([
|
|
41
42
|
importOptional("eslint-config-next/core-web-vitals"),
|
|
42
43
|
importOptional("eslint-config-next/typescript"),
|
|
44
|
+
importOptional("eslint-plugin-react-refresh"),
|
|
43
45
|
]);
|
|
44
|
-
configs.push(...nextVitals, ...nextTs
|
|
46
|
+
configs.push(...nextVitals, ...nextTs, {
|
|
47
|
+
name: "axkit/react-refresh",
|
|
48
|
+
files: ["**/*.{tsx,jsx}"],
|
|
49
|
+
plugins: { "react-refresh": reactRefreshPlugin },
|
|
50
|
+
rules: {
|
|
51
|
+
"react-refresh/only-export-components": [
|
|
52
|
+
"warn",
|
|
53
|
+
{ allowConstantExport: true },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
});
|
|
45
57
|
}
|
|
46
58
|
// ── Core configs ───────────────────────────────────────────────────
|
|
47
|
-
configs.push(js.configs.recommended, ...tseslint.configs.strictTypeChecked,
|
|
59
|
+
configs.push(js.configs.recommended, ...tseslint.configs.strictTypeChecked, createBaseConfig(), eslintPluginUnicorn.configs.recommended,
|
|
48
60
|
// Unicorn rules that are off by default
|
|
49
61
|
{
|
|
50
62
|
name: "axkit/unicorn-extras",
|
|
@@ -132,3 +144,4 @@ export async function axkit(options = {}) {
|
|
|
132
144
|
configs.push(eslintConfigPrettier);
|
|
133
145
|
return configs;
|
|
134
146
|
}
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAC/D,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AA6C/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,UAAmB,EAAE;IAC/C,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GACtE,OAAO,CAA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AAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC;QAC1D,OAAO,CAAC,IAAI,CACV,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,EACtE;YACE,IAAI,EAAE,+BAA+B;YACrC,QAAQ,EAAE;gBACR,oBAAoB,EAAE;oBACpB,UAAU,EAAE,WAAW;iBACxB;aACF;SACF,EACD;YACE,IAAI,EAAE,6BAA6B;YACnC,KAAK,EAAE;gBACL,yDAAyD;gBACzD,uEAAuE;gBACvE,yEAAyE;gBACzE,qEAAqE;gBACrE,8CAA8C,EAAE;oBAC9C,OAAO;oBACP,EAAE,cAAc,EAAE,KAAK,EAAE;iBAC1B;gBACD,sEAAsE;gBACtE,oCAAoC;gBACpC,qDAAqD,EAAE,KAAK;aAC7D;SACF,CACF,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-test-config.d.ts","sourceRoot":"","sources":["../src/node-test-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAoBnC,CAAC"}
|
package/dist/node-test-config.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-test-config.js","sourceRoot":"","sources":["../src/node-test-config.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE;QACL,8CAA8C;QAC9C,wCAAwC;KACzC;IACD,KAAK,EAAE;QACL,yCAAyC,EAAE;YACzC,OAAO;YACP;gBACE,sBAAsB,EAAE;oBACtB;wBACE,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,WAAW;wBACpB,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;qBAClE;iBACF;aACF;SACF;KACF;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"prepack": "pnpm run rebuild",
|
|
4
|
+
"prepare": "git config core.hooksPath .githooks",
|
|
5
|
+
"build": "tsc -p tsconfig.app.json",
|
|
6
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
7
|
+
"format": "prettier --write .",
|
|
8
|
+
"format:check": "prettier --check .",
|
|
9
|
+
"fta": "fta-check",
|
|
10
|
+
"knip": "knip",
|
|
11
|
+
"lint": "eslint",
|
|
12
|
+
"rebuild": "pnpm run clean && pnpm run build",
|
|
13
|
+
"test": "node --test src/**/*.test.ts",
|
|
14
|
+
"typecheck": "tsc -b --noEmit"
|
|
15
|
+
},
|
|
2
16
|
"name": "eslint-config-axkit",
|
|
3
17
|
"author": "Łukasz Jerciński",
|
|
4
18
|
"license": "MIT",
|
|
5
|
-
"version": "1.6.
|
|
19
|
+
"version": "1.6.1",
|
|
6
20
|
"description": "Reusable ESLint flat config for TypeScript + Node.js projects with strict type checking, Prettier, and Unicorn",
|
|
7
21
|
"repository": {
|
|
8
22
|
"type": "git",
|
|
@@ -26,22 +40,6 @@
|
|
|
26
40
|
"README.md",
|
|
27
41
|
"LICENSE"
|
|
28
42
|
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"prepare": "git config core.hooksPath .githooks",
|
|
31
|
-
"prepublishOnly": "pnpm run rebuild",
|
|
32
|
-
"build": "tsc -p tsconfig.app.json",
|
|
33
|
-
"clean": "rm -rf dist *.tsbuildinfo",
|
|
34
|
-
"format": "prettier --write .",
|
|
35
|
-
"format:check": "prettier --check .",
|
|
36
|
-
"fta": "fta-check",
|
|
37
|
-
"knip": "knip",
|
|
38
|
-
"lint": "eslint",
|
|
39
|
-
"rebuild": "pnpm run clean && pnpm run build",
|
|
40
|
-
"test": "vitest run",
|
|
41
|
-
"test:coverage": "vitest run --coverage",
|
|
42
|
-
"test:watch": "vitest",
|
|
43
|
-
"typecheck": "tsc -b --noEmit"
|
|
44
|
-
},
|
|
45
43
|
"keywords": [
|
|
46
44
|
"eslint",
|
|
47
45
|
"eslintconfig",
|
|
@@ -50,19 +48,19 @@
|
|
|
50
48
|
"typescript",
|
|
51
49
|
"prettier",
|
|
52
50
|
"unicorn",
|
|
53
|
-
"vitest",
|
|
54
51
|
"axkit"
|
|
55
52
|
],
|
|
56
|
-
"packageManager": "pnpm@10.
|
|
53
|
+
"packageManager": "pnpm@10.32.1",
|
|
57
54
|
"engines": {
|
|
58
|
-
"node": ">=22.
|
|
55
|
+
"node": ">=22.19.0"
|
|
59
56
|
},
|
|
60
57
|
"peerDependencies": {
|
|
58
|
+
"@vitest/eslint-plugin": ">=1",
|
|
61
59
|
"eslint": ">=10",
|
|
62
60
|
"eslint-config-next": ">=16",
|
|
63
61
|
"eslint-plugin-better-tailwindcss": ">=4",
|
|
64
|
-
"eslint-plugin-
|
|
65
|
-
"
|
|
62
|
+
"eslint-plugin-react-refresh": ">=0.4",
|
|
63
|
+
"eslint-plugin-storybook": ">=10"
|
|
66
64
|
},
|
|
67
65
|
"peerDependenciesMeta": {
|
|
68
66
|
"eslint-config-next": {
|
|
@@ -71,6 +69,9 @@
|
|
|
71
69
|
"eslint-plugin-better-tailwindcss": {
|
|
72
70
|
"optional": true
|
|
73
71
|
},
|
|
72
|
+
"eslint-plugin-react-refresh": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
74
75
|
"eslint-plugin-storybook": {
|
|
75
76
|
"optional": true
|
|
76
77
|
},
|
|
@@ -79,24 +80,22 @@
|
|
|
79
80
|
}
|
|
80
81
|
},
|
|
81
82
|
"dependencies": {
|
|
82
|
-
"@eslint/compat": "^2.0.
|
|
83
|
+
"@eslint/compat": "^2.0.4",
|
|
83
84
|
"@eslint/js": "^10.0.1",
|
|
84
85
|
"eslint-config-prettier": "^10.1.8",
|
|
85
|
-
"eslint-plugin-unicorn": "^
|
|
86
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
86
87
|
"globals": "^17.4.0",
|
|
87
|
-
"typescript-eslint": "^8.
|
|
88
|
+
"typescript-eslint": "^8.58.1"
|
|
88
89
|
},
|
|
89
90
|
"devDependencies": {
|
|
90
91
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
91
|
-
"@types/node": "^25.
|
|
92
|
-
"
|
|
93
|
-
"eslint": "^10.0.3",
|
|
92
|
+
"@types/node": "^25.5.2",
|
|
93
|
+
"eslint": "^10.2.0",
|
|
94
94
|
"fta-check": "^1.5.1",
|
|
95
95
|
"fta-cli": "^3.0.0",
|
|
96
|
-
"knip": "^
|
|
96
|
+
"knip": "^6.3.0",
|
|
97
97
|
"prettier": "3.8.1",
|
|
98
98
|
"semantic-release": "^25.0.3",
|
|
99
|
-
"typescript": "^
|
|
100
|
-
"vitest": "^4.0.18"
|
|
99
|
+
"typescript": "^6.0.2"
|
|
101
100
|
}
|
|
102
101
|
}
|