eslint-plugin-kaezon 1.1.1 → 1.2.0
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 +14 -1
- package/README.md +6 -6
- package/dist/eslint-rules/boolean-is-prefix.js +1 -1
- package/dist/eslint-rules/computed-explicit-return-type.d.ts.map +1 -1
- package/dist/eslint-rules/computed-explicit-return-type.js +17 -2
- package/dist/eslint-rules/const-case.d.ts.map +1 -1
- package/dist/eslint-rules/const-case.js +21 -3
- package/dist/eslint-rules/prefer-object-params.js +2 -2
- package/dist/eslint-rules/require-satisfies-with-as-const.d.ts.map +1 -1
- package/dist/eslint-rules/require-satisfies-with-as-const.js +7 -8
- package/dist/eslint-rules/vue-prop-name-casing-by-type.d.ts.map +1 -1
- package/dist/eslint-rules/vue-prop-name-casing-by-type.js +2 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -8
- package/package.json +4 -2
- package/dist/configs/nuxt.d.ts +0 -3
- package/dist/configs/nuxt.d.ts.map +0 -1
- package/dist/configs/nuxt.js +0 -4
- package/dist/configs/nuxt_house.d.ts +0 -3
- package/dist/configs/nuxt_house.d.ts.map +0 -1
- package/dist/configs/nuxt_house.js +0 -4
- package/dist/configs/ts.d.ts +0 -3
- package/dist/configs/ts.d.ts.map +0 -1
- package/dist/configs/ts.js +0 -4
- package/dist/configs/vue.d.ts +0 -3
- package/dist/configs/vue.d.ts.map +0 -1
- package/dist/configs/vue.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.0] - 2026-11-19
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `kaezon/const-case` offers a suggestion instead of an autofix when renaming could change behavior: a reader in a shorthand property (`{ page_size }`) or an export specifier (`export { limit }`), a `.vue` file whose template reads the binding, or a new name that already resolves in scope.
|
|
15
|
+
- `kaezon/vue-prop-name-casing-by-type` reports only; its autofix is removed. It renamed the key in `defineProps` but not the usages or the parents that pass the prop. The hint for acronyms is now valid snake_case (`userID` → `user_id`, `URL` → `url`).
|
|
16
|
+
- `kaezon/boolean-is-prefix` accepts an `IS_` prefix, so `const IS_FLAG = false` passes it and `kaezon/const-case` at once. The README no longer claims it matches nothing outside Vue.
|
|
17
|
+
- `kaezon/prefer-object-params` no longer reports a callback passed to `new`, such as `new Promise((resolve, reject) => …)`, whose signature the constructor dictates.
|
|
18
|
+
- `@typescript-eslint/utils` is a dependency instead of a devDependency. The published `dist/types.d.ts` imports and re-exports its types, which did not resolve for consumers.
|
|
19
|
+
- `kaezon/require-satisfies-with-as-const` is only silenced by a `satisfies` on the same expression, not by one on any enclosing expression, and skips `-1 as const` like `1 as const`.
|
|
20
|
+
- `kaezon/computed-explicit-return-type` accepts a type argument (`computed<number>(() => 1)`) and checks the `get` of a writable `computed({ get, set })`.
|
|
21
|
+
|
|
10
22
|
## [1.1.1] - 2026-11-02
|
|
11
23
|
|
|
12
24
|
### Fixed
|
|
@@ -57,7 +69,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
57
69
|
- `configs.nuxt_house` requires `eslint-plugin-vue` and `@typescript-eslint/eslint-plugin`.
|
|
58
70
|
- The plugin ships no parser. Use `@typescript-eslint/parser` and `vue-eslint-parser` in the consuming project.
|
|
59
71
|
|
|
60
|
-
[Unreleased]: https://github.com/svaldivia12/eslint-plugin-kaezon/compare/v1.
|
|
72
|
+
[Unreleased]: https://github.com/svaldivia12/eslint-plugin-kaezon/compare/v1.2.0...HEAD
|
|
73
|
+
[1.2.0]: https://github.com/svaldivia12/eslint-plugin-kaezon/releases/tag/v1.2.0
|
|
61
74
|
[1.1.1]: https://github.com/svaldivia12/eslint-plugin-kaezon/releases/tag/v1.1.1
|
|
62
75
|
[1.1.0]: https://github.com/svaldivia12/eslint-plugin-kaezon/releases/tag/v1.1.0
|
|
63
76
|
[1.0.0]: https://github.com/svaldivia12/eslint-plugin-kaezon/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -149,19 +149,19 @@ export default [
|
|
|
149
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
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 |
|
|
151
151
|
|
|
152
|
-
`boolean-is-prefix` and `computed-explicit-return-type` target Vue code
|
|
152
|
+
`boolean-is-prefix` and `computed-explicit-return-type` target Vue code, which is why they are left out of the `ts` preset. `computed-explicit-return-type` matches nothing without Vue, but `boolean-is-prefix` also reports plain TypeScript booleans (`const flag: boolean`), so turn it on through the `rules` overlay if you want that outside Vue.
|
|
153
153
|
|
|
154
154
|
None of the rules accept options: every one declares an empty `schema`, so there is nothing to configure beyond on, off, or warn. Configure them through the preset and the `rules` overlay of `createConfig`.
|
|
155
155
|
|
|
156
156
|
### kaezon/boolean-is-prefix
|
|
157
157
|
|
|
158
|
-
Requires an `is_` prefix on bindings that hold a boolean or a Vue boolean ref. Without typed linting it reads the AST: `boolean` annotations, `Ref<boolean>`, and boolean literals. With typed linting it asks the type checker, so an inferred `shallowRef(getFlag())` is caught too.
|
|
158
|
+
Requires an `is_` prefix on bindings that hold a boolean or a Vue boolean ref. `IS_` is accepted too, so a literal constant that `const-case` puts in UPPER_CASE (`const IS_FLAG = false`) passes both rules. Without typed linting it reads the AST: `boolean` annotations, `Ref<boolean>`, and boolean literals. With typed linting it asks the type checker, so an inferred `shallowRef(getFlag())` is caught too.
|
|
159
159
|
|
|
160
160
|
The prefix must read naturally in English. Do not add `is_` to a name where it produces nonsense.
|
|
161
161
|
|
|
162
162
|
### kaezon/computed-explicit-return-type
|
|
163
163
|
|
|
164
|
-
Requires an explicit return type on getters passed to `computed`. Applies to arrow functions
|
|
164
|
+
Requires an explicit return type on getters passed to `computed`, including the `get` of a writable `computed({ get, set })`. Applies to arrow functions, function expressions and methods. A type argument (`computed<number>(…)`) counts as the return type.
|
|
165
165
|
|
|
166
166
|
### kaezon/const-case
|
|
167
167
|
|
|
@@ -169,11 +169,11 @@ UPPER_CASE for `const` bindings initialised with a literal or `as const`, lower
|
|
|
169
169
|
|
|
170
170
|
### kaezon/prefer-object-params
|
|
171
171
|
|
|
172
|
-
Prefers a single object parameter over multiple positional parameters. Callbacks (functions passed as arguments or properties), object methods, and `computed()` getters are skipped, because their signature is dictated by the caller.
|
|
172
|
+
Prefers a single object parameter over multiple positional parameters. Callbacks (functions passed as arguments to a call or `new`, or as properties), object methods, and `computed()` getters are skipped, because their signature is dictated by the caller.
|
|
173
173
|
|
|
174
174
|
### kaezon/require-satisfies-with-as-const
|
|
175
175
|
|
|
176
|
-
Requires `as const satisfies SomeType` instead of bare `as const`, so the object shape is validated at compile time while literal inference is preserved. Primitive literals are skipped because they need no structural check.
|
|
176
|
+
Requires `as const satisfies SomeType` instead of bare `as const`, so the object shape is validated at compile time while literal inference is preserved. Primitive literals, negative numbers included, are skipped because they need no structural check. Only a `satisfies` on the same expression counts: one on an enclosing object does not cover an `as const` inside it.
|
|
177
177
|
|
|
178
178
|
### kaezon/require-typescript-parser
|
|
179
179
|
|
|
@@ -221,7 +221,7 @@ Two runnable projects live under `examples/`:
|
|
|
221
221
|
- `examples/nuxt` — `configs.nuxt_house` with the house style and typed linting.
|
|
222
222
|
|
|
223
223
|
Both ship code that fails on purpose, so `npx eslint probe.ts` shows the rules
|
|
224
|
-
in action
|
|
224
|
+
in action.
|
|
225
225
|
|
|
226
226
|
## API
|
|
227
227
|
|
|
@@ -108,7 +108,7 @@ const rule = {
|
|
|
108
108
|
return;
|
|
109
109
|
if (!is_boolean_binding({ id, init, type_services }))
|
|
110
110
|
return;
|
|
111
|
-
if (id.name.startsWith('is_'))
|
|
111
|
+
if (id.name.startsWith('is_') || id.name.startsWith('IS_'))
|
|
112
112
|
return;
|
|
113
113
|
context.report({
|
|
114
114
|
data: { name: id.name },
|
|
@@ -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;
|
|
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;AAgCvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAiCzC,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -7,13 +7,28 @@ function is_computed_call(node) {
|
|
|
7
7
|
function is_function_getter(node) {
|
|
8
8
|
return node?.type === 'ArrowFunctionExpression' || node?.type === 'FunctionExpression';
|
|
9
9
|
}
|
|
10
|
+
/** The getter of `computed(() => …)` or of a writable `computed({ get, set })`. */
|
|
11
|
+
function find_getter(node) {
|
|
12
|
+
if (is_function_getter(node))
|
|
13
|
+
return node;
|
|
14
|
+
if (node?.type !== 'ObjectExpression')
|
|
15
|
+
return null;
|
|
16
|
+
const get = node.properties.find((property) => property.type === 'Property' &&
|
|
17
|
+
!property.computed &&
|
|
18
|
+
property.key.type === 'Identifier' &&
|
|
19
|
+
property.key.name === 'get');
|
|
20
|
+
return is_function_getter(get?.value) ? get.value : null;
|
|
21
|
+
}
|
|
10
22
|
const rule = {
|
|
11
23
|
create(context) {
|
|
12
24
|
function visit_call_expression(node) {
|
|
13
25
|
if (!is_computed_call(node))
|
|
14
26
|
return;
|
|
15
|
-
|
|
16
|
-
if (
|
|
27
|
+
// `computed<T>(…)` types the getter through its type argument.
|
|
28
|
+
if (node.typeArguments)
|
|
29
|
+
return;
|
|
30
|
+
const getter = find_getter(node.arguments[0]);
|
|
31
|
+
if (!getter)
|
|
17
32
|
return;
|
|
18
33
|
if (getter.returnType?.type === 'TSTypeAnnotation')
|
|
19
34
|
return;
|
|
@@ -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;
|
|
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,CAuJ5D,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -61,6 +61,23 @@ function is_exported(declaration) {
|
|
|
61
61
|
const { parent } = declaration;
|
|
62
62
|
return parent?.type === 'ExportNamedDeclaration' || parent?.type === 'ExportDefaultDeclaration';
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* A rename is only safe when the new name is free in the binding's scope and
|
|
66
|
+
* every scope below it: otherwise a reader would resolve to another binding,
|
|
67
|
+
* or an outer binding would be captured by the renamed one.
|
|
68
|
+
*/
|
|
69
|
+
function is_name_taken({ name, scope }) {
|
|
70
|
+
if (scope.set.has(name))
|
|
71
|
+
return true;
|
|
72
|
+
if (scope.references.some(reference => reference.identifier.name === name))
|
|
73
|
+
return true;
|
|
74
|
+
return scope.childScopes.some(child => is_name_taken({ name, scope: child }));
|
|
75
|
+
}
|
|
76
|
+
/** Renaming a shorthand property or export specifier also renames its key or export. */
|
|
77
|
+
function is_name_bound_elsewhere(identifier) {
|
|
78
|
+
const { parent } = identifier;
|
|
79
|
+
return (parent?.type === 'Property' && parent.shorthand) || parent?.type === 'ExportSpecifier';
|
|
80
|
+
}
|
|
64
81
|
function should_require_lower_case({ init, kind, name }) {
|
|
65
82
|
if (!UPPER_CASE_REGEX.test(name) || is_require_call(init) || has_as_const(init)) {
|
|
66
83
|
return false;
|
|
@@ -74,12 +91,13 @@ const rule = {
|
|
|
74
91
|
create(context) {
|
|
75
92
|
const source_code = context.sourceCode;
|
|
76
93
|
function build_rename({ declaration, identifier, next_name, }) {
|
|
77
|
-
|
|
94
|
+
// A .vue template reads the binding too, and the script scope cannot see it.
|
|
95
|
+
if (is_exported(declaration) || context.filename.endsWith('.vue'))
|
|
78
96
|
return null;
|
|
79
97
|
const variable = source_code
|
|
80
98
|
.getDeclaredVariables(declaration)
|
|
81
99
|
.find(candidate => candidate.name === identifier.name);
|
|
82
|
-
if (!variable)
|
|
100
|
+
if (!variable || is_name_taken({ name: next_name, scope: variable.scope }))
|
|
83
101
|
return null;
|
|
84
102
|
// Rename every occurrence in the file: the declaration plus all reads.
|
|
85
103
|
// `identifiers` and `references` can share a node, so dedupe by range.
|
|
@@ -96,7 +114,7 @@ const rule = {
|
|
|
96
114
|
seen.add(key);
|
|
97
115
|
targets.push(candidate);
|
|
98
116
|
}
|
|
99
|
-
if (targets.length === 0)
|
|
117
|
+
if (targets.length === 0 || targets.some(is_name_bound_elsewhere))
|
|
100
118
|
return null;
|
|
101
119
|
return fixer => targets.map(target => fixer.replaceText(target, next_name));
|
|
102
120
|
}
|
|
@@ -10,7 +10,7 @@ function is_computed_getter(node) {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
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
|
|
13
|
+
* object property, a class method, or a callback passed to a call or `new`. Changing
|
|
14
14
|
* their parameters would change a public API or break the caller.
|
|
15
15
|
*/
|
|
16
16
|
function is_external_callback(node) {
|
|
@@ -23,7 +23,7 @@ function is_external_callback(node) {
|
|
|
23
23
|
return true;
|
|
24
24
|
if (parent.type === 'PropertyDefinition')
|
|
25
25
|
return true;
|
|
26
|
-
if (parent.type === 'CallExpression')
|
|
26
|
+
if (parent.type === 'CallExpression' || parent.type === 'NewExpression')
|
|
27
27
|
return true;
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-satisfies-with-as-const.d.ts","sourceRoot":"","sources":["../../eslint-rules/require-satisfies-with-as-const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"require-satisfies-with-as-const.d.ts","sourceRoot":"","sources":["../../eslint-rules/require-satisfies-with-as-const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AAmCvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,kBAAkB,CA6BxC,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -13,16 +13,15 @@ function is_bare_as_const(node) {
|
|
|
13
13
|
typeAnnotation.typeName.name !== 'const') {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (current.type === 'TSSatisfiesExpression')
|
|
19
|
-
return false;
|
|
20
|
-
current = current.parent;
|
|
21
|
-
}
|
|
22
|
-
return true;
|
|
16
|
+
// Only `x as const satisfies T` checks x; a satisfies further out checks something else.
|
|
17
|
+
return node.parent.type !== 'TSSatisfiesExpression' || node.parent.expression !== node;
|
|
23
18
|
}
|
|
24
19
|
function is_primitive_literal(node) {
|
|
25
|
-
|
|
20
|
+
const { expression } = node;
|
|
21
|
+
return (expression.type === 'Literal' ||
|
|
22
|
+
(expression.type === 'UnaryExpression' &&
|
|
23
|
+
expression.operator === '-' &&
|
|
24
|
+
expression.argument.type === 'Literal'));
|
|
26
25
|
}
|
|
27
26
|
const rule = {
|
|
28
27
|
create(context) {
|
|
@@ -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,
|
|
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,EAAY,MAAM,aAAa,CAAA;AA8EvD,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,mBAAmB,GAAG,mBAAmB,CAgE/D,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -23,29 +23,12 @@ 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
|
-
// A numeric or symbol literal key
|
|
27
|
-
// renaming it would change the prop name the consumer must pass, so skip it.
|
|
26
|
+
// A numeric or symbol literal key has no name to case, so skip it.
|
|
28
27
|
if (node.key.type === 'Literal' && typeof node.key.value === 'string') {
|
|
29
28
|
return node.key.value;
|
|
30
29
|
}
|
|
31
30
|
return null;
|
|
32
31
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Renaming an identifier key is safe: the prop name is the identifier itself.
|
|
35
|
-
* A string-literal key has to keep its quotes, otherwise the fix would emit
|
|
36
|
-
* invalid syntax. Computed keys and template literals return null and get no fix.
|
|
37
|
-
*/
|
|
38
|
-
function build_rename({ node, next_name, }) {
|
|
39
|
-
const { key } = node;
|
|
40
|
-
if (key.type === 'Identifier') {
|
|
41
|
-
return fixer => fixer.replaceText(key, next_name);
|
|
42
|
-
}
|
|
43
|
-
if (key.type === 'Literal' && typeof key.value === 'string') {
|
|
44
|
-
const quote = key.raw.startsWith('"') ? '"' : "'";
|
|
45
|
-
return fixer => fixer.replaceText(key, `${quote}${next_name}${quote}`);
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
32
|
function get_props_from_type_literal(type_literal) {
|
|
50
33
|
if (type_literal?.type !== 'TSTypeLiteral')
|
|
51
34
|
return [];
|
|
@@ -79,7 +62,7 @@ function to_camel_case(name) {
|
|
|
79
62
|
return name.replaceAll(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
80
63
|
}
|
|
81
64
|
function to_snake_case(name) {
|
|
82
|
-
return name.replaceAll(/([A-Z])/g,
|
|
65
|
+
return name.replaceAll(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase();
|
|
83
66
|
}
|
|
84
67
|
const rule = {
|
|
85
68
|
create(context) {
|
|
@@ -94,7 +77,6 @@ const rule = {
|
|
|
94
77
|
return;
|
|
95
78
|
context.report({
|
|
96
79
|
data: { expected, name },
|
|
97
|
-
fix: build_rename({ next_name: expected, node: prop }),
|
|
98
80
|
messageId: 'variableSnakeCase',
|
|
99
81
|
node: prop.key,
|
|
100
82
|
});
|
|
@@ -106,7 +88,6 @@ const rule = {
|
|
|
106
88
|
return;
|
|
107
89
|
context.report({
|
|
108
90
|
data: { expected, name },
|
|
109
|
-
fix: build_rename({ next_name: expected, node: prop }),
|
|
110
91
|
messageId: 'functionCamelCase',
|
|
111
92
|
node: prop.key,
|
|
112
93
|
});
|
|
@@ -136,7 +117,6 @@ const rule = {
|
|
|
136
117
|
description: 'Enforce camelCase for function props and snake_case for other props in defineProps',
|
|
137
118
|
url: 'https://github.com/svaldivia12/eslint-plugin-kaezon#kaezonvue-prop-name-casing-by-type',
|
|
138
119
|
},
|
|
139
|
-
fixable: 'code',
|
|
140
120
|
messages: {
|
|
141
121
|
functionCamelCase: "Function prop '{{name}}' should be camelCase (e.g. {{expected}}).",
|
|
142
122
|
variableSnakeCase: "Variable prop '{{name}}' should be snake_case (e.g. {{expected}}).",
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,YAAY,CAAA;AA8BnE,QAAA,MAAM,MAAM,EAAE,YAUb,CAAA;AA0BD,eAAe,MAAM,CAAA;AAErB,YAAY,EACT,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,YAAY,GACd,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { create_config } from "./configs/create_config.js";
|
|
4
|
-
import { create_nuxt_config } from "./configs/nuxt.js";
|
|
5
|
-
import { create_nuxt_house_config } from "./configs/nuxt_house.js";
|
|
6
|
-
import { create_ts_config } from "./configs/ts.js";
|
|
7
|
-
import { create_vue_config } from "./configs/vue.js";
|
|
8
4
|
import rules_module from "./eslint-rules/index.js";
|
|
9
5
|
import { to_plugin_rules } from "./types.js";
|
|
10
6
|
/**
|
|
@@ -42,9 +38,9 @@ const plugin = {
|
|
|
42
38
|
},
|
|
43
39
|
rules: to_plugin_rules(rules_module.rules),
|
|
44
40
|
};
|
|
45
|
-
plugin.configs.nuxt =
|
|
46
|
-
plugin.configs.ts =
|
|
47
|
-
plugin.configs.vue =
|
|
41
|
+
plugin.configs.nuxt = create_config({ options: { preset: 'nuxt' }, plugin });
|
|
42
|
+
plugin.configs.ts = create_config({ options: { preset: 'ts' }, plugin });
|
|
43
|
+
plugin.configs.vue = create_config({ options: { preset: 'vue' }, plugin });
|
|
48
44
|
/**
|
|
49
45
|
* Lazily built: the nuxt_house preset needs eslint-plugin-vue and
|
|
50
46
|
* @typescript-eslint/eslint-plugin, and the error should surface when the
|
|
@@ -54,7 +50,7 @@ Object.defineProperty(plugin.configs, 'nuxt_house', {
|
|
|
54
50
|
configurable: true,
|
|
55
51
|
enumerable: true,
|
|
56
52
|
get() {
|
|
57
|
-
const config =
|
|
53
|
+
const config = create_config({ options: { preset: 'nuxt_house' }, plugin });
|
|
58
54
|
Object.defineProperty(plugin.configs, 'nuxt_house', {
|
|
59
55
|
configurable: true,
|
|
60
56
|
enumerable: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-kaezon",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "ESLint 10 flat-config plugin with custom TypeScript and Vue rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
"access": "public",
|
|
52
52
|
"provenance": true
|
|
53
53
|
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@typescript-eslint/utils": "^8.72.1"
|
|
56
|
+
},
|
|
54
57
|
"peerDependencies": {
|
|
55
58
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
56
59
|
"eslint": "^10.0.0",
|
|
@@ -85,7 +88,6 @@
|
|
|
85
88
|
"@types/node": "^26.6.6",
|
|
86
89
|
"@typescript-eslint/eslint-plugin": "^8.72.1",
|
|
87
90
|
"@typescript-eslint/parser": "^8.72.1",
|
|
88
|
-
"@typescript-eslint/utils": "^8.72.1",
|
|
89
91
|
"eslint": "^10.14.0",
|
|
90
92
|
"eslint-config-prettier": "^10.1.8",
|
|
91
93
|
"eslint-plugin-vue": "^10.12.0",
|
package/dist/configs/nuxt.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.ts","sourceRoot":"","sources":["../../configs/nuxt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE3D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAEnE"}
|
package/dist/configs/nuxt.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt_house.d.ts","sourceRoot":"","sources":["../../configs/nuxt_house.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAEzE"}
|
package/dist/configs/ts.d.ts
DELETED
package/dist/configs/ts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ts.d.ts","sourceRoot":"","sources":["../../configs/ts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE3D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAEjE"}
|
package/dist/configs/ts.js
DELETED
package/dist/configs/vue.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../configs/vue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE3D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAElE"}
|
package/dist/configs/vue.js
DELETED