js-style-kit 0.8.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-style-kit",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "A zero configuration style guide for ESLint and Prettier",
5
5
  "keywords": [
6
6
  "eslint",
@@ -45,36 +45,36 @@
45
45
  "@convex-dev/eslint-plugin": "1.0.0",
46
46
  "@prettier/plugin-oxc": "0.0.4",
47
47
  "@tanstack/eslint-plugin-query": "5.91.2",
48
- "@typescript-eslint/parser": "8.46.0",
48
+ "@typescript-eslint/parser": "8.46.2",
49
49
  "eslint": "9.38.0",
50
50
  "eslint-import-resolver-typescript": "4.4.4",
51
51
  "eslint-plugin-import-x": "4.16.1",
52
52
  "eslint-plugin-jest": "29.0.1",
53
- "eslint-plugin-jsdoc": "61.1.4",
53
+ "eslint-plugin-jsdoc": "61.1.8",
54
54
  "eslint-plugin-nextjs": "1.1.1",
55
55
  "eslint-plugin-perfectionist": "4.15.1",
56
56
  "eslint-plugin-prefer-arrow-functions": "3.9.1",
57
57
  "eslint-plugin-react": "7.37.5",
58
- "eslint-plugin-react-hooks": "7.0.0",
58
+ "eslint-plugin-react-hooks": "7.0.1",
59
59
  "eslint-plugin-react-refresh": "0.4.24",
60
- "eslint-plugin-storybook": "9.1.13",
60
+ "eslint-plugin-storybook": "9.1.15",
61
61
  "eslint-plugin-turbo": "2.5.8",
62
62
  "eslint-plugin-unicorn": "61.0.2",
63
63
  "eslint-plugin-vitest": "0.5.4",
64
64
  "globals": "16.4.0",
65
65
  "prettier": "3.6.2",
66
66
  "prettier-plugin-css-order": "2.1.2",
67
- "prettier-plugin-curly": "0.3.2",
67
+ "prettier-plugin-curly": "0.4.0",
68
68
  "prettier-plugin-packagejson": "2.5.19",
69
69
  "prettier-plugin-sort-json": "4.1.1",
70
70
  "prettier-plugin-tailwindcss": "0.7.1",
71
- "typescript-eslint": "8.46.0"
71
+ "typescript-eslint": "8.46.2"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@repo/typescript-config": "workspace:*",
75
- "@types/bun": "1.3.0",
76
- "@types/node": "22.18.10",
77
- "commander": "14.0.1",
75
+ "@types/bun": "1.3.1",
76
+ "@types/node": "22.18.12",
77
+ "commander": "14.0.2",
78
78
  "glob": "11.0.3",
79
79
  "tsup": "8.5.0",
80
80
  "typescript": "5.9.3"
@@ -22,9 +22,58 @@ export default eslintConfig({
22
22
 
23
23
  ## File Scope
24
24
 
25
- Convex rules apply only to files in your `convex` directory.
25
+ Convex rules apply only to files in your `convex` directory: `**/convex/**/*.{ts,js}`
26
+
27
+ ## Filename Convention
28
+
29
+ When both Convex and Unicorn configurations are enabled, **Convex files are automatically enforced to use camelCase** naming, regardless of the global Unicorn filename case setting.
30
+
31
+ This is because Convex follows JavaScript/TypeScript conventions where files export functions that become API endpoints, and camelCase is the standard for function names.
32
+
33
+ ### Example
34
+
35
+ ```js
36
+ import { eslintConfig } from "js-style-kit";
37
+
38
+ export default eslintConfig({
39
+ convex: true,
40
+ unicorn: { filenameCase: "kebabCase" }, // Global setting
41
+ });
42
+ ```
43
+
44
+ With this configuration:
45
+
46
+ - **Convex files** (`convex/**/*.{ts,js}`) must use **camelCase**: ✅ `getUserData.ts`, `sendMessage.ts`
47
+ - **All other files** must use **kebabCase**: ✅ `user-service.ts`, `api-client.ts`
48
+
49
+ ### Why camelCase for Convex?
50
+
51
+ Convex files export functions that become your backend API. Using camelCase keeps your filenames consistent with the function names they export:
52
+
53
+ ```typescript
54
+ // convex/getUserData.ts
55
+ export default query(async (ctx) => {
56
+ // Function is called as api.getUserData
57
+ });
58
+ ```
59
+
60
+ ### Disabling Filename Enforcement
61
+
62
+ If you want to disable filename case enforcement for Convex files, you can override it:
63
+
64
+ ```js
65
+ export default eslintConfig({
66
+ convex: true,
67
+ unicorn: true,
68
+ rules: {
69
+ "unicorn/filename-case": "off", // Disables for all files including Convex
70
+ },
71
+ });
72
+ ```
26
73
 
27
74
  ## Learn More
28
75
 
29
76
  - [Convex ESLint Plugin](https://docs.convex.dev/eslint) - Official documentation
77
+ - [Convex Validators](https://docs.convex.dev/functions/validation) - Argument validation guide
78
+ - [Unicorn Configuration](../unicorn/README.md) - Filename case options
30
79
  - [Main README](../../../README.md)
@@ -8,7 +8,7 @@ import { configNames } from "../constants.js";
8
8
  import { convexRules } from "./rules.js";
9
9
 
10
10
  // TODO: Replace with ESM import once @convex-dev/eslint-plugin stabilizes
11
- // The alpha version (0.0.1-alpha.4) doesn't have proper ESM exports yet
11
+ // The plugin doesn't have proper ESM exports yet
12
12
  const require = createRequire(import.meta.url);
13
13
 
14
14
  const convexPlugin = require("@convex-dev/eslint-plugin");
@@ -17,10 +17,12 @@ const convexPlugin = require("@convex-dev/eslint-plugin");
17
17
  * Creates an ESLint configuration for Convex.
18
18
  *
19
19
  * @param customRules - Optional object containing custom rules to override or add to the Convex configuration.
20
+ * @param unicorn - Whether the config uses unicorn rules.
20
21
  * @returns ESLint configuration object for Convex
21
22
  */
22
23
  export const convexConfig = (
23
24
  customRules?: Record<string, EslintRuleConfig>,
25
+ unicorn?: boolean,
24
26
  ): EslintConfigObject => ({
25
27
  files: ["**/convex/**/*.{ts,js}"],
26
28
  name: configNames.convex,
@@ -30,5 +32,16 @@ export const convexConfig = (
30
32
  rules: {
31
33
  ...convexRules,
32
34
  ...(customRules ?? {}),
35
+ // Convex files must be camelCase
36
+ ...(unicorn ?
37
+ {
38
+ "unicorn/filename-case": [
39
+ "warn",
40
+ {
41
+ case: "camelCase",
42
+ },
43
+ ],
44
+ }
45
+ : {}),
33
46
  },
34
47
  });
@@ -2,7 +2,6 @@ import type { ConvexRules } from "./types.js";
2
2
 
3
3
  export const convexRules: ConvexRules = {
4
4
  "@convex-dev/import-wrong-runtime": "warn",
5
- "@convex-dev/no-args-without-validator": "warn",
6
- "@convex-dev/no-missing-args-validator": "warn",
7
5
  "@convex-dev/no-old-registered-function-syntax": "warn",
6
+ "@convex-dev/require-args-validator": "warn",
8
7
  };
@@ -2,7 +2,6 @@ import type { EslintRuleConfig } from "../types.js";
2
2
 
3
3
  export interface ConvexRules {
4
4
  "@convex-dev/import-wrong-runtime": EslintRuleConfig;
5
- "@convex-dev/no-args-without-validator": EslintRuleConfig;
6
- "@convex-dev/no-missing-args-validator": EslintRuleConfig;
7
5
  "@convex-dev/no-old-registered-function-syntax": EslintRuleConfig;
6
+ "@convex-dev/require-args-validator": EslintRuleConfig;
8
7
  }
@@ -187,7 +187,9 @@ export const eslintConfig = (
187
187
  }
188
188
 
189
189
  if (convex) {
190
- configs.push(convexConfig(categorizedRules[configNames.convex]));
190
+ configs.push(
191
+ convexConfig(categorizedRules[configNames.convex], Boolean(unicorn)),
192
+ );
191
193
  }
192
194
 
193
195
  if (testing !== false) {
@@ -110,6 +110,23 @@ export default eslintConfig({
110
110
  });
111
111
  ```
112
112
 
113
+ ### Special Case: Convex Integration
114
+
115
+ When both Unicorn and Convex configurations are enabled, Convex files automatically use **camelCase** regardless of your global filename case setting. This is because Convex files export functions that become API endpoints, and camelCase is the standard for function names.
116
+
117
+ ```js
118
+ export default eslintConfig({
119
+ convex: true,
120
+ unicorn: { filenameCase: "kebabCase" }, // Global setting
121
+ });
122
+
123
+ // Result:
124
+ // - Convex files (convex/**/*.{ts,js}): camelCase ✅ getUserData.ts
125
+ // - All other files: kebabCase ✅ user-service.ts
126
+ ```
127
+
128
+ [→ Learn more about Convex filename conventions](../convex/README.md#filename-convention)
129
+
113
130
  ### Node.js Protocol
114
131
 
115
132
  Requires using the `node:` protocol when importing Node.js built-in modules: