eslint-plugin-kaezon 1.1.0 → 1.1.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/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.1] - 2026-11-02
11
+
12
+ ### Fixed
13
+
14
+ - `kaezon/prefer-object-params` no longer reports class methods or class property functions. Their parameter list belongs to the class, not to the body, so asking for a single object parameter would change a public API.
15
+ - `kaezon/vue-prop-name-casing-by-type` no longer reports numeric or symbol keys. `defineProps<{ 42: string }>()` was told to use snake_case, which cannot apply to a key that has no name to case.
16
+
17
+ ## [1.1.0] - 2026-11-02
18
+
10
19
  ### Added
11
20
 
12
21
  - `kaezon/vue-prop-name-casing-by-type` now autofixes prop names, keeping the original quote style for string-literal keys.
@@ -48,5 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
48
57
  - `configs.nuxt_house` requires `eslint-plugin-vue` and `@typescript-eslint/eslint-plugin`.
49
58
  - The plugin ships no parser. Use `@typescript-eslint/parser` and `vue-eslint-parser` in the consuming project.
50
59
 
51
- [Unreleased]: https://github.com/svaldivia12/eslint-plugin-kaezon/compare/v1.0.0...HEAD
60
+ [Unreleased]: https://github.com/svaldivia12/eslint-plugin-kaezon/compare/v1.1.1...HEAD
61
+ [1.1.1]: https://github.com/svaldivia12/eslint-plugin-kaezon/releases/tag/v1.1.1
62
+ [1.1.0]: https://github.com/svaldivia12/eslint-plugin-kaezon/releases/tag/v1.1.0
52
63
  [1.0.0]: https://github.com/svaldivia12/eslint-plugin-kaezon/releases/tag/v1.0.0
package/README.md CHANGED
@@ -103,10 +103,7 @@ Override a rule in a following config object:
103
103
  ```js
104
104
  import kaezon_plugin from 'eslint-plugin-kaezon'
105
105
 
106
- export default [
107
- kaezon_plugin.configs.nuxt,
108
- { rules: { 'kaezon/const-case': 'off' } },
109
- ]
106
+ export default [kaezon_plugin.configs.nuxt, { rules: { 'kaezon/const-case': 'off' } }]
110
107
  ```
111
108
 
112
109
  `createConfig` keys accept kaezon short names (`const-case`) or prefixed ids (`kaezon/const-case`); those emit prefixed `kaezon/...` ids. Other ESLint rule ids (`curly`, `@typescript-eslint/...`, `vue/...`) are copied through so house style can be overridden without a second config object. Unknown `kaezon/...` names throw.
@@ -142,15 +139,15 @@ export default [
142
139
 
143
140
  ## Rules
144
141
 
145
- | Rule id | Description | Presets |
146
- |---|---|---|
147
- | `kaezon/boolean-is-prefix` | Require `is_` prefix for booleans and Vue boolean refs (`Ref` / `ShallowRef` / `ComputedRef`); type-aware when typed linting is enabled | vue, nuxt, nuxt_house |
148
- | `kaezon/computed-explicit-return-type` | Require explicit return types for getters passed to `computed` | vue, nuxt, nuxt_house |
149
- | `kaezon/const-case` | Require UPPER_CASE for literal and `as const` declarations, and lower case for mutable or computed bindings | ts, nuxt, nuxt_house |
150
- | `kaezon/prefer-object-params` | Prefer a single object parameter over multiple positional parameters | ts, nuxt, nuxt_house |
151
- | `kaezon/require-satisfies-with-as-const` | Require `as const satisfies SomeType` instead of bare `as const` to validate structure at compile time | ts, nuxt, nuxt_house |
152
- | `kaezon/require-typescript-parser` | Require a TypeScript parser for TS files, and `vue-eslint-parser` with a TypeScript parser for Vue files | ts, vue, nuxt, nuxt_house |
153
- | `kaezon/vue-prop-name-casing-by-type` | Enforce camelCase for function props and snake_case for other props in `defineProps` | vue, nuxt, nuxt_house |
142
+ | Rule id | Description | Presets |
143
+ | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
144
+ | `kaezon/boolean-is-prefix` | Require `is_` prefix for booleans and Vue boolean refs (`Ref` / `ShallowRef` / `ComputedRef`); type-aware when typed linting is enabled | vue, nuxt, nuxt_house |
145
+ | `kaezon/computed-explicit-return-type` | Require explicit return types for getters passed to `computed` | vue, nuxt, nuxt_house |
146
+ | `kaezon/const-case` | Require UPPER_CASE for literal and `as const` declarations, and lower case for mutable or computed bindings | ts, nuxt, nuxt_house |
147
+ | `kaezon/prefer-object-params` | Prefer a single object parameter over multiple positional parameters | ts, nuxt, nuxt_house |
148
+ | `kaezon/require-satisfies-with-as-const` | Require `as const satisfies SomeType` instead of bare `as const` to validate structure at compile time | ts, nuxt, nuxt_house |
149
+ | `kaezon/require-typescript-parser` | Require a TypeScript parser for TS files, and `vue-eslint-parser` with a TypeScript parser for Vue files | ts, vue, nuxt, nuxt_house |
150
+ | `kaezon/vue-prop-name-casing-by-type` | Enforce camelCase for function props and snake_case for other props in `defineProps` | vue, nuxt, nuxt_house |
154
151
 
155
152
  `boolean-is-prefix` and `computed-explicit-return-type` target Vue code. In a project without Vue they match nothing, which is why they are left out of the `ts` preset.
156
153
 
@@ -1 +1 @@
1
- {"version":3,"file":"create_config.d.ts","sourceRoot":"","sources":["../../configs/create_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACT,mBAAmB,EACnB,UAAU,EACV,YAAY,EAGZ,UAAU,EACZ,MAAM,aAAa,CAAA;AAMpB,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAM1C,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAIrC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAItC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAkC,CAAA;AAE5E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA4CjE,CAAA;AAgHD,wBAAgB,aAAa,CAAC,EAC3B,OAAY,EACZ,MAAM,GACR,EAAE;IACA,OAAO,CAAC,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,YAAY,CAAA;CACtB,GAAG,UAAU,CAsBb"}
1
+ {"version":3,"file":"create_config.d.ts","sourceRoot":"","sources":["../../configs/create_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACT,mBAAmB,EACnB,UAAU,EACV,YAAY,EAGZ,UAAU,EACZ,MAAM,aAAa,CAAA;AAMpB,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAM1C,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAIrC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAItC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAkC,CAAA;AAE5E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA4CjE,CAAA;AA4GD,wBAAgB,aAAa,CAAC,EAC3B,OAAY,EACZ,MAAM,GACR,EAAE;IACA,OAAO,CAAC,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,YAAY,CAAA;CACtB,GAAG,UAAU,CAoBb"}
@@ -150,9 +150,7 @@ export function create_config({ options = {}, plugin, }) {
150
150
  const files = options.files ?? [...default_files];
151
151
  const overlay = options.rules ?? {};
152
152
  const is_house = preset === 'nuxt_house';
153
- const plugins = is_house
154
- ? { ...load_peer_plugins(), kaezon: plugin }
155
- : { kaezon: plugin };
153
+ const plugins = is_house ? { ...load_peer_plugins(), kaezon: plugin } : { kaezon: plugin };
156
154
  return {
157
155
  files,
158
156
  name: preset_config_names[preset],
@@ -1 +1 @@
1
- {"version":3,"file":"boolean-is-prefix.d.ts","sourceRoot":"","sources":["../../eslint-rules/boolean-is-prefix.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AAgKvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,iBAAiB,CA2DvC,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"boolean-is-prefix.d.ts","sourceRoot":"","sources":["../../eslint-rules/boolean-is-prefix.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AAuJvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,iBAAiB,CAwDvC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -17,9 +17,7 @@ function get_node_type({ node, type_services, }) {
17
17
  return type_services.checker.getTypeAtLocation(ts_node);
18
18
  }
19
19
  function get_symbol_name(type) {
20
- const symbol = type.aliasSymbol ??
21
- type.target?.symbol ??
22
- type.getSymbol();
20
+ const symbol = type.aliasSymbol ?? type.target?.symbol ?? type.getSymbol();
23
21
  return symbol?.getName() ?? null;
24
22
  }
25
23
  function get_type_arguments({ checker, type, }) {
@@ -57,8 +55,7 @@ function is_ast_boolean_type(type_node) {
57
55
  if (type_node.type === 'TSBooleanKeyword')
58
56
  return true;
59
57
  if (type_node.type === 'TSLiteralType') {
60
- return (type_node.literal.type === 'Literal' &&
61
- typeof type_node.literal.value === 'boolean');
58
+ return type_node.literal.type === 'Literal' && typeof type_node.literal.value === 'boolean';
62
59
  }
63
60
  return false;
64
61
  }
@@ -77,7 +74,7 @@ function is_ast_boolean_ref_call(init) {
77
74
  if (is_ast_boolean_type(init.typeArguments?.params[0]))
78
75
  return true;
79
76
  const first_arg = init.arguments[0];
80
- return (first_arg?.type === 'Literal' && typeof first_arg.value === 'boolean');
77
+ return first_arg?.type === 'Literal' && typeof first_arg.value === 'boolean';
81
78
  }
82
79
  function is_ast_boolean_binding({ id, init, }) {
83
80
  const annotation = id.typeAnnotation?.typeAnnotation;
@@ -1 +1 @@
1
- {"version":3,"file":"computed-explicit-return-type.d.ts","sourceRoot":"","sources":["../../eslint-rules/computed-explicit-return-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AAkBvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAgCzC,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"computed-explicit-return-type.d.ts","sourceRoot":"","sources":["../../eslint-rules/computed-explicit-return-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AAevD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,mBAAmB,CA8BzC,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -5,8 +5,7 @@ function is_computed_call(node) {
5
5
  return callee.type === 'Identifier' && callee.name === 'computed';
6
6
  }
7
7
  function is_function_getter(node) {
8
- return (node?.type === 'ArrowFunctionExpression' ||
9
- node?.type === 'FunctionExpression');
8
+ return node?.type === 'ArrowFunctionExpression' || node?.type === 'FunctionExpression';
10
9
  }
11
10
  const rule = {
12
11
  create(context) {
@@ -1 +1 @@
1
- {"version":3,"file":"const-case.d.ts","sourceRoot":"","sources":["../../eslint-rules/const-case.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAA;AAwHjE,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,WAAW,GAAG,UAAU,GAAG,WAAW,CAyJ5D,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"const-case.d.ts","sourceRoot":"","sources":["../../eslint-rules/const-case.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAA;AAuGjE,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,WAAW,GAAG,UAAU,GAAG,WAAW,CAsJ5D,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -59,21 +59,16 @@ function to_lower_case(name) {
59
59
  */
60
60
  function is_exported(declaration) {
61
61
  const { parent } = declaration;
62
- return (parent?.type === 'ExportNamedDeclaration' ||
63
- parent?.type === 'ExportDefaultDeclaration');
62
+ return parent?.type === 'ExportNamedDeclaration' || parent?.type === 'ExportDefaultDeclaration';
64
63
  }
65
- function should_require_lower_case({ init, kind, name, }) {
66
- if (!UPPER_CASE_REGEX.test(name) ||
67
- is_require_call(init) ||
68
- has_as_const(init)) {
64
+ function should_require_lower_case({ init, kind, name }) {
65
+ if (!UPPER_CASE_REGEX.test(name) || is_require_call(init) || has_as_const(init)) {
69
66
  return false;
70
67
  }
71
68
  return kind === 'let' || (kind === 'const' && !is_literal(init));
72
69
  }
73
- function should_require_upper_case({ init, kind, name, }) {
74
- return (kind === 'const' &&
75
- !UPPER_CASE_REGEX.test(name) &&
76
- (is_literal(init) || has_as_const(init)));
70
+ function should_require_upper_case({ init, kind, name }) {
71
+ return (kind === 'const' && !UPPER_CASE_REGEX.test(name) && (is_literal(init) || has_as_const(init)));
77
72
  }
78
73
  const rule = {
79
74
  create(context) {
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-object-params.d.ts","sourceRoot":"","sources":["../../eslint-rules/prefer-object-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AA0CvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAuC1C,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"prefer-object-params.d.ts","sourceRoot":"","sources":["../../eslint-rules/prefer-object-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AA6CvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAsC1C,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -8,12 +8,21 @@ function is_computed_getter(node) {
8
8
  const { callee } = parent;
9
9
  return callee.type === 'Identifier' && callee.name === 'computed';
10
10
  }
11
+ /**
12
+ * A function whose signature is dictated by something other than its body: an
13
+ * object property, a class method, or a callback passed to a call. Changing
14
+ * their parameters would change a public API or break the caller.
15
+ */
11
16
  function is_external_callback(node) {
12
17
  const { parent } = node;
13
18
  if (!parent)
14
19
  return false;
15
20
  if (parent.type === 'Property')
16
21
  return true;
22
+ if (parent.type === 'MethodDefinition')
23
+ return true;
24
+ if (parent.type === 'PropertyDefinition')
25
+ return true;
17
26
  if (parent.type === 'CallExpression')
18
27
  return true;
19
28
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"require-typescript-parser.d.ts","sourceRoot":"","sources":["../../eslint-rules/require-typescript-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA+B,MAAM,aAAa,CAAA;AAgH1E,QAAA,MAAM,IAAI,EAAE,UAAU,CACnB,mBAAmB,GAAG,oBAAoB,GAAG,uBAAuB,CA6CtE,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"require-typescript-parser.d.ts","sourceRoot":"","sources":["../../eslint-rules/require-typescript-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA+B,MAAM,aAAa,CAAA;AAsG1E,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,mBAAmB,GAAG,oBAAoB,GAAG,uBAAuB,CA4C1F,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -29,7 +29,7 @@ function get_parser_name(parser) {
29
29
  function is_typescript_parser_name(name) {
30
30
  if (!name)
31
31
  return false;
32
- return (name === '@typescript-eslint/parser' || name.includes('typescript-eslint'));
32
+ return name === '@typescript-eslint/parser' || name.includes('typescript-eslint');
33
33
  }
34
34
  function is_vue_parser_name(name) {
35
35
  if (!name)
@@ -1 +1 @@
1
- {"version":3,"file":"vue-prop-name-casing-by-type.d.ts","sourceRoot":"","sources":["../../eslint-rules/vue-prop-name-casing-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAA;AAuGjE,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,mBAAmB,GAAG,mBAAmB,CAqE/D,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"vue-prop-name-casing-by-type.d.ts","sourceRoot":"","sources":["../../eslint-rules/vue-prop-name-casing-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAA;AAsGjE,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,mBAAmB,GAAG,mBAAmB,CAmE/D,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -23,8 +23,11 @@ function extract_define_props_call(node) {
23
23
  function get_prop_name(node) {
24
24
  if (node.key.type === 'Identifier')
25
25
  return node.key.name;
26
- if (node.key.type === 'Literal')
27
- return String(node.key.value);
26
+ // A numeric or symbol literal key cannot be camelCase or snake_case, and
27
+ // renaming it would change the prop name the consumer must pass, so skip it.
28
+ if (node.key.type === 'Literal' && typeof node.key.value === 'string') {
29
+ return node.key.value;
30
+ }
28
31
  return null;
29
32
  }
30
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-kaezon",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "ESLint 10 flat-config plugin with custom TypeScript and Vue rules.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -67,22 +67,32 @@
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsc --project tsconfig.json",
70
+ "format": "prettier --write .",
71
+ "format:check": "prettier --check .",
70
72
  "lint": "eslint .",
73
+ "prepare": "husky",
71
74
  "typecheck": "pnpm run build && tsc --project tsconfig.test.json",
72
75
  "test": "node --test tests/**/*.test.ts",
76
+ "test:examples": "node scripts/check_examples.ts",
73
77
  "check:package": "publint && attw --pack . --profile esm-only",
74
- "prepublishOnly": "pnpm run build && pnpm run lint && pnpm run test && pnpm run typecheck"
78
+ "prepublishOnly": "pnpm run format:check && pnpm run build && pnpm run lint && pnpm run test && pnpm run typecheck"
75
79
  },
76
80
  "devDependencies": {
77
81
  "@arethetypeswrong/cli": "^0.18.5",
82
+ "@commitlint/cli": "^21.2.4",
83
+ "@commitlint/config-conventional": "^21.2.4",
78
84
  "@eslint/js": "^10.0.1",
79
85
  "@types/node": "^26.6.6",
80
86
  "@typescript-eslint/eslint-plugin": "^8.72.1",
81
87
  "@typescript-eslint/parser": "^8.72.1",
82
88
  "@typescript-eslint/utils": "^8.72.1",
83
89
  "eslint": "^10.14.0",
90
+ "eslint-config-prettier": "^10.1.8",
84
91
  "eslint-plugin-vue": "^10.12.0",
85
92
  "globals": "^17.13.0",
93
+ "husky": "^9.1.7",
94
+ "lint-staged": "^17.6.0",
95
+ "prettier": "^3.9.10",
86
96
  "publint": "^0.3.25",
87
97
  "typescript": "~6.0.3",
88
98
  "vue-eslint-parser": "^10.4.1"